예제 #1
0
 public function editMarcaAction()
 {
     $form = new Application_Form_RegistroCategoria();
     $entityCategoria = new Application_Entity_Categoria();
     $entityCategoria->identifyCategoria($this->_getParam('cat'));
     $data = $entityCategoria->getProperties();
     $dataForm['idCategoria'] = $data['_idCategoria'];
     $dataForm['nombreCategoria'] = $data['_nombre'];
     $dataForm['flagActivo'] = $data['_flagActivo'];
     $dataForm['area'] = $data['_idArea'];
     $form->excludeValidatorNombre($data['_nombre']);
     $form->populate($dataForm);
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getParams())) {
             $categoria = new Application_Entity_Categoria();
             $values = $form->getValues();
             $data['_nombre'] = $values['nombreCategoria'];
             $data['_idArea'] = $values['area'];
             $data['_idCategoria'] = $values['idCategoria'];
             $data['_flagActivo'] = $values['flagActivo'];
             $categoria->setProperties($data);
             $categoria->editCategoria();
             $this->_redirect('/admin/categoria/');
         }
     }
     $this->view->form = $form;
 }
예제 #2
0
 function init()
 {
     parent::init();
     $this->addElement(new Zend_Form_Element_Hidden('idSubCategoria'));
     $this->addElement(new Zend_Form_Element_Select('categoria', array('label' => 'categoria', 'multioptions' => CST_Utils::fetchPairs(Application_Entity_Categoria::listarCategorias()))));
     $this->addElement(new Zend_Form_Element_Text('nombreSubCategoria', array('label' => 'Nombre:', 'required' => true, 'maxlength' => '200', 'validators' => array('NoRecordExists' => new Zend_Validate_Db_NoRecordExists(array('table' => 'subcategoriaproducto', 'field' => 'NombreSubCategoriaProducto')), 'AlfaNum' => new Zend_Validate_Alnum(true)), 'size' => '40')));
     $this->addElement(new Zend_Form_Element_Radio('flagActivo', array('label' => 'Activar', 'value' => '1', 'multioptions' => array('1' => 'Activo', '0' => 'Desactivo'))));
     $this->addElement(new Zend_Form_Element_Submit('Enviar', array('attribs' => array('class' => 'submit-button'))));
 }
예제 #3
0
 public function init()
 {
     parent::init();
     $this->_identity = Zend_Auth::getInstance()->getIdentity();
     $this->view->identity = $this->_identity;
     if (isset($this->_session->carritoCompras)) {
         $this->view->carrito = $this->_session->carritoCompras;
     }
     $productos = new Application_Entity_Producto();
     if (!isset($this->_identity) && empty($this->_identity)) {
         $formLogin = new Application_Form_FormularioLogin();
         $formLogin->removeDecorators();
         $formLogin->customDecoratorFile("/form-custom/_formLoginHeader.phtml");
         $this->view->formLoginHeader = $formLogin . '
             <div class="clear"></div>
             <div style="float:right; padding-right:32px">
             <a href="/recuperar-contrasena">Olvido Contraseña</a>
             </div>';
         $configNavigationArray = array('home' => array('label' => 'Inicio', 'uri' => '/', 'orden' => '1', 'class' => 'first'), 'productos' => array('label' => 'Productos', 'uri' => '/productos', 'orden' => '2'), 'registrate' => array('label' => 'Registrate', 'uri' => '/registrate', 'orden' => '3'), 'contactenos' => array('label' => 'Contactenos', 'uri' => '/contactenos', 'orden' => '4'));
     } else {
         $string = '<div>' . $this->_identity->NombreUsuario . ' | ' . $this->_identity->Correo . ' | <a href="/login/salir">Salir</a> </div>
             <div>&nbsp;</div>';
         $this->view->formLoginHeader = $string;
         $configNavigationArray = array('home' => array('label' => 'Inicio', 'uri' => '/', 'orden' => '1', 'class' => 'first'), 'productos' => array('label' => 'Productos', 'uri' => '/productos', 'orden' => '2'), 'micuenta' => array('label' => 'Mi cuenta', 'uri' => '/mi-cuenta', 'orden' => '3'), 'contactenos' => array('label' => 'Contactenos', 'uri' => '/contactenos', 'orden' => '4'));
     }
     $categoria = new Application_Entity_Categoria();
     $listaCategorias = $categoria->listarArbolCategorias();
     $configNavigationArray['productos']['pages'] = $listaCategorias;
     $this->view->listaCategoriasNavigator = $listaCategorias;
     $navigation = new Zend_Navigation($configNavigationArray);
     $this->view->navigation($navigation);
     $this->view->ofertasRecienteRandon = $productos->listarOfertasRecientesAleatorio();
     $uri = $this->getRequest()->getPathInfo();
     $position = strpos($uri, '/page');
     if ($position > 0) {
         $uri = substr($uri, 0, $position);
     }
     $this->view->getPathInfo = $uri;
     $activeNavi = $this->view->navigation()->findByUri($uri);
     $activeNavi->active = true;
 }
예제 #4
0
 public function categoriaAction()
 {
     $this->view->categoria = Application_Entity_Categoria::listarCategorias();
 }