Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class ModalidadesController extends CentralAppController {
- /**
- * Representa el nombre de este controller
- * @var string $name
- */
- var $name = 'Modalidades';
- /**
- * Conjunto de Modelos que han de cargarse para este controller
- * @var array $uses
- */
- var $uses = array('Central.Modalidad');
- /**
- * Helpers adicionales que se deben cargar
- * @var array $helpers
- */
- var $helpers = array('Html', 'Form');
- /**
- * @var string $singularName Nombre humano que representa este controller, en singular
- */
- public static $singularName = 'Modalidad';
- /**
- * @var string $pluralName Nombre humano que representa este controller, en plural
- */
- public static $pluralName = 'Modalidades';
- /**
- * Funcion para listar todas las modalidades existentes
- * @return void
- */
- public function index() {
- $this->set('data', $this->Modalidad->find('all'));
- }
- /**
- * Funcion para crear una nueva modalidad
- * @return void
- */
- function crear() {
- $this->set('title_for_layout', 'Adicionar Modalidades');
- if (!empty($this->data)) {
- if ($this->Modalidad->save($this->data)) {
- // logic goes here
- } else {
- $this->Session->setFlash('Ocurrieron errores salvando los datos', 'default', array('class' => 'example_class'));
- }
- } else {
- $this->render();
- }
- }
- /**
- * Funcion para crear una editar una modalidad existente
- * @return void
- */
- function editar($id_modalidad = null) {
- $this->set('title_for_layout', 'Editar modalidad');
- $this->Modalidad->cmodal_006 = $id_modalidad;
- if (empty($this->data)) {
- $this->data = $this->Modalidad->read();
- } else {
- if ($this->Modalidad->save()) {
- $this->Session->setFlash('La modalidad ha sido actualizada satisfactoriamente');
- $this->redirect(array('action' => 'index'));
- }
- }
- $this->render();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement