1 | <?php |
---|
2 | /** |
---|
3 | * |
---|
4 | * PHP versions 4 and 5 |
---|
5 | * |
---|
6 | * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
---|
7 | * Copyright 2005-2011, 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-2011, 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 0.10.0.1076 |
---|
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 $pluralHumanName;?></h2> |
---|
22 | <table cellpadding="0" cellspacing="0"> |
---|
23 | <tr> |
---|
24 | <?php foreach ($scaffoldFields as $_field):?> |
---|
25 | <th><?php echo $this->Paginator->sort($_field);?></th> |
---|
26 | <?php endforeach;?> |
---|
27 | <th><?php __('Actions');?></th> |
---|
28 | </tr> |
---|
29 | <?php |
---|
30 | $i = 0; |
---|
31 | foreach (${$pluralVar} as ${$singularVar}): |
---|
32 | $class = null; |
---|
33 | if ($i++ % 2 == 0) { |
---|
34 | $class = ' class="altrow"'; |
---|
35 | } |
---|
36 | echo "\n"; |
---|
37 | echo "\t<tr{$class}>\n"; |
---|
38 | foreach ($scaffoldFields as $_field) { |
---|
39 | $isKey = false; |
---|
40 | if (!empty($associations['belongsTo'])) { |
---|
41 | foreach ($associations['belongsTo'] as $_alias => $_details) { |
---|
42 | if ($_field === $_details['foreignKey']) { |
---|
43 | $isKey = true; |
---|
44 | echo "\t\t<td>\n\t\t\t" . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t</td>\n"; |
---|
45 | break; |
---|
46 | } |
---|
47 | } |
---|
48 | } |
---|
49 | if ($isKey !== true) { |
---|
50 | echo "\t\t<td>\n\t\t\t" . ${$singularVar}[$modelClass][$_field] . " \n\t\t</td>\n"; |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | echo "\t\t<td class=\"actions\">\n"; |
---|
55 | echo "\t\t\t" . $this->Html->link(__('View', true), array('action' => 'view', ${$singularVar}[$modelClass][$primaryKey])) . "\n"; |
---|
56 | echo "\t\t\t" . $this->Html->link(__('Edit', true), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])) . "\n"; |
---|
57 | echo "\t\t\t" . $this->Html->link(__('Delete', true), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __('Are you sure you want to delete', true).' #' . ${$singularVar}[$modelClass][$primaryKey]) . "\n"; |
---|
58 | echo "\t\t</td>\n"; |
---|
59 | echo "\t</tr>\n"; |
---|
60 | |
---|
61 | endforeach; |
---|
62 | echo "\n"; |
---|
63 | ?> |
---|
64 | </table> |
---|
65 | <p><?php |
---|
66 | echo $this->Paginator->counter(array( |
---|
67 | 'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) |
---|
68 | )); |
---|
69 | ?></p> |
---|
70 | <div class="paging"> |
---|
71 | <?php echo "\t" . $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class' => 'disabled')) . "\n";?> |
---|
72 | | <?php echo $this->Paginator->numbers() . "\n"?> |
---|
73 | <?php echo "\t ". $this->Paginator->next(__('next', true) .' >>', array(), null, array('class' => 'disabled')) . "\n";?> |
---|
74 | </div> |
---|
75 | </div> |
---|
76 | <div class="actions"> |
---|
77 | <h3><?php __('Actions'); ?></h3> |
---|
78 | <ul> |
---|
79 | <li><?php echo $this->Html->link(sprintf(__('New %s', true), $singularHumanName), array('action' => 'add')); ?></li> |
---|
80 | <?php |
---|
81 | $done = array(); |
---|
82 | foreach ($associations as $_type => $_data) { |
---|
83 | foreach ($_data as $_alias => $_details) { |
---|
84 | if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) { |
---|
85 | echo "\t\t<li>" . $this->Html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>\n"; |
---|
86 | echo "\t\t<li>" . $this->Html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>\n"; |
---|
87 | $done[] = $_details['controller']; |
---|
88 | } |
---|
89 | } |
---|
90 | } |
---|
91 | ?> |
---|
92 | </ul> |
---|
93 | </div> |
---|