/** * processAction * Update the record previously selected * @return unknown_type */ public function processAction() { $i = 0; $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $form = $this->getForm("/admin/productscategories/process"); $request = $this->getRequest(); // Create the buttons in the edit form $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/productscategories/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/productscategories/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null))); // Check if we have a POST request if (!$request->isPost()) { return $this->_helper->redirector('list', 'productscategories', 'admin'); } if ($form->isValid($request->getPost())) { // Get the id $id = $this->getRequest()->getParam('category_id'); // Get the values posted $params = $form->getValues(); try { $id = ProductsCategories::SaveAll($id, $params); // Attach the wiki pages to the category Wikilinks::addWikiPages2Categories($id, $params['wikipages']); // Attach the products Products::add2category($id, $params['products']); $this->_helper->redirector('edit', 'productscategories', 'admin', array('id' => $id, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success')); } catch (Exception $e) { $this->_helper->redirector('edit', 'productscategories', 'admin', array('id' => $id, 'mex' => $this->translator->translate('Unable to process the request at this time.') . ": " . $e->getMessage(), 'status' => 'danger')); } $redirector->gotoUrl("/admin/productscategories/edit/id/{$id}"); } else { $this->view->form = $form; $this->view->title = $this->translator->translate("Edit Category"); $this->view->description = $this->translator->translate("Here you can edit the product category."); return $this->render('applicantform'); } }