2005-10-09 01:56:21 +00:00
|
|
|
<?php
|
|
|
|
/* SVN FILE: $Id$ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base controller class.
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
|
|
|
* Copyright (c) 2005, CakePHP Authors/Developers
|
|
|
|
*
|
|
|
|
* Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
|
|
|
|
* Larry E. Masters aka PhpNut <nut@phpnut.com>
|
|
|
|
* Kamil Dzielinski aka Brego <brego.dk@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
|
|
|
* @filesource
|
|
|
|
* @author CakePHP Authors/Developers
|
|
|
|
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
|
|
|
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs.controller.templates.scaffolds
|
|
|
|
* @since CakePHP v 0.10.0.1076
|
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
|
*/
|
|
|
|
?>
|
2005-10-24 07:51:09 +00:00
|
|
|
<h1>List <?php echo Inflector::humanize($this->name)?></h1>
|
2005-10-09 01:56:21 +00:00
|
|
|
|
2005-07-21 04:02:32 +00:00
|
|
|
<?php
|
2005-10-24 07:51:09 +00:00
|
|
|
$model = Inflector::singularize($this->name);
|
[1198]
Author: phpnut
Date: 7:29:04 PM, Monday, October 24, 2005
Message:
More work on changes to use CamelCase throughout the system.
[1197]
Author: phpnut
Date: 2:57:08 PM, Monday, October 24, 2005
Message:
Removing unneeded calls to Inflector class
[1196]
Author: phpnut
Date: 2:39:30 PM, Monday, October 24, 2005
Message:
adding fix for Ticket #61
[1195]
Author: phpnut
Date: 11:19:43 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #47
[1194]
Author: phpnut
Date: 10:10:41 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #49
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1199 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-25 00:33:08 +00:00
|
|
|
$modelKey = $model;
|
2005-08-21 06:49:02 +00:00
|
|
|
$humanName = Inflector::humanize($this->name);
|
|
|
|
$humanSingularName = Inflector::singularize( $humanName );
|
|
|
|
// var_dump( $data );
|
2005-07-21 04:02:32 +00:00
|
|
|
?>
|
2005-08-21 06:49:02 +00:00
|
|
|
<table class="inav" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<?php foreach ( $fieldNames as $fieldName ) { ?>
|
|
|
|
<th><?php echo $fieldName['prompt'];?></th>
|
|
|
|
<?php } ?>
|
|
|
|
<th>Actions</th>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
$iRowIndex = 0;
|
|
|
|
|
|
|
|
if( is_array( $data ) )
|
|
|
|
{
|
|
|
|
foreach ( $data as $row ) {
|
|
|
|
if( $iRowIndex++ % 2 == 0 )
|
|
|
|
{
|
|
|
|
echo "<tr>";
|
|
|
|
} else {
|
|
|
|
echo "<tr class='altRow'>";
|
|
|
|
}
|
|
|
|
foreach( $fieldNames as $field=>$value ) { ?>
|
|
|
|
<td>
|
|
|
|
<?php
|
2005-08-25 16:40:50 +00:00
|
|
|
if( isset($value['foreignKey']) )
|
|
|
|
{
|
2005-08-21 06:49:02 +00:00
|
|
|
|
|
|
|
// this is a foreign key, figure out what the display field should be for this model.
|
2005-10-24 07:51:09 +00:00
|
|
|
$otherModelKey = Inflector::underscore($value['model']);
|
2005-08-21 06:49:02 +00:00
|
|
|
$otherControllerName = $value['controller'];
|
2005-10-24 07:51:09 +00:00
|
|
|
$registry = ClassRegistry::getInstance();
|
|
|
|
$otherModelObject = $registry->getObject( $otherModelKey );
|
2005-08-21 06:49:02 +00:00
|
|
|
if( is_object($otherModelObject) )
|
|
|
|
{
|
[1198]
Author: phpnut
Date: 7:29:04 PM, Monday, October 24, 2005
Message:
More work on changes to use CamelCase throughout the system.
[1197]
Author: phpnut
Date: 2:57:08 PM, Monday, October 24, 2005
Message:
Removing unneeded calls to Inflector class
[1196]
Author: phpnut
Date: 2:39:30 PM, Monday, October 24, 2005
Message:
adding fix for Ticket #61
[1195]
Author: phpnut
Date: 11:19:43 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #47
[1194]
Author: phpnut
Date: 10:10:41 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #49
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1199 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-25 00:33:08 +00:00
|
|
|
$displayText = $row[$value['model']][ $otherModelObject->getDisplayField() ];
|
2005-08-21 06:49:02 +00:00
|
|
|
} else{
|
[1198]
Author: phpnut
Date: 7:29:04 PM, Monday, October 24, 2005
Message:
More work on changes to use CamelCase throughout the system.
[1197]
Author: phpnut
Date: 2:57:08 PM, Monday, October 24, 2005
Message:
Removing unneeded calls to Inflector class
[1196]
Author: phpnut
Date: 2:39:30 PM, Monday, October 24, 2005
Message:
adding fix for Ticket #61
[1195]
Author: phpnut
Date: 11:19:43 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #47
[1194]
Author: phpnut
Date: 10:10:41 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #49
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1199 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-25 00:33:08 +00:00
|
|
|
$displayText = $row[$value['model']][$field];
|
2005-08-21 06:49:02 +00:00
|
|
|
}
|
2005-09-17 02:22:07 +00:00
|
|
|
echo $html->linkTo( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$modelKey][$field] );
|
2005-08-21 06:49:02 +00:00
|
|
|
|
|
|
|
} else {
|
2005-09-17 02:22:07 +00:00
|
|
|
echo $row[$modelKey][$field];
|
2005-08-21 06:49:02 +00:00
|
|
|
} ?>
|
|
|
|
</td>
|
|
|
|
<?php } // end for each $fieldNames as $field=>value ?>
|
2005-09-17 02:22:07 +00:00
|
|
|
<td class="listactions"><?php echo $html->linkTo('View',"/".$this->viewPath."/show/{$row[$modelKey]['id']}/")?>
|
|
|
|
<?php echo $html->linkTo('Edit',"/".$this->viewPath."/edit/{$row[$modelKey]['id']}/")?>
|
|
|
|
<?php echo $html->linkTo('Delete',"/".$this->viewPath."/destroy/{$row[$modelKey]['id']}/")?>
|
2005-08-21 06:49:02 +00:00
|
|
|
</td>
|
2005-07-21 04:02:32 +00:00
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
</tr>
|
|
|
|
<?php } // end for each data as row
|
|
|
|
} // end if( $data )?>
|
|
|
|
|
|
|
|
|
|
|
|
</table>
|
|
|
|
<ul class="actions">
|
2005-10-28 08:25:31 +00:00
|
|
|
<li><?php echo $html->linkTo('New '.$humanSingularName, '/'.$this->viewPath.'/add'); ?></li>
|
2005-08-21 06:49:02 +00:00
|
|
|
</ul>
|
2005-07-21 04:02:32 +00:00
|
|
|
|
|
|
|
|