function index() { $this->->recursive = 0; $this->set('', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid ', true)); $this->redirect(array('action'=>'index')); $this->flash(__('Invalid ', true), array('action'=>'index')); } $this->set('', $this->->read(null, $id)); } function add() { if (!empty($this->data)) { $this->->create(); if ($this->->save($this->data)) { $this->Session->setFlash(__('The has been saved', true)); $this->redirect(array('action'=>'index')); $this->flash(__(' saved.', true), array('action'=>'index')); } else { $this->Session->setFlash(__('The could not be saved. Please, try again.', true)); } } {$assoc} as $associationName => $relation): if (!empty($associationName)): $otherModelName = $this->_modelName($associationName); $otherPluralName = $this->_pluralName($associationName); echo "\t\t\${$otherPluralName} = \$this->{$currentModelName}->{$otherModelName}->find('list');\n"; $compact[] = "'{$otherPluralName}'"; endif; endforeach; endforeach; if (!empty($compact)): echo "\t\t\$this->set(compact(".join(', ', $compact)."));\n"; endif; ?> } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid ', true)); $this->redirect(array('action'=>'index')); $this->flash(__('Invalid ', true), array('action'=>'index')); } if (!empty($this->data)) { if ($this->->save($this->data)) { $this->Session->setFlash(__('The has been saved', true)); $this->redirect(array('action'=>'index')); $this->flash(__('The has been saved.', true), array('action'=>'index')); } else { $this->Session->setFlash(__('The could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->->read(null, $id); } {$assoc} as $associationName => $relation): if (!empty($associationName)): $otherModelName = $this->_modelName($associationName); $otherPluralName = $this->_pluralName($associationName); echo "\t\t\${$otherPluralName} = \$this->{$currentModelName}->{$otherModelName}->find('list');\n"; $compact[] = "'{$otherPluralName}'"; endif; endforeach; endforeach; if (!empty($compact)): echo "\t\t\$this->set(compact(".join(', ', $compact)."));\n"; endif; ?> } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for ', true)); $this->redirect(array('action'=>'index')); $this->flash(__('Invalid ', true), array('action'=>'index')); } if ($this->->del($id)) { $this->Session->setFlash(__(' deleted', true)); $this->redirect(array('action'=>'index')); $this->flash(__(' deleted', true), array('action'=>'index')); } }