Пример #1
0
 public function editAction()
 {
     $id = $this->_request->getParam("id");
     $categoryId = $this->_request->getParam("categoryId");
     $form = new Application_Form_Tocategory();
     $form->getElement("picture")->setRequired(false);
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getParams())) {
             $info = $form->getValues();
             $category_model = new Application_Model_Tocategory();
             $category_model->edittoCategory($info);
             $this->redirect("tocategory/list/categoryId/" . $categoryId);
         }
     }
     if (!empty($id)) {
         $category_model = new Application_Model_Tocategory();
         $cat = $category_model->getTocategoryById($id);
         $form->populate($cat[0]);
     }
     $this->view->form = $form;
     $this->render('add');
 }