Example #1
0
 public function addAction()
 {
     if ($this->tplVars['lvals']['canEdit']) {
         include_once 'support.php';
         if ($this->_request->getPost('ispost')) {
             $support = new Support();
             $this->tplVars['support'] = $this->_request->getPost();
             if (($this->tplVars['lvals']['postRes'] = $support->add($this->_request->getPost())) > 0) {
                 $this->_redirect('support/');
             }
             $select_prods = $this->_request->getPost('products_support');
             foreach ($select_prods as $val) {
                 $select[$val] = $val;
             }
         }
         $products = new AdminProducts();
         $prods = $products->getProducts();
         foreach ($prods['prods'] as $cat => $prod) {
             foreach ($prod as $key => $val) {
                 $prods['prods'][$cat][$key]['select'] = $select[$key] ? 1 : 0;
             }
         }
         $this->tplVars['products'] = $prods;
         array_push($this->tplVars['page_css'], 'product_edit.css');
         array_push($this->tplVars['page_css'], 'livevalidation.css');
         array_push($this->tplVars['page_js'], 'livevalidation.js');
         $this->tplVars['lvals']['isNewRecord'] = true;
         array_push($this->viewIncludes, 'support/Edit.tpl');
         $this->tplVars['lvals']['postRes'] = 2;
         unset($support);
     } else {
         $this->_redirect('support/');
     }
 }