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; ?> view">
20
<h2><?php echo __d('cake', 'View %s', $singularHumanName); ?></h2>
21
	<dl>
22
<?php
23
foreach ($scaffoldFields as $_field) {
24
	$isKey = false;
25
	if (!empty($associations['belongsTo'])) {
26
		foreach ($associations['belongsTo'] as $_alias => $_details) {
27
			if ($_field === $_details['foreignKey']) {
28
				$isKey = true;
29
				echo "\t\t<dt>" . Inflector::humanize($_alias) . "</dt>\n";
30
				echo "\t\t<dd>\n\t\t\t";
31
				echo $this->Html->link(
32
					${$singularVar}[$_alias][$_details['displayField']],
33
					array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])
34
				);
35
				echo "\n\t\t&nbsp;</dd>\n";
36
				break;
37
			}
38
		}
39
	}
40
	if ($isKey !== true) {
41
		echo "\t\t<dt>" . Inflector::humanize($_field) . "</dt>\n";
42
		echo "\t\t<dd>" . h(${$singularVar}[$modelClass][$_field]) . "&nbsp;</dd>\n";
43
	}
44
}
45
?>
46
	</dl>
47
</div>
48
<div class="actions">
49
	<h3><?php echo __d('cake', 'Actions'); ?></h3>
50
	<ul>
51
<?php
52
	echo "\t\t<li>";
53
	echo $this->Html->link(__d('cake', 'Edit %s', $singularHumanName),   array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey]));
54
	echo " </li>\n";
55
 
56
	echo "\t\t<li>";
57
	echo $this->Form->postLink(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete # %s?', ${$singularVar}[$modelClass][$primaryKey]));
58
	echo " </li>\n";
59
 
60
	echo "\t\t<li>";
61
	echo $this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index'));
62
	echo " </li>\n";
63
 
64
	echo "\t\t<li>";
65
	echo $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add'));
66
	echo " </li>\n";
67
 
68
	$done = array();
69
	foreach ($associations as $_type => $_data) {
70
		foreach ($_data as $_alias => $_details) {
71
			if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
72
				echo "\t\t<li>";
73
				echo $this->Html->link(
74
					__d('cake', 'List %s', Inflector::humanize($_details['controller'])),
75
					array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index')
76
				);
77
				echo "</li>\n";
78
				echo "\t\t<li>";
79
				echo $this->Html->link(
80
					__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))),
81
					array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add')
82
				);
83
				echo "</li>\n";
84
				$done[] = $_details['controller'];
85
			}
86
		}
87
	}
88
?>
89
	</ul>
90
</div>
91
<?php
92
if (!empty($associations['hasOne'])) :
93
foreach ($associations['hasOne'] as $_alias => $_details): ?>
94
<div class="related">
95
	<h3><?php echo __d('cake', "Related %s", Inflector::humanize($_details['controller'])); ?></h3>
96
<?php if (!empty(${$singularVar}[$_alias])): ?>
97
	<dl>
98
<?php
99
		$otherFields = array_keys(${$singularVar}[$_alias]);
100
		foreach ($otherFields as $_field) {
101
			echo "\t\t<dt>" . Inflector::humanize($_field) . "</dt>\n";
102
			echo "\t\t<dd>\n\t" . ${$singularVar}[$_alias][$_field] . "\n&nbsp;</dd>\n";
103
		}
104
?>
105
	</dl>
106
<?php endif; ?>
107
	<div class="actions">
108
		<ul>
109
		<li><?php
110
			echo $this->Html->link(
111
				__d('cake', 'Edit %s', Inflector::humanize(Inflector::underscore($_alias))),
112
				array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'edit', ${$singularVar}[$_alias][$_details['primaryKey']])
113
			);
114
			echo "</li>\n";
115
			?>
116
		</ul>
117
	</div>
118
</div>
119
<?php
120
endforeach;
121
endif;
122
 
123
if (empty($associations['hasMany'])) {
124
	$associations['hasMany'] = array();
125
}
126
if (empty($associations['hasAndBelongsToMany'])) {
127
	$associations['hasAndBelongsToMany'] = array();
128
}
129
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
130
$i = 0;
131
foreach ($relations as $_alias => $_details):
132
$otherSingularVar = Inflector::variable($_alias);
133
?>
134
<div class="related">
135
	<h3><?php echo __d('cake', "Related %s", Inflector::humanize($_details['controller'])); ?></h3>
136
<?php if (!empty(${$singularVar}[$_alias])): ?>
137
	<table cellpadding="0" cellspacing="0">
138
	<tr>
139
<?php
140
		$otherFields = array_keys(${$singularVar}[$_alias][0]);
141
		if (isset($_details['with'])) {
142
			$index = array_search($_details['with'], $otherFields);
143
			unset($otherFields[$index]);
144
		}
145
		foreach ($otherFields as $_field) {
146
			echo "\t\t<th>" . Inflector::humanize($_field) . "</th>\n";
147
		}
148
?>
149
		<th class="actions">Actions</th>
150
	</tr>
151
<?php
152
		$i = 0;
153
		foreach (${$singularVar}[$_alias] as ${$otherSingularVar}):
154
			echo "\t\t<tr>\n";
155
 
156
			foreach ($otherFields as $_field) {
157
				echo "\t\t\t<td>" . ${$otherSingularVar}[$_field] . "</td>\n";
158
			}
159
 
160
			echo "\t\t\t<td class=\"actions\">\n";
161
			echo "\t\t\t\t";
162
			echo $this->Html->link(
163
				__d('cake', 'View'),
164
				array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'view', ${$otherSingularVar}[$_details['primaryKey']])
165
			);
166
			echo "\n";
167
			echo "\t\t\t\t";
168
			echo $this->Html->link(
169
				__d('cake', 'Edit'),
170
				array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'edit', ${$otherSingularVar}[$_details['primaryKey']])
171
			);
172
			echo "\n";
173
			echo "\t\t\t\t";
174
			echo $this->Form->postLink(
175
				__d('cake', 'Delete'),
176
				array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'delete', ${$otherSingularVar}[$_details['primaryKey']]),
177
				null,
178
				__d('cake', 'Are you sure you want to delete # %s?', ${$otherSingularVar}[$_details['primaryKey']])
179
			);
180
			echo "\n";
181
			echo "\t\t\t</td>\n";
182
		echo "\t\t</tr>\n";
183
		endforeach;
184
?>
185
	</table>
186
<?php endif; ?>
187
	<div class="actions">
188
		<ul>
189
			<li><?php echo $this->Html->link(
190
				__d('cake', "New %s", Inflector::humanize(Inflector::underscore($_alias))),
191
				array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add')
192
			); ?> </li>
193
		</ul>
194
	</div>
195
</div>
196
<?php endforeach; ?>