示例#1
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/reviews/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/banks/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/banks/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', 'reviews', 'admin');
     }
     if ($form->isValid($request->getPost())) {
         // Get the id
         $id = $this->getRequest()->getParam('review_id');
         // Set the new values
         if (is_numeric($id)) {
             $this->reviews = Reviews::getbyId($id);
         }
         // Get the values posted
         $params = $form->getValues();
         $id = Reviews::saveData($params);
         $redirector->gotoUrl("/admin/reviews/edit/id/{$id}");
     } else {
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("Details of the reviews");
         $this->view->description = $this->translator->translate("Here you can check the submitted information.");
         return $this->render('applicantform');
     }
 }
示例#2
0
 /**
  * addreviewAction
  * Create the form for the submittion of the review
  */
 public function addreviewAction()
 {
     $ns = new Zend_Session_Namespace();
     $this->getHelper('layout')->setLayout('1column');
     $request = $this->getRequest();
     $uri = $request->getParam('q');
     if (!empty($uri)) {
         $product = Products::getProductbyUriID($uri, null, $ns->langid);
         if (is_array($product)) {
             $this->view->product = $product;
             $form = $this->ReviewForm($uri);
             // Check if we have a POST request
             if ($request->isPost()) {
                 if ($form->isValid($request->getPost())) {
                     if (Reviews::saveData($form->getValues(), true)) {
                         return $this->_helper->redirector('get', 'products', 'default', array('q' => $product['uri']));
                     }
                 }
             }
             $form->populate(array('product_id' => $product['product_id']));
             $this->view->reviewform = $form;
         }
     } else {
         return $this->_helper->redirector('index', 'index', 'default');
     }
     $this->_helper->viewRenderer('reviews');
 }