comparison cake/console/templates/default/views/index.ctp @ 0:261e66bd5a0c

hg init
author Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
date Sun, 24 Jul 2011 21:08:31 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:261e66bd5a0c
1 <?php
2 /**
3 *
4 * PHP versions 4 and 5
5 *
6 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
7 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
8 *
9 * Licensed under The MIT License
10 * Redistributions of files must retain the above copyright notice.
11 *
12 * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
13 * @link http://cakephp.org CakePHP(tm) Project
14 * @package cake
15 * @subpackage cake.cake.console.libs.templates.views
16 * @since CakePHP(tm) v 1.2.0.5234
17 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
18 */
19 ?>
20 <div class="<?php echo $pluralVar;?> index">
21 <h2><?php echo "<?php __('{$pluralHumanName}');?>";?></h2>
22 <table cellpadding="0" cellspacing="0">
23 <tr>
24 <?php foreach ($fields as $field):?>
25 <th><?php echo "<?php echo \$this->Paginator->sort('{$field}');?>";?></th>
26 <?php endforeach;?>
27 <th class="actions"><?php echo "<?php __('Actions');?>";?></th>
28 </tr>
29 <?php
30 echo "<?php
31 \$i = 0;
32 foreach (\${$pluralVar} as \${$singularVar}):
33 \$class = null;
34 if (\$i++ % 2 == 0) {
35 \$class = ' class=\"altrow\"';
36 }
37 ?>\n";
38 echo "\t<tr<?php echo \$class;?>>\n";
39 foreach ($fields as $field) {
40 $isKey = false;
41 if (!empty($associations['belongsTo'])) {
42 foreach ($associations['belongsTo'] as $alias => $details) {
43 if ($field === $details['foreignKey']) {
44 $isKey = true;
45 echo "\t\t<td>\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</td>\n";
46 break;
47 }
48 }
49 }
50 if ($isKey !== true) {
51 echo "\t\t<td><?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>&nbsp;</td>\n";
52 }
53 }
54
55 echo "\t\t<td class=\"actions\">\n";
56 echo "\t\t\t<?php echo \$this->Html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
57 echo "\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
58 echo "\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
59 echo "\t\t</td>\n";
60 echo "\t</tr>\n";
61
62 echo "<?php endforeach; ?>\n";
63 ?>
64 </table>
65 <p>
66 <?php echo "<?php
67 echo \$this->Paginator->counter(array(
68 'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
69 ));
70 ?>";?>
71 </p>
72
73 <div class="paging">
74 <?php echo "\t<?php echo \$this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
75 | <?php echo "\t<?php echo \$this->Paginator->numbers();?>\n"?> |
76 <?php echo "\t<?php echo \$this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>\n";?>
77 </div>
78 </div>
79 <div class="actions">
80 <h3><?php echo "<?php __('Actions'); ?>"; ?></h3>
81 <ul>
82 <li><?php echo "<?php echo \$this->Html->link(__('New " . $singularHumanName . "', true), array('action' => 'add')); ?>";?></li>
83 <?php
84 $done = array();
85 foreach ($associations as $type => $data) {
86 foreach ($data as $alias => $details) {
87 if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
88 echo "\t\t<li><?php echo \$this->Html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
89 echo "\t\t<li><?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
90 $done[] = $details['controller'];
91 }
92 }
93 }
94 ?>
95 </ul>
96 </div>