mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-16 11:58:25 +00:00
fbf4d9ee27
preparing for release .0.9.2 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@606 3807eeeb-6ff5-0310-8944-8be069107fe0
66 lines
2.5 KiB
Text
66 lines
2.5 KiB
Text
<?php
|
|
$model = Inflector::pluralize($this->name);
|
|
$table = Inflector::singularize($this->name);
|
|
$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( Model::isForeignKey( $field ) ) {
|
|
|
|
// this is a foreign key, figure out what the display field should be for this model.
|
|
$otherModelName = $value['model'];
|
|
$otherControllerName = $value['controller'];
|
|
|
|
$registry = ClassRegistry::getInstance();
|
|
$otherModelObject = $registry->getObject( $otherModelName );
|
|
if( is_object($otherModelObject) )
|
|
{
|
|
$displayText = $row[$otherModelName][ $otherModelObject->getDisplayField() ];
|
|
} else{
|
|
$displayText = $row[$table][$field];
|
|
}
|
|
echo $html->linkTo( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$table][$field] );
|
|
|
|
} else {
|
|
echo $row[$table ][$field];
|
|
} ?>
|
|
</td>
|
|
<?php } // end for each $fieldNames as $field=>value ?>
|
|
<td class="listactions"><?php echo $html->linkTo('View',"/".$this->viewPath."/show/{$row[$table]['id']}/")?>
|
|
<?php echo $html->linkTo('Edit',"/".$this->viewPath."/edit/{$row[$table]['id']}/")?>
|
|
<?php echo $html->linkTo('Delete',"/".$this->viewPath."/destroy/{$row[$table]['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.'/new'); ?></li>
|
|
</ul>
|
|
|
|
|