pictcode / lib / Cake / View / Scaffolds / index.ctp @ master
履歴 | 表示 | アノテート | ダウンロード (3.686 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; ?> index"> |
18 |
<h2><?php echo $pluralHumanName; ?></h2> |
19 |
<table cellpadding="0" cellspacing="0"> |
20 |
<tr> |
21 |
<?php foreach ($scaffoldFields as $_field): ?> |
22 |
<th><?php echo $this->Paginator->sort($_field); ?></th> |
23 |
<?php endforeach; ?> |
24 |
<th><?php echo __d('cake', 'Actions'); ?></th> |
25 |
</tr> |
26 |
<?php |
27 |
foreach (${$pluralVar} as ${$singularVar}): |
28 |
echo '<tr>'; |
29 |
foreach ($scaffoldFields as $_field): |
30 |
$isKey = false; |
31 |
if (!empty($associations['belongsTo'])): |
32 |
foreach ($associations['belongsTo'] as $_alias => $_details): |
33 |
if ($_field === $_details['foreignKey']): |
34 |
$isKey = true; |
35 |
echo '<td>' . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . '</td>'; |
36 |
break; |
37 |
endif; |
38 |
endforeach; |
39 |
endif; |
40 |
if ($isKey !== true): |
41 |
echo '<td>' . h(${$singularVar}[$modelClass][$_field]) . '</td>'; |
42 |
endif; |
43 |
endforeach; |
44 |
|
45 |
echo '<td class="actions">'; |
46 |
echo $this->Html->link(__d('cake', 'View'), array('action' => 'view', ${$singularVar}[$modelClass][$primaryKey])); |
47 |
echo ' ' . $this->Html->link(__d('cake', 'Edit'), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])); |
48 |
echo ' ' . $this->Form->postLink( |
49 |
__d('cake', 'Delete'), |
50 |
array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), |
51 |
array(), |
52 |
__d('cake', 'Are you sure you want to delete # %s?', ${$singularVar}[$modelClass][$primaryKey]) |
53 |
); |
54 |
echo '</td>'; |
55 |
echo '</tr>'; |
56 |
|
57 |
endforeach; |
58 |
|
59 |
?> |
60 |
</table> |
61 |
<p><?php |
62 |
echo $this->Paginator->counter(array( |
63 |
'format' => __d('cake', 'Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}') |
64 |
)); |
65 |
?></p> |
66 |
<div class="paging"> |
67 |
<?php |
68 |
echo $this->Paginator->prev('< ' . __d('cake', 'previous'), array(), null, array('class' => 'prev disabled')); |
69 |
echo $this->Paginator->numbers(array('separator' => '')); |
70 |
echo $this->Paginator->next(__d('cake', 'next') . ' >', array(), null, array('class' => 'next disabled')); |
71 |
?> |
72 |
</div> |
73 |
</div> |
74 |
<div class="actions"> |
75 |
<h3><?php echo __d('cake', 'Actions'); ?></h3> |
76 |
<ul> |
77 |
<li><?php echo $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')); ?></li> |
78 |
<?php |
79 |
$done = array(); |
80 |
foreach ($associations as $_type => $_data) { |
81 |
foreach ($_data as $_alias => $_details) { |
82 |
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) { |
83 |
echo '<li>'; |
84 |
echo $this->Html->link( |
85 |
__d('cake', 'List %s', Inflector::humanize($_details['controller'])), |
86 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index') |
87 |
); |
88 |
echo '</li>'; |
89 |
|
90 |
echo '<li>'; |
91 |
echo $this->Html->link( |
92 |
__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))), |
93 |
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add') |
94 |
); |
95 |
echo '</li>'; |
96 |
$done[] = $_details['controller']; |
97 |
} |
98 |
} |
99 |
} |
100 |
?> |
101 |
</ul> |
102 |
</div> |