<?php
/**
 * menus actions.
 *
 * @package    comisiones
 * @subpackage menus
 * @author     Software House LTDA <gerencia@sofhouse.net>
 * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
 */
class menusActions extends sfActions
{
  protected $Mensajes = array(
                               '&&&' => 'Se ha actualizado el menu correctamente'
                               );
                               /**
                                * Executes index action
                                *
                                * @param sfRequest $request A request object
                                */
                               public function executeIndex($request)
                               {
                                 $request->getParameterHolder()->get('_') ? $this->mensaje = $this->Mensajes[$request->getParameterHolder()->get('_')] : '';
                                 $c = new Criteria();
                                 $c->addAscendingOrderByColumn(MenusPeer::ORDEN);
                                 $this->menus = MenusPeer::doSelect($c);
                               }

                               public function executeEdit(sfWebRequest $request)
                               {
                                 $this->forward404If(!$request->isMethod('POST'));
                                 $this->menu = MenusPeer::retrieveByPk($this->getRequestParameter('id'));
                                 $this->titulo = "Edici&oacute;n de menu " . strtoupper($this->menu->getDescripcion());
                               }

                               public function handleErrorUpdate()
                               {
                                 $this->forward('menus', 'edit');
                               }

                               public function executeUpdate(sfWebRequest $request)
                               {
                                 $this->forward404If(!$request->isMethod('POST'));
                                 $menu = MenusPeer::retrieveByPk($this->getRequestParameter('id'));
                                 $mensaje = '&&&';
                                 $menu->setDescripcion($this->getRequestParameter('descripcion'));
                                 $menu->setOrden($this->getRequestParameter('orden'));
                                 $menu->save();
                                 return $this->redirect("menus/index?_=$mensaje");
                               }
}
