| 13532 |
anikendra |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
*
|
|
|
4 |
*
|
|
|
5 |
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
|
|
6 |
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
7 |
*
|
|
|
8 |
* Licensed under The MIT License
|
|
|
9 |
* For full copyright and license information, please see the LICENSE.txt
|
|
|
10 |
* Redistributions of files must retain the above copyright notice.
|
|
|
11 |
*
|
|
|
12 |
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
13 |
* @link http://cakephp.org CakePHP(tm) Project
|
|
|
14 |
* @package Cake.Console.Templates.default.views
|
|
|
15 |
* @since CakePHP(tm) v 1.2.0.5234
|
|
|
16 |
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
|
|
17 |
*/
|
|
|
18 |
?>
|
|
|
19 |
<div class="<?php echo $pluralVar; ?> view">
|
|
|
20 |
<h2><?php echo "<?php echo __('{$singularHumanName}'); ?>"; ?></h2>
|
|
|
21 |
<dl>
|
|
|
22 |
<?php
|
|
|
23 |
foreach ($fields as $field) {
|
|
|
24 |
$isKey = false;
|
|
|
25 |
if (!empty($associations['belongsTo'])) {
|
|
|
26 |
foreach ($associations['belongsTo'] as $alias => $details) {
|
|
|
27 |
if ($field === $details['foreignKey']) {
|
|
|
28 |
$isKey = true;
|
|
|
29 |
echo "\t\t<dt><?php echo __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n";
|
|
|
30 |
echo "\t\t<dd>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t \n\t\t</dd>\n";
|
|
|
31 |
break;
|
|
|
32 |
}
|
|
|
33 |
}
|
|
|
34 |
}
|
|
|
35 |
if ($isKey !== true) {
|
|
|
36 |
echo "\t\t<dt><?php echo __('" . Inflector::humanize($field) . "'); ?></dt>\n";
|
|
|
37 |
echo "\t\t<dd>\n\t\t\t<?php echo h(\${$singularVar}['{$modelClass}']['{$field}']); ?>\n\t\t\t \n\t\t</dd>\n";
|
|
|
38 |
}
|
|
|
39 |
}
|
|
|
40 |
?>
|
|
|
41 |
</dl>
|
|
|
42 |
</div>
|
|
|
43 |
<div class="actions">
|
|
|
44 |
<h3><?php echo "<?php echo __('Actions'); ?>"; ?></h3>
|
|
|
45 |
<ul>
|
|
|
46 |
<?php
|
|
|
47 |
echo "\t\t<li><?php echo \$this->Html->link(__('Edit " . $singularHumanName ."'), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
|
|
48 |
echo "\t\t<li><?php echo \$this->Form->postLink(__('Delete " . $singularHumanName . "'), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, __('Are you sure you want to delete # %s?', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
|
|
49 |
echo "\t\t<li><?php echo \$this->Html->link(__('List " . $pluralHumanName . "'), array('action' => 'index')); ?> </li>\n";
|
|
|
50 |
echo "\t\t<li><?php echo \$this->Html->link(__('New " . $singularHumanName . "'), array('action' => 'add')); ?> </li>\n";
|
|
|
51 |
|
|
|
52 |
$done = array();
|
|
|
53 |
foreach ($associations as $type => $data) {
|
|
|
54 |
foreach ($data as $alias => $details) {
|
|
|
55 |
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
|
|
56 |
echo "\t\t<li><?php echo \$this->Html->link(__('List " . Inflector::humanize($details['controller']) . "'), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
|
|
57 |
echo "\t\t<li><?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "'), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
|
|
58 |
$done[] = $details['controller'];
|
|
|
59 |
}
|
|
|
60 |
}
|
|
|
61 |
}
|
|
|
62 |
?>
|
|
|
63 |
</ul>
|
|
|
64 |
</div>
|
|
|
65 |
<?php
|
|
|
66 |
if (!empty($associations['hasOne'])) :
|
|
|
67 |
foreach ($associations['hasOne'] as $alias => $details): ?>
|
|
|
68 |
<div class="related">
|
|
|
69 |
<h3><?php echo "<?php echo __('Related " . Inflector::humanize($details['controller']) . "'); ?>"; ?></h3>
|
|
|
70 |
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])): ?>\n"; ?>
|
|
|
71 |
<dl>
|
|
|
72 |
<?php
|
|
|
73 |
foreach ($details['fields'] as $field) {
|
|
|
74 |
echo "\t\t<dt><?php echo __('" . Inflector::humanize($field) . "'); ?></dt>\n";
|
|
|
75 |
echo "\t\t<dd>\n\t<?php echo \${$singularVar}['{$alias}']['{$field}']; ?>\n </dd>\n";
|
|
|
76 |
}
|
|
|
77 |
?>
|
|
|
78 |
</dl>
|
|
|
79 |
<?php echo "<?php endif; ?>\n"; ?>
|
|
|
80 |
<div class="actions">
|
|
|
81 |
<ul>
|
|
|
82 |
<li><?php echo "<?php echo \$this->Html->link(__('Edit " . Inflector::humanize(Inflector::underscore($alias)) . "'), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n"; ?>
|
|
|
83 |
</ul>
|
|
|
84 |
</div>
|
|
|
85 |
</div>
|
|
|
86 |
<?php
|
|
|
87 |
endforeach;
|
|
|
88 |
endif;
|
|
|
89 |
if (empty($associations['hasMany'])) {
|
|
|
90 |
$associations['hasMany'] = array();
|
|
|
91 |
}
|
|
|
92 |
if (empty($associations['hasAndBelongsToMany'])) {
|
|
|
93 |
$associations['hasAndBelongsToMany'] = array();
|
|
|
94 |
}
|
|
|
95 |
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
|
|
|
96 |
foreach ($relations as $alias => $details):
|
|
|
97 |
$otherSingularVar = Inflector::variable($alias);
|
|
|
98 |
$otherPluralHumanName = Inflector::humanize($details['controller']);
|
|
|
99 |
?>
|
|
|
100 |
<div class="related">
|
|
|
101 |
<h3><?php echo "<?php echo __('Related " . $otherPluralHumanName . "'); ?>"; ?></h3>
|
|
|
102 |
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])): ?>\n"; ?>
|
|
|
103 |
<table cellpadding = "0" cellspacing = "0">
|
|
|
104 |
<tr>
|
|
|
105 |
<?php
|
|
|
106 |
foreach ($details['fields'] as $field) {
|
|
|
107 |
echo "\t\t<th><?php echo __('" . Inflector::humanize($field) . "'); ?></th>\n";
|
|
|
108 |
}
|
|
|
109 |
?>
|
|
|
110 |
<th class="actions"><?php echo "<?php echo __('Actions'); ?>"; ?></th>
|
|
|
111 |
</tr>
|
|
|
112 |
<?php
|
|
|
113 |
echo "\t<?php foreach (\${$singularVar}['{$alias}'] as \${$otherSingularVar}): ?>\n";
|
|
|
114 |
echo "\t\t<tr>\n";
|
|
|
115 |
foreach ($details['fields'] as $field) {
|
|
|
116 |
echo "\t\t\t<td><?php echo \${$otherSingularVar}['{$field}']; ?></td>\n";
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
echo "\t\t\t<td class=\"actions\">\n";
|
|
|
120 |
echo "\t\t\t\t<?php echo \$this->Html->link(__('View'), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
|
|
121 |
echo "\t\t\t\t<?php echo \$this->Html->link(__('Edit'), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
|
|
122 |
echo "\t\t\t\t<?php echo \$this->Form->postLink(__('Delete'), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, __('Are you sure you want to delete # %s?', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
|
|
123 |
echo "\t\t\t</td>\n";
|
|
|
124 |
echo "\t\t</tr>\n";
|
|
|
125 |
|
|
|
126 |
echo "\t<?php endforeach; ?>\n";
|
|
|
127 |
?>
|
|
|
128 |
</table>
|
|
|
129 |
<?php echo "<?php endif; ?>\n\n"; ?>
|
|
|
130 |
<div class="actions">
|
|
|
131 |
<ul>
|
|
|
132 |
<li><?php echo "<?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "'), array('controller' => '{$details['controller']}', 'action' => 'add')); ?>"; ?> </li>
|
|
|
133 |
</ul>
|
|
|
134 |
</div>
|
|
|
135 |
</div>
|
|
|
136 |
<?php endforeach; ?>
|