3
* Bake Template for Controller action generation.
7
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
8
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
10
* Licensed under The MIT License
11
* Redistributions of files must retain the above copyright notice.
13
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
14
* @link http://cakephp.org CakePHP(tm) Project
16
* @subpackage cake.console.libs.template.objects
17
* @since CakePHP(tm) v 1.3
18
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
22
function <?php echo $admin ?>index() {
23
$this-><?php echo $currentModelName ?>->recursive = 0;
24
$this->set('<?php echo $pluralName ?>', $this->paginate());
27
function <?php echo $admin ?>view($id = null) {
29
<?php if ($wannaUseSession): ?>
30
$this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName) ?>', true));
31
$this->redirect(array('action' => 'index'));
33
$this->flash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true), array('action' => 'index'));
36
$this->set('<?php echo $singularName; ?>', $this-><?php echo $currentModelName; ?>->read(null, $id));
39
<?php $compact = array(); ?>
40
function <?php echo $admin ?>add() {
41
if (!empty($this->data)) {
42
$this-><?php echo $currentModelName; ?>->create();
43
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
44
<?php if ($wannaUseSession): ?>
45
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved', true));
46
$this->redirect(array('action' => 'index'));
48
$this->flash(__('<?php echo ucfirst(strtolower($currentModelName)); ?> saved.', true), array('action' => 'index'));
51
<?php if ($wannaUseSession): ?>
52
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.', true));
57
foreach (array('belongsTo', 'hasAndBelongsToMany') as $assoc):
58
foreach ($modelObj->{$assoc} as $associationName => $relation):
59
if (!empty($associationName)):
60
$otherModelName = $this->_modelName($associationName);
61
$otherPluralName = $this->_pluralName($associationName);
62
echo "\t\t\${$otherPluralName} = \$this->{$currentModelName}->{$otherModelName}->find('list');\n";
63
$compact[] = "'{$otherPluralName}'";
67
if (!empty($compact)):
68
echo "\t\t\$this->set(compact(".join(', ', $compact)."));\n";
73
<?php $compact = array(); ?>
74
function <?php echo $admin; ?>edit($id = null) {
75
if (!$id && empty($this->data)) {
76
<?php if ($wannaUseSession): ?>
77
$this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true));
78
$this->redirect(array('action' => 'index'));
80
$this->flash(sprintf(__('Invalid <?php echo strtolower($singularHumanName); ?>', true)), array('action' => 'index'));
83
if (!empty($this->data)) {
84
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
85
<?php if ($wannaUseSession): ?>
86
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved', true));
87
$this->redirect(array('action' => 'index'));
89
$this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.', true), array('action' => 'index'));
92
<?php if ($wannaUseSession): ?>
93
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.', true));
97
if (empty($this->data)) {
98
$this->data = $this-><?php echo $currentModelName; ?>->read(null, $id);
101
foreach (array('belongsTo', 'hasAndBelongsToMany') as $assoc):
102
foreach ($modelObj->{$assoc} as $associationName => $relation):
103
if (!empty($associationName)):
104
$otherModelName = $this->_modelName($associationName);
105
$otherPluralName = $this->_pluralName($associationName);
106
echo "\t\t\${$otherPluralName} = \$this->{$currentModelName}->{$otherModelName}->find('list');\n";
107
$compact[] = "'{$otherPluralName}'";
111
if (!empty($compact)):
112
echo "\t\t\$this->set(compact(".join(', ', $compact)."));\n";
117
function <?php echo $admin; ?>delete($id = null) {
119
<?php if ($wannaUseSession): ?>
120
$this->Session->setFlash(__('Invalid id for <?php echo strtolower($singularHumanName); ?>', true));
121
$this->redirect(array('action'=>'index'));
123
$this->flash(sprintf(__('Invalid <?php echo strtolower($singularHumanName); ?>', true)), array('action' => 'index'));
126
if ($this-><?php echo $currentModelName; ?>->delete($id)) {
127
<?php if ($wannaUseSession): ?>
128
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted', true));
129
$this->redirect(array('action'=>'index'));
131
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted', true), array('action' => 'index'));
134
<?php if ($wannaUseSession): ?>
135
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted', true));
137
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted', true), array('action' => 'index'));
139
$this->redirect(array('action' => 'index'));
b'\\ No newline at end of file'