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