Subversion-Projekte lars-tiefland.cakephp

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
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 1.2.0.5234
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 "<?php __('{$pluralHumanName}');?>";?></h2>
27
<p>
28
<?php echo "<?php
29
echo \$paginator->counter(array(
30
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
31
));
32
?>";?>
33
</p>
34
<table cellpadding="0" cellspacing="0">
35
<tr>
36
<?php  foreach ($fields as $field):?>
37
	<th><?php echo "<?php echo \$paginator->sort('{$field}');?>";?></th>
38
<?php endforeach;?>
39
	<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
40
</tr>
41
<?php
42
echo "<?php
43
\$i = 0;
44
foreach (\${$pluralVar} as \${$singularVar}):
45
	\$class = null;
46
	if (\$i++ % 2 == 0) {
47
		\$class = ' class=\"altrow\"';
48
	}
49
?>\n";
50
	echo "\t<tr<?php echo \$class;?>>\n";
51
		foreach ($fields as $field) {
52
			$isKey = false;
53
			if (!empty($associations['belongsTo'])) {
54
				foreach ($associations['belongsTo'] as $alias => $details) {
55
					if ($field === $details['foreignKey']) {
56
						$isKey = true;
57
						echo "\t\t<td>\n\t\t\t<?php echo \$html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller'=> '{$details['controller']}', 'action'=>'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
58
						break;
59
					}
60
				}
61
			}
62
			if ($isKey !== true) {
63
				echo "\t\t<td>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t</td>\n";
64
			}
65
		}
66
 
67
		echo "\t\t<td class=\"actions\">\n";
68
		echo "\t\t\t<?php echo \$html->link(__('View', true), array('action'=>'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
69
	 	echo "\t\t\t<?php echo \$html->link(__('Edit', true), array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
70
	 	echo "\t\t\t<?php echo \$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";
71
		echo "\t\t</td>\n";
72
	echo "\t</tr>\n";
73
 
74
echo "<?php endforeach; ?>\n";
75
?>
76
</table>
77
</div>
78
<div class="paging">
79
<?php echo "\t<?php echo \$paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
80
 | <?php echo "\t<?php echo \$paginator->numbers();?>\n"?>
81
<?php echo "\t<?php echo \$paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>\n";?>
82
</div>
83
<div class="actions">
84
	<ul>
85
		<li><?php echo "<?php echo \$html->link(__('New {$singularHumanName}', true), array('action'=>'add')); ?>";?></li>
86
<?php
87
	$done = array();
88
	foreach ($associations as $type => $data) {
89
		foreach ($data as $alias => $details) {
90
			if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
91
				echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
92
				echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
93
				$done[] = $details['controller'];
94
			}
95
		}
96
	}
97
?>
98
	</ul>
99
</div>