cakephp2-php8/libs/controllers/templates/scaffolds/show.thtml

94 lines
2.4 KiB
Text
Raw Normal View History

<?php
$model = Inflector::pluralize($this->name);
$table = Inflector::singularize($this->name);
$evenNum = 1;
$css = false;
?>
<h1>Showing <?php echo Inflector::camelize($this->name); ?></h1>
<table cellspacing="0" class="inav">
<tr>
<th>Field</th>
<th>Value</th>
<?php
if(!empty($this->$table->joinedHasOne)){
echo" <th>Joined Table</th>";
}
?>
</tr>
<?php
foreach ($this->$table->_table_info as $tables) {
$columnCount = 0;
foreach ($tables as $tabl) {
$tableName[] = $tabl['name'];
foreach ($this->_viewVars as $names) {
?>
<?php
if ($evenNum % 2 == 0 ){
$css = ' class="or"';
}else{
$css = false;
}
$evenNum++;
?>
<?php echo "<tr$css>";?>
<td><?php echo Inflector::humanize($tableName[$columnCount]);?></td>
<td><?php echo $names[$table][$tabl['name']]?></td>
<?php
}
$columnCount++;
}
}
?>
</tr>
<?php
if(!empty($this->$table->joinedHasOne)){?>
<tr>
<td></td>
<td></td>
<td>
<?php
$joinedCount = count($this->$table->joinedHasOne);
$count = $columnCount;
for ($i = 0; $i <= $joinedCount-1; $i++) {
foreach ($this->$table->joinedHasOne[$i]->_table_info as $tab) {
foreach($tab as $test){
if($test['name'] === 'id'){
echo $html->linkTo('<span style="color: red;">Edit: <b>'. Inflector::humanize(Inflector::singularize($this->$table->joinedHasOne[$i]->table)) .'</b></span>',"/{$this->$table->joinedHasOne[$i]->table}/edit/{$names[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']]}");
echo '<br /><b>' . Inflector::humanize($test['name']) .':</b> ' . $names[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']];
} else{
echo '<br /><b>' . Inflector::humanize($test['name']) .':</b> ' . $names[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']];
}
$count++;
}
echo '<br />';
}
}
?>
</td>
</tr>
</table>
<?php }?>
<table cellspacing="0" class="inav">
<tr>
<td>
<?php echo $html->linkTo('<span style="color: red;">Back</span>', "/{$this->viewPath}/list/")?>
<?php echo $html->linkTo('<span style="color: red;">Edit</span>',"/{$this->viewPath}/edit/{$names[Inflector::singularize($this->name)]['id']}")?>
<?php echo $html->linkTo('<span style="color: red;">Destroy</span>',"/{$this->viewPath}/destroy/{$names[Inflector::singularize($this->name)]['id']}")?>
</td>
</tr>
</table>