2007-06-03 23:56:56 +00:00
|
|
|
<?php
|
|
|
|
/* SVN FILE: $Id$ */
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
|
|
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
|
|
|
* 1785 E. Sahara Avenue, Suite 490-204
|
|
|
|
* Las Vegas, Nevada 89104
|
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
|
|
|
* @filesource
|
|
|
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
|
|
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.console.libs.templates.views
|
2007-06-16 02:19:31 +00:00
|
|
|
* @since CakePHP(tm) v 1.2.0.5234
|
2007-06-03 23:56:56 +00:00
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
<div class="<?php echo $singularVar;?>">
|
2007-06-16 02:19:31 +00:00
|
|
|
<h2><?php echo "<?php __('{$singularHumanName}');?>";?></h2>
|
2007-06-03 23:56:56 +00:00
|
|
|
<dl>
|
|
|
|
<?php
|
|
|
|
$i = 0;
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($fields as $field) {
|
2007-06-16 02:19:31 +00:00
|
|
|
$class = null;
|
2007-06-20 06:15:35 +00:00
|
|
|
if ($i++ % 2 == 0) {
|
2007-06-03 23:56:56 +00:00
|
|
|
$class = ' class="altrow"';
|
|
|
|
}
|
2007-06-16 02:19:31 +00:00
|
|
|
|
2007-06-20 06:15:35 +00:00
|
|
|
if (in_array($field['name'], array_keys($foreignKeys))) {
|
2007-06-03 23:56:56 +00:00
|
|
|
$otherModelClass = $foreignKeys[$field['name']][1];
|
|
|
|
$otherModelKey = Inflector::underscore($otherModelClass);
|
|
|
|
$otherControllerName = Inflector::pluralize($otherModelClass);
|
|
|
|
$otherControllerPath = Inflector::underscore($otherControllerName);
|
2007-06-20 06:15:35 +00:00
|
|
|
if (isset($foreignKeys[$field['name']][2])) {
|
2007-06-08 16:30:22 +00:00
|
|
|
$otherModelClass = $foreignKeys[$field['name']][2];
|
|
|
|
}
|
2007-06-03 23:56:56 +00:00
|
|
|
$otherSingularVar = Inflector::variable($otherModelClass);
|
|
|
|
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
|
|
|
|
$otherPrimaryKey = $otherModelObj->primaryKey;
|
|
|
|
$otherDisplayField = $otherModelObj->displayField;
|
2007-10-08 20:13:20 +00:00
|
|
|
echo "\t\t<dt{$class}><?php __('".Inflector::humanize($otherModelClass)."') ?></dt>\n";
|
|
|
|
echo "\t\t<dd{$class}>\n\t\t\t<?php echo \$html->link(__(\${$singularVar}['{$otherModelClass}']['{$otherDisplayField}'], true), array('controller'=> '{$otherControllerPath}', 'action'=>'view', \${$singularVar}['{$otherModelClass}']['{$otherPrimaryKey}'])); ?>\n\t\t\t \n\t\t</dd>\n";
|
2007-06-03 23:56:56 +00:00
|
|
|
} else {
|
2007-10-08 20:13:20 +00:00
|
|
|
echo "\t\t<dt{$class}><?php __('".Inflector::humanize($field['name'])."') ?></dt>\n";
|
|
|
|
echo "\t\t<dd{$class}>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field['name']}'] ?>\n\t\t\t \n\t\t</dd>\n";
|
2007-06-03 23:56:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
<div class="actions">
|
|
|
|
<ul>
|
|
|
|
<?php
|
2007-10-06 06:46:45 +00:00
|
|
|
echo "\t\t<li><?php echo \$html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
|
|
|
echo "\t\t<li><?php echo \$html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
|
|
|
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action'=>'index')); ?> </li>\n";
|
|
|
|
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action'=>'add')); ?> </li>\n";
|
2007-06-03 23:56:56 +00:00
|
|
|
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($foreignKeys as $field => $value) {
|
2007-06-03 23:56:56 +00:00
|
|
|
$otherModelClass = $value['1'];
|
2007-06-20 06:15:35 +00:00
|
|
|
if ($otherModelClass != $modelClass) {
|
2007-06-03 23:56:56 +00:00
|
|
|
$otherModelKey = Inflector::underscore($otherModelClass);
|
|
|
|
$otherControllerName = Inflector::pluralize($otherModelClass);
|
|
|
|
$otherControllerPath = Inflector::underscore($otherControllerName);
|
|
|
|
$otherSingularVar = Inflector::variable($otherModelClass);
|
|
|
|
$otherPluralHumanName = Inflector::humanize($otherControllerPath);
|
|
|
|
$otherSingularHumanName = Inflector::humanize($otherModelKey);
|
2007-10-06 06:46:45 +00:00
|
|
|
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('{$otherPluralHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
|
|
|
|
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('{$otherSingularHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
|
2007-06-03 23:56:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
$i = 0;
|
|
|
|
foreach ($hasOne as $assocName => $assocData):
|
|
|
|
$otherModelKey = Inflector::underscore($assocData['className']);
|
|
|
|
$otherControllerPath = Inflector::pluralize($otherModelKey);
|
|
|
|
$otherControllerName = Inflector::camelize($otherControllerPath);
|
|
|
|
$assocKey = Inflector::underscore($assocName);
|
|
|
|
$otherPluralHumanName = Inflector::humanize(Inflector::pluralize($assocKey));
|
|
|
|
$otherSingularHumanName = Inflector::humanize($assocKey);
|
|
|
|
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
|
|
|
|
$otherFields = $otherModelObj->_tableInfo->value;
|
|
|
|
$otherPrimaryKey = $otherModelObj->primaryKey;
|
|
|
|
?>
|
|
|
|
<div class="related">
|
2007-10-06 06:46:45 +00:00
|
|
|
<h3><?php echo "<?php echo sprintf(__('Related %s', true), __('{$otherSingularHumanName}', true));?>";?></h3>
|
2007-06-20 06:15:35 +00:00
|
|
|
<?php echo "<?php if (!empty(\${$singularVar}['{$assocName}'])):?>\n";?>
|
2007-06-03 23:56:56 +00:00
|
|
|
<dl>
|
|
|
|
<?php
|
2007-06-16 02:19:31 +00:00
|
|
|
$i = 0;
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($otherFields as $field) {
|
2007-06-16 02:19:31 +00:00
|
|
|
$class = null;
|
2007-06-20 06:15:35 +00:00
|
|
|
if ($i++ % 2 == 0) {
|
2007-06-16 02:19:31 +00:00
|
|
|
$class = ' class="altrow"';
|
|
|
|
}
|
|
|
|
|
2007-06-03 23:56:56 +00:00
|
|
|
echo "\t\t<dt{$class}>".Inflector::humanize($field['name'])."</dt>\n";
|
2007-06-05 08:49:36 +00:00
|
|
|
echo "\t\t<dd{$class}>\n\t<?php echo \${$singularVar}['{$assocName}']['{$field['name']}'] ?>\n </dd>\n";
|
2007-06-03 23:56:56 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</dl>
|
|
|
|
<?php echo "<?php endif; ?>\n";?>
|
|
|
|
<div class="actions">
|
|
|
|
<ul>
|
2007-10-06 06:46:45 +00:00
|
|
|
<li><?php echo "<?php echo \$html->link(sprinft(__('Edit %s', true), __('{$otherSingularHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'edit', \${$singularVar}['{$assocName}']['{$otherPrimaryKey}']));?></li>\n";?>
|
2007-06-03 23:56:56 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
2007-06-16 02:19:31 +00:00
|
|
|
$i++;
|
2007-06-03 23:56:56 +00:00
|
|
|
endforeach;
|
|
|
|
|
|
|
|
$relations = array_merge($hasMany, $hasAndBelongsToMany);
|
|
|
|
$i = 0;
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($relations as $assocName => $assocData):
|
2007-06-03 23:56:56 +00:00
|
|
|
$otherModelKey = Inflector::underscore($assocData['className']);
|
|
|
|
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
|
|
|
|
$otherControllerPath = Inflector::pluralize($otherModelKey);
|
|
|
|
$otherControllerName = Inflector::camelize($otherControllerPath);
|
|
|
|
$otherSingularVar = Inflector::variable($assocName);
|
2007-06-14 17:28:35 +00:00
|
|
|
$assocKey = Inflector::underscore($assocName);
|
|
|
|
$otherPluralHumanName = Inflector::humanize(Inflector::pluralize($assocKey));
|
|
|
|
$otherSingularHumanName = Inflector::humanize($assocKey);
|
2007-06-03 23:56:56 +00:00
|
|
|
$otherFields = $otherModelObj->_tableInfo->value;
|
|
|
|
$otherPrimaryKey = $otherModelObj->primaryKey;
|
|
|
|
?>
|
|
|
|
<div class="related">
|
2007-10-06 06:46:45 +00:00
|
|
|
<h3><?php echo "<?php echo sprintf(__('Related %s', true), __('{$otherPluralHumanName}', true));?>";?></h3>
|
2007-06-20 06:15:35 +00:00
|
|
|
<?php echo "<?php if (!empty(\${$singularVar}['{$assocName}'])):?>\n";?>
|
2007-06-03 23:56:56 +00:00
|
|
|
<table cellpadding = "0" cellspacing = "0">
|
|
|
|
<tr>
|
|
|
|
<?php
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($otherFields as $field) {
|
2007-10-08 20:13:20 +00:00
|
|
|
echo "\t\t<th><?php __('".Inflector::humanize($field['name'])."') ?></th>\n";
|
2007-06-03 23:56:56 +00:00
|
|
|
}
|
|
|
|
?>
|
2007-06-16 02:19:31 +00:00
|
|
|
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
|
2007-06-03 23:56:56 +00:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
echo "\t<?php
|
|
|
|
\$i = 0;
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach (\${$singularVar}['{$assocName}'] as \${$otherSingularVar}):
|
2007-06-16 02:19:31 +00:00
|
|
|
\$class = null;
|
2007-06-20 06:15:35 +00:00
|
|
|
if (\$i++ % 2 == 0) {
|
2007-06-03 23:56:56 +00:00
|
|
|
\$class = ' class=\"altrow\"';
|
|
|
|
}
|
|
|
|
?>\n";
|
|
|
|
echo "\t\t<tr<?php echo \$class;?>>\n";
|
|
|
|
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($otherFields as $field) {
|
2007-06-03 23:56:56 +00:00
|
|
|
echo "\t\t\t<td><?php echo \${$otherSingularVar}['{$field['name']}'];?></td>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "\t\t\t<td class=\"actions\">\n";
|
2007-06-16 02:19:31 +00:00
|
|
|
echo "\t\t\t\t<?php echo \$html->link(__('View', true), array('controller'=> '{$otherControllerPath}', 'action'=>'view', \${$otherSingularVar}['{$otherPrimaryKey}'])); ?>\n";
|
|
|
|
echo "\t\t\t\t<?php echo \$html->link(__('Edit', true), array('controller'=> '{$otherControllerPath}', 'action'=>'edit', \${$otherSingularVar}['{$otherPrimaryKey}'])); ?>\n";
|
2007-10-06 06:46:45 +00:00
|
|
|
echo "\t\t\t\t<?php echo \$html->link(__('Delete', true), array('controller'=> '{$otherControllerPath}', 'action'=>'delete', \${$otherSingularVar}['{$otherPrimaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$otherPrimaryKey}'])); ?>\n";
|
2007-06-03 23:56:56 +00:00
|
|
|
echo "\t\t\t</td>\n";
|
|
|
|
echo "\t\t</tr>\n";
|
|
|
|
|
|
|
|
echo "\t<?php endforeach; ?>\n";
|
|
|
|
?>
|
|
|
|
</table>
|
|
|
|
<?php echo "<?php endif; ?>\n\n";?>
|
|
|
|
<div class="actions">
|
|
|
|
<ul>
|
2007-10-06 06:46:45 +00:00
|
|
|
<li><?php echo "<?php echo \$html->link(sprintf(__('New %s', true), __('{$otherSingularHumanName}', true)), array('controller'=> '{$otherControllerPath}', 'action'=>'add'));?> </li>\n";?>
|
2007-06-03 23:56:56 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
2007-10-06 06:46:45 +00:00
|
|
|
<?php endforeach;?>
|