| 1 |
lars |
1 |
<?php
|
|
|
2 |
/* SVN FILE: $Id: index.ctp 7945 2008-12-19 02:16:01Z gwoo $ */
|
|
|
3 |
/**
|
|
|
4 |
*
|
|
|
5 |
* PHP versions 4 and 5
|
|
|
6 |
*
|
|
|
7 |
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
|
|
8 |
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
|
|
9 |
*
|
|
|
10 |
* Licensed under The MIT License
|
|
|
11 |
* Redistributions of files must retain the above copyright notice.
|
|
|
12 |
*
|
|
|
13 |
* @filesource
|
|
|
14 |
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
|
|
15 |
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
|
|
16 |
* @package cake
|
|
|
17 |
* @subpackage cake.cake.console.libs.templates.views
|
|
|
18 |
* @since CakePHP(tm) v 0.10.0.1076
|
|
|
19 |
* @version $Revision: 7945 $
|
|
|
20 |
* @modifiedby $LastChangedBy: gwoo $
|
|
|
21 |
* @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
|
|
|
22 |
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
23 |
*/
|
|
|
24 |
?>
|
|
|
25 |
<div class="<?php echo $pluralVar;?> index">
|
|
|
26 |
<h2><?php echo $pluralHumanName;?></h2>
|
|
|
27 |
<p><?php
|
|
|
28 |
echo $paginator->counter(array(
|
|
|
29 |
'format' => 'Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%'
|
|
|
30 |
));
|
|
|
31 |
?></p>
|
|
|
32 |
<table cellpadding="0" cellspacing="0">
|
|
|
33 |
<tr>
|
|
|
34 |
<?php foreach ($scaffoldFields as $_field):?>
|
|
|
35 |
<th><?php echo $paginator->sort($_field);?></th>
|
|
|
36 |
<?php endforeach;?>
|
|
|
37 |
<th><?php __('Actions');?></th>
|
|
|
38 |
</tr>
|
|
|
39 |
<?php
|
|
|
40 |
$i = 0;
|
|
|
41 |
foreach (${$pluralVar} as ${$singularVar}):
|
|
|
42 |
$class = null;
|
|
|
43 |
if ($i++ % 2 == 0) {
|
|
|
44 |
$class = ' class="altrow"';
|
|
|
45 |
}
|
|
|
46 |
echo "\n";
|
|
|
47 |
echo "\t<tr{$class}>\n";
|
|
|
48 |
foreach ($scaffoldFields as $_field) {
|
|
|
49 |
$isKey = false;
|
|
|
50 |
if (!empty($associations['belongsTo'])) {
|
|
|
51 |
foreach ($associations['belongsTo'] as $_alias => $_details) {
|
|
|
52 |
if ($_field === $_details['foreignKey']) {
|
|
|
53 |
$isKey = true;
|
|
|
54 |
echo "\t\t<td>\n\t\t\t" . $html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller'=> $_details['controller'], 'action'=>'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t</td>\n";
|
|
|
55 |
break;
|
|
|
56 |
}
|
|
|
57 |
}
|
|
|
58 |
}
|
|
|
59 |
if ($isKey !== true) {
|
|
|
60 |
echo "\t\t<td>\n\t\t\t" . ${$singularVar}[$modelClass][$_field] . " \n\t\t</td>\n";
|
|
|
61 |
}
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
echo "\t\t<td class=\"actions\">\n";
|
|
|
65 |
echo "\t\t\t" . $html->link(__('View', true), array('action'=>'view', ${$singularVar}[$modelClass][$primaryKey])) . "\n";
|
|
|
66 |
echo "\t\t\t" . $html->link(__('Edit', true), array('action'=>'edit', ${$singularVar}[$modelClass][$primaryKey])) . "\n";
|
|
|
67 |
echo "\t\t\t" . $html->link(__('Delete', true), array('action'=>'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __('Are you sure you want to delete', true).' #' . ${$singularVar}[$modelClass][$primaryKey]) . "\n";
|
|
|
68 |
echo "\t\t</td>\n";
|
|
|
69 |
echo "\t</tr>\n";
|
|
|
70 |
|
|
|
71 |
endforeach;
|
|
|
72 |
echo "\n";
|
|
|
73 |
?>
|
|
|
74 |
</table>
|
|
|
75 |
</div>
|
|
|
76 |
<div class="paging">
|
|
|
77 |
<?php echo "\t" . $paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled')) . "\n";?>
|
|
|
78 |
| <?php echo $paginator->numbers() . "\n"?>
|
|
|
79 |
<?php echo "\t ". $paginator->next(__('next', true) .' >>', array(), null, array('class'=>'disabled')) . "\n";?>
|
|
|
80 |
</div>
|
|
|
81 |
<div class="actions">
|
|
|
82 |
<ul>
|
|
|
83 |
<li><?php echo $html->link('New '.$singularHumanName, array('action'=>'add')); ?></li>
|
|
|
84 |
<?php
|
|
|
85 |
$done = array();
|
|
|
86 |
foreach ($associations as $_type => $_data) {
|
|
|
87 |
foreach ($_data as $_alias => $_details) {
|
|
|
88 |
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
|
|
89 |
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller'=> $_details['controller'], 'action'=>'index'))."</li>\n";
|
|
|
90 |
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller'=> $_details['controller'], 'action'=>'add'))."</li>\n";
|
|
|
91 |
$done[] = $_details['controller'];
|
|
|
92 |
}
|
|
|
93 |
}
|
|
|
94 |
}
|
|
|
95 |
?>
|
|
|
96 |
</ul>
|
|
|
97 |
</div>
|