cakephp2-php8/cake/libs/controller/templates/scaffolds/list.thtml
phpnut bc6de8791d [1258]
Author: phpnut
Date: 8:13:45 PM, Friday, October 28, 2005
Message:
adding version text file

[1257]
Author: phpnut
Date: 8:03:24 PM, Friday, October 28, 2005
Message:
small typo in last commit

[1256]
Author: phpnut
Date: 7:16:50 PM, Friday, October 28, 2005
Message:
Added fix for a self join of 1 to 1 associations.
This is automatic and adds Child_ to the joined class for hasOne or belongsTo.
Scaffold is updated to work with this change.
You will have to consider the Child_ prefix when working with self joins.

[1253]
Author: phpnut
Date: 4:07:55 PM, Friday, October 28, 2005
Message:
Fixed problem with session cookies being set for each path in the URL.
Added char to switch in Controller::generateFieldNames() 

[1252]
Author: phpnut
Date: 1:59:49 PM, Friday, October 28, 2005
Message:
Updated routes.php.default with change to route case.
Removed debug code I had added to Model::findAll

[1251]
Author: phpnut
Date: 1:51:00 PM, Friday, October 28, 2005
Message:
Added a fix for class already defined error.
Updated core.php docblock with level 3 setting for DEBUG.
Change  instances of AppController to Controller for loading error messages.
Updated 404 errors to use default layout

[1250]
Author: phpnut
Date: 1:34:08 PM, Friday, October 28, 2005
Message:
renaming error or error404

[1249]
Author: phpnut
Date: 1:32:51 PM, Friday, October 28, 2005
Message:
moving error.thtml to errors directory


git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00

99 lines
3.6 KiB
Text

<?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
*/
?>
<h1>List <?php echo Inflector::humanize($this->name)?></h1>
<?php
$model = Inflector::singularize($this->name);
$modelKey = $model;
$humanName = Inflector::humanize($this->name);
$humanSingularName = Inflector::singularize( $humanName );
// var_dump( $data );
?>
<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
if( isset($value['foreignKey']) )
{
// this is a foreign key, figure out what the display field should be for this model.
$otherModelKey = Inflector::underscore($value['modelKey']);
$otherControllerName = $value['controller'];
$registry = ClassRegistry::getInstance();
$otherModelObject = $registry->getObject( $otherModelKey );
if( is_object($otherModelObject) )
{
$displayText = $row[$value['model']][ $otherModelObject->getDisplayField() ];
} else{
$displayText = $row[$value['model']][$field];
}
echo $html->linkTo( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$modelKey][$field] );
} else {
echo $row[$modelKey][$field];
} ?>
</td>
<?php } // end for each $fieldNames as $field=>value ?>
<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']}/")?>
</td>
</tr>
<?php } // end for each data as row
} // end if( $data )?>
</table>
<ul class="actions">
<li><?php echo $html->linkTo('New '.$humanSingularName, '/'.$this->viewPath.'/add'); ?></li>
</ul>