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: form.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;?> form">
26
<?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
27
	<fieldset>
28
 		<legend><?php echo "<?php __('".Inflector::humanize($action)." {$singularHumanName}');?>";?></legend>
29
<?php
30
		echo "\t<?php\n";
31
		foreach ($fields as $field) {
32
			if ($action == 'add' && $field == $primaryKey) {
33
				continue;
34
			} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
35
				echo "\t\techo \$form->input('{$field}');\n";
36
			}
37
		}
38
		if (!empty($associations['hasAndBelongsToMany'])) {
39
			foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {
40
				echo "\t\techo \$form->input('{$assocName}');\n";
41
			}
42
		}
43
		echo "\t?>\n";
44
?>
45
	</fieldset>
46
<?php
47
	echo "<?php echo \$form->end('Submit');?>\n";
48
?>
49
</div>
50
<div class="actions">
51
	<ul>
52
<?php if ($action != 'add'):?>
53
		<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action'=>'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
54
<?php endif;?>
55
		<li><?php echo "<?php echo \$html->link(__('List {$pluralHumanName}', true), array('action'=>'index'));?>";?></li>
56
<?php
57
		$done = array();
58
		foreach ($associations as $type => $data) {
59
			foreach ($data as $alias => $details) {
60
				if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
61
					echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller'=> '{$details['controller']}', 'action'=>'index')); ?> </li>\n";
62
					echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller'=> '{$details['controller']}', 'action'=>'add')); ?> </li>\n";
63
					$done[] = $details['controller'];
64
				}
65
			}
66
		}
67
?>
68
	</ul>
69
</div>