統計
| ブランチ: | リビジョン:

pictcode / lib / Cake / Console / Templates / default / views / view.ctp @ 635eef61

履歴 | 表示 | アノテート | ダウンロード (6.218 KB)

1 635eef61 spyder1211
<?php
2
/**
3
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
4
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
5
 *
6
 * Licensed under The MIT License
7
 * For full copyright and license information, please see the LICENSE.txt
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11
 * @link          http://cakephp.org CakePHP(tm) Project
12
 * @package       Cake.Console.Templates.default.views
13
 * @since         CakePHP(tm) v 1.2.0.5234
14
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
15
 */
16
?>
17
<div class="<?php echo $pluralVar; ?> view">
18
<h2><?php echo "<?php echo __('{$singularHumanName}'); ?>"; ?></h2>
19
	<dl>
20
<?php
21
foreach ($fields as $field) {
22
	$isKey = false;
23
	if (!empty($associations['belongsTo'])) {
24
		foreach ($associations['belongsTo'] as $alias => $details) {
25
			if ($field === $details['foreignKey']) {
26
				$isKey = true;
27
				echo "\t\t<dt><?php echo __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n";
28
				echo "\t\t<dd>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
29
				break;
30
			}
31
		}
32
	}
33
	if ($isKey !== true) {
34
		echo "\t\t<dt><?php echo __('" . Inflector::humanize($field) . "'); ?></dt>\n";
35
		echo "\t\t<dd>\n\t\t\t<?php echo h(\${$singularVar}['{$modelClass}']['{$field}']); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
36
	}
37
}
38
?>
39
	</dl>
40
</div>
41
<div class="actions">
42
	<h3><?php echo "<?php echo __('Actions'); ?>"; ?></h3>
43
	<ul>
44
<?php
45
	echo "\t\t<li><?php echo \$this->Html->link(__('Edit " . $singularHumanName ."'), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
46
	echo "\t\t<li><?php echo \$this->Form->postLink(__('Delete " . $singularHumanName . "'), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), array('confirm' => __('Are you sure you want to delete # %s?', \${$singularVar}['{$modelClass}']['{$primaryKey}']))); ?> </li>\n";
47
	echo "\t\t<li><?php echo \$this->Html->link(__('List " . $pluralHumanName . "'), array('action' => 'index')); ?> </li>\n";
48
	echo "\t\t<li><?php echo \$this->Html->link(__('New " . $singularHumanName . "'), array('action' => 'add')); ?> </li>\n";
49
50
	$done = array();
51
	foreach ($associations as $type => $data) {
52
		foreach ($data as $alias => $details) {
53
			if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
54
				echo "\t\t<li><?php echo \$this->Html->link(__('List " . Inflector::humanize($details['controller']) . "'), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
55
				echo "\t\t<li><?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "'), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
56
				$done[] = $details['controller'];
57
			}
58
		}
59
	}
60
?>
61
	</ul>
62
</div>
63
<?php
64
if (!empty($associations['hasOne'])) :
65
	foreach ($associations['hasOne'] as $alias => $details): ?>
66
	<div class="related">
67
		<h3><?php echo "<?php echo __('Related " . Inflector::humanize($details['controller']) . "'); ?>"; ?></h3>
68
	<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])): ?>\n"; ?>
69
		<dl>
70
	<?php
71
			foreach ($details['fields'] as $field) {
72
				echo "\t\t<dt><?php echo __('" . Inflector::humanize($field) . "'); ?></dt>\n";
73
				echo "\t\t<dd>\n\t<?php echo \${$singularVar}['{$alias}']['{$field}']; ?>\n&nbsp;</dd>\n";
74
			}
75
	?>
76
		</dl>
77
	<?php echo "<?php endif; ?>\n"; ?>
78
		<div class="actions">
79
			<ul>
80
				<li><?php echo "<?php echo \$this->Html->link(__('Edit " . Inflector::humanize(Inflector::underscore($alias)) . "'), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n"; ?>
81
			</ul>
82
		</div>
83
	</div>
84
	<?php
85
	endforeach;
86
endif;
87
if (empty($associations['hasMany'])) {
88
	$associations['hasMany'] = array();
89
}
90
if (empty($associations['hasAndBelongsToMany'])) {
91
	$associations['hasAndBelongsToMany'] = array();
92
}
93
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
94
foreach ($relations as $alias => $details):
95
	$otherSingularVar = Inflector::variable($alias);
96
	$otherPluralHumanName = Inflector::humanize($details['controller']);
97
	?>
98
<div class="related">
99
	<h3><?php echo "<?php echo __('Related " . $otherPluralHumanName . "'); ?>"; ?></h3>
100
	<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])): ?>\n"; ?>
101
	<table cellpadding = "0" cellspacing = "0">
102
	<tr>
103
<?php
104
			foreach ($details['fields'] as $field) {
105
				echo "\t\t<th><?php echo __('" . Inflector::humanize($field) . "'); ?></th>\n";
106
			}
107
?>
108
		<th class="actions"><?php echo "<?php echo __('Actions'); ?>"; ?></th>
109
	</tr>
110
<?php
111
echo "\t<?php foreach (\${$singularVar}['{$alias}'] as \${$otherSingularVar}): ?>\n";
112
		echo "\t\t<tr>\n";
113
			foreach ($details['fields'] as $field) {
114
				echo "\t\t\t<td><?php echo \${$otherSingularVar}['{$field}']; ?></td>\n";
115
			}
116
117
			echo "\t\t\t<td class=\"actions\">\n";
118
			echo "\t\t\t\t<?php echo \$this->Html->link(__('View'), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
119
			echo "\t\t\t\t<?php echo \$this->Html->link(__('Edit'), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
120
			echo "\t\t\t\t<?php echo \$this->Form->postLink(__('Delete'), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), array('confirm' => __('Are you sure you want to delete # %s?', \${$otherSingularVar}['{$details['primaryKey']}']))); ?>\n";
121
			echo "\t\t\t</td>\n";
122
		echo "\t\t</tr>\n";
123
124
echo "\t<?php endforeach; ?>\n";
125
?>
126
	</table>
127
<?php echo "<?php endif; ?>\n\n"; ?>
128
	<div class="actions">
129
		<ul>
130
			<li><?php echo "<?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "'), array('controller' => '{$details['controller']}', 'action' => 'add')); ?>"; ?> </li>
131
		</ul>
132
	</div>
133
</div>
134
<?php
135
endforeach;
136
?>