Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
13532 anikendra 1
<?php
2
/**
3
 *
4
 *
5
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
6
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
7
 *
8
 * Licensed under The MIT License
9
 * For full copyright and license information, please see the LICENSE.txt
10
 * Redistributions of files must retain the above copyright notice.
11
 *
12
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
13
 * @link          http://cakephp.org CakePHP(tm) Project
14
 * @package       Cake.View.Scaffolds
15
 * @since         CakePHP(tm) v 0.10.0.1076
16
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
17
 */
18
?>
19
<div class="<?php echo $pluralVar; ?> index">
20
<h2><?php echo $pluralHumanName; ?></h2>
21
<table cellpadding="0" cellspacing="0">
22
<tr>
23
<?php foreach ($scaffoldFields as $_field): ?>
24
	<th><?php echo $this->Paginator->sort($_field); ?></th>
25
<?php endforeach; ?>
26
	<th><?php echo __d('cake', 'Actions'); ?></th>
27
</tr>
28
<?php
29
foreach (${$pluralVar} as ${$singularVar}):
30
	echo '<tr>';
31
		foreach ($scaffoldFields as $_field) {
32
			$isKey = false;
33
			if (!empty($associations['belongsTo'])) {
34
				foreach ($associations['belongsTo'] as $_alias => $_details) {
35
					if ($_field === $_details['foreignKey']) {
36
						$isKey = true;
37
						echo '<td>' . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . '</td>';
38
						break;
39
					}
40
				}
41
			}
42
			if ($isKey !== true) {
43
				echo '<td>' . h(${$singularVar}[$modelClass][$_field]) . '</td>';
44
			}
45
		}
46
 
47
		echo '<td class="actions">';
48
		echo $this->Html->link(__d('cake', 'View'), array('action' => 'view', ${$singularVar}[$modelClass][$primaryKey]));
49
		echo ' ' . $this->Html->link(__d('cake', 'Edit'), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey]));
50
		echo ' ' . $this->Form->postLink(
51
			__d('cake', 'Delete'),
52
			array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]),
53
			null,
54
			__d('cake', 'Are you sure you want to delete # %s?', ${$singularVar}[$modelClass][$primaryKey])
55
		);
56
		echo '</td>';
57
	echo '</tr>';
58
 
59
endforeach;
60
 
61
?>
62
</table>
63
	<p><?php
64
	echo $this->Paginator->counter(array(
65
		'format' => __d('cake', 'Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
66
	));
67
	?></p>
68
	<div class="paging">
69
	<?php
70
		echo $this->Paginator->prev('< ' . __d('cake', 'previous'), array(), null, array('class' => 'prev disabled'));
71
		echo $this->Paginator->numbers(array('separator' => ''));
72
		echo $this->Paginator->next(__d('cake', 'next') .' >', array(), null, array('class' => 'next disabled'));
73
	?>
74
	</div>
75
</div>
76
<div class="actions">
77
	<h3><?php echo __d('cake', 'Actions'); ?></h3>
78
	<ul>
79
		<li><?php echo $this->Html->link(__d('cake', 'New %s', $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 '<li>';
86
					echo $this->Html->link(
87
						__d('cake', 'List %s', Inflector::humanize($_details['controller'])),
88
						array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index')
89
					);
90
					echo '</li>';
91
 
92
					echo '<li>';
93
					echo $this->Html->link(
94
						__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))),
95
						array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add')
96
					);
97
					echo '</li>';
98
					$done[] = $_details['controller'];
99
				}
100
			}
101
		}
102
?>
103
	</ul>
104
</div>