pictcode / lib / Cake / View / Scaffolds / view.ctp @ 0b1b8047
履歴 | 表示 | アノテート | ダウンロード (6.426 KB)
1 |
<?php |
---|---|
2 |
/** |
3 |
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
4 |
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
5 |
* |
6 |
* Licensed under The MIT License |
7 |
* For full copyright and license information, please see the LICENSE.txt |
8 |
* Redistributions of files must retain the above copyright notice. |
9 |
* |
10 |
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
11 |
* @link http://cakephp.org CakePHP(tm) Project |
12 |
* @package Cake.View.Scaffolds |
13 |
* @since CakePHP(tm) v 0.10.0.1076 |
14 |
* @license http://www.opensource.org/licenses/mit-license.php MIT License |
15 |
*/ |
16 |
?> |
17 |
<div class="<?php echo $pluralVar; ?> view"> |
18 |
<h2><?php echo __d('cake', 'View %s', $singularHumanName); ?></h2> |
19 |
<dl> |
20 |
<?php |
21 |
foreach ($scaffoldFields as $_field) { |
22 |
$isKey = false; |
23 |
if (!empty($associations['belongsTo'])) { |
24 |
foreach ($associations['belongsTo'] as $_alias => $_details) { |
25 |
if ($_field === $_details['foreignKey']) { |
26 |
$isKey = true; |
27 |
echo "\t\t<dt>" . Inflector::humanize($_alias) . "</dt>\n"; |
28 |
echo "\t\t<dd>\n\t\t\t"; |
29 |
echo $this->Html->link( |
30 |
${$singularVar}[$_alias][$_details['displayField']], |
31 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']]) |
32 |
); |
33 |
echo "\n\t\t </dd>\n"; |
34 |
break; |
35 |
} |
36 |
} |
37 |
} |
38 |
if ($isKey !== true) { |
39 |
echo "\t\t<dt>" . Inflector::humanize($_field) . "</dt>\n"; |
40 |
echo "\t\t<dd>" . h(${$singularVar}[$modelClass][$_field]) . " </dd>\n"; |
41 |
} |
42 |
} |
43 |
?> |
44 |
</dl> |
45 |
</div> |
46 |
<div class="actions"> |
47 |
<h3><?php echo __d('cake', 'Actions'); ?></h3> |
48 |
<ul> |
49 |
<?php |
50 |
echo "\t\t<li>"; |
51 |
echo $this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])); |
52 |
echo " </li>\n"; |
53 |
|
54 |
echo "\t\t<li>"; |
55 |
echo $this->Form->postLink(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), array(), __d('cake', 'Are you sure you want to delete # %s?', ${$singularVar}[$modelClass][$primaryKey])); |
56 |
echo " </li>\n"; |
57 |
|
58 |
echo "\t\t<li>"; |
59 |
echo $this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')); |
60 |
echo " </li>\n"; |
61 |
|
62 |
echo "\t\t<li>"; |
63 |
echo $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')); |
64 |
echo " </li>\n"; |
65 |
|
66 |
$done = array(); |
67 |
foreach ($associations as $_type => $_data) { |
68 |
foreach ($_data as $_alias => $_details) { |
69 |
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) { |
70 |
echo "\t\t<li>"; |
71 |
echo $this->Html->link( |
72 |
__d('cake', 'List %s', Inflector::humanize($_details['controller'])), |
73 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index') |
74 |
); |
75 |
echo "</li>\n"; |
76 |
echo "\t\t<li>"; |
77 |
echo $this->Html->link( |
78 |
__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))), |
79 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add') |
80 |
); |
81 |
echo "</li>\n"; |
82 |
$done[] = $_details['controller']; |
83 |
} |
84 |
} |
85 |
} |
86 |
?> |
87 |
</ul> |
88 |
</div> |
89 |
<?php |
90 |
if (!empty($associations['hasOne'])) : |
91 |
foreach ($associations['hasOne'] as $_alias => $_details): ?> |
92 |
<div class="related"> |
93 |
<h3><?php echo __d('cake', "Related %s", Inflector::humanize($_details['controller'])); ?></h3> |
94 |
<?php if (!empty(${$singularVar}[$_alias])): ?> |
95 |
<dl> |
96 |
<?php |
97 |
$otherFields = array_keys(${$singularVar}[$_alias]); |
98 |
foreach ($otherFields as $_field): |
99 |
echo "\t\t<dt>" . Inflector::humanize($_field) . "</dt>\n"; |
100 |
echo "\t\t<dd>\n\t" . ${$singularVar}[$_alias][$_field] . "\n </dd>\n"; |
101 |
endforeach; |
102 |
?> |
103 |
</dl> |
104 |
<?php endif; ?> |
105 |
<div class="actions"> |
106 |
<ul> |
107 |
<li><?php |
108 |
echo $this->Html->link( |
109 |
__d('cake', 'Edit %s', Inflector::humanize(Inflector::underscore($_alias))), |
110 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'edit', ${$singularVar}[$_alias][$_details['primaryKey']]) |
111 |
); |
112 |
echo "</li>\n"; |
113 |
?> |
114 |
</ul> |
115 |
</div> |
116 |
</div> |
117 |
<?php |
118 |
endforeach; |
119 |
endif; |
120 |
|
121 |
if (empty($associations['hasMany'])) { |
122 |
$associations['hasMany'] = array(); |
123 |
} |
124 |
if (empty($associations['hasAndBelongsToMany'])) { |
125 |
$associations['hasAndBelongsToMany'] = array(); |
126 |
} |
127 |
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']); |
128 |
$i = 0; |
129 |
foreach ($relations as $_alias => $_details): |
130 |
$otherSingularVar = Inflector::variable($_alias); |
131 |
?> |
132 |
<div class="related"> |
133 |
<h3><?php echo __d('cake', "Related %s", Inflector::humanize($_details['controller'])); ?></h3> |
134 |
<?php if (!empty(${$singularVar}[$_alias])): ?> |
135 |
<table cellpadding="0" cellspacing="0"> |
136 |
<tr> |
137 |
<?php |
138 |
$otherFields = array_keys(${$singularVar}[$_alias][0]); |
139 |
if (isset($_details['with'])) { |
140 |
$index = array_search($_details['with'], $otherFields); |
141 |
unset($otherFields[$index]); |
142 |
} |
143 |
foreach ($otherFields as $_field) { |
144 |
echo "\t\t<th>" . Inflector::humanize($_field) . "</th>\n"; |
145 |
} |
146 |
?> |
147 |
<th class="actions">Actions</th> |
148 |
</tr> |
149 |
<?php |
150 |
$i = 0; |
151 |
foreach (${$singularVar}[$_alias] as ${$otherSingularVar}): |
152 |
echo "\t\t<tr>\n"; |
153 |
|
154 |
foreach ($otherFields as $_field) { |
155 |
echo "\t\t\t<td>" . ${$otherSingularVar}[$_field] . "</td>\n"; |
156 |
} |
157 |
|
158 |
echo "\t\t\t<td class=\"actions\">\n"; |
159 |
echo "\t\t\t\t"; |
160 |
echo $this->Html->link( |
161 |
__d('cake', 'View'), |
162 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'view', ${$otherSingularVar}[$_details['primaryKey']]) |
163 |
); |
164 |
echo "\n"; |
165 |
echo "\t\t\t\t"; |
166 |
echo $this->Html->link( |
167 |
__d('cake', 'Edit'), |
168 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'edit', ${$otherSingularVar}[$_details['primaryKey']]) |
169 |
); |
170 |
echo "\n"; |
171 |
echo "\t\t\t\t"; |
172 |
echo $this->Form->postLink( |
173 |
__d('cake', 'Delete'), |
174 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'delete', ${$otherSingularVar}[$_details['primaryKey']]), |
175 |
array(), |
176 |
__d('cake', 'Are you sure you want to delete # %s?', ${$otherSingularVar}[$_details['primaryKey']]) |
177 |
); |
178 |
echo "\n"; |
179 |
echo "\t\t\t</td>\n"; |
180 |
echo "\t\t</tr>\n"; |
181 |
endforeach; |
182 |
?> |
183 |
</table> |
184 |
<?php endif; ?> |
185 |
<div class="actions"> |
186 |
<ul> |
187 |
<li><?php echo $this->Html->link( |
188 |
__d('cake', "New %s", Inflector::humanize(Inflector::underscore($_alias))), |
189 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add') |
190 |
); ?> </li> |
191 |
</ul> |
192 |
</div> |
193 |
</div> |
194 |
<?php endforeach; ?> |