mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-16 11:58:25 +00:00
8a77108c44
Revision: [1809] Fixed self join code, may refactor after looking at it more. Currently it is working as expected. Fixed errors in scaffold view caused by the changes I made. Removed adding Child_ prefix to self joined associations. Revision: [1808] Adding changes I started on the self join code. Revision: [1807] Adding patch from Ticket #283. Changed doc comment in SessionComponent class. Added fix for Ticket #285 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1810 3807eeeb-6ff5-0310-8944-8be069107fe0
95 lines
3.5 KiB
Text
95 lines
3.5 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, 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 (c) 2005, Cake Software Foundation, Inc.
|
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
|
* @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'];
|
|
$otherModelObject = ClassRegistry::getObject( $otherModelKey );
|
|
$alias = array_search($value['table'],$this->controller->{$model}->alias);
|
|
if( is_object($otherModelObject) )
|
|
{
|
|
$displayText = $row[$alias][ $otherModelObject->getDisplayField() ];
|
|
} else{
|
|
$displayText = $row[$alias][$field];
|
|
}
|
|
echo $html->link( $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->link('View',"/".$this->viewPath."/show/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
|
<?php echo $html->link('Edit',"/".$this->viewPath."/edit/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
|
<?php echo $html->link('Delete',"/".$this->viewPath."/destroy/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
|
</td>
|
|
|
|
</tr>
|
|
<?php } // end for each data as row
|
|
} // end if( $data )?>
|
|
|
|
|
|
</table>
|
|
<ul class="actions">
|
|
<li><?php echo $html->link('New '.$humanSingularName, '/'.$this->viewPath.'/add'); ?></li>
|
|
</ul>
|
|
|
|
|