public function editAction() { if ($this->tplVars['lvals']['canEdit'] && $this->_hasParam('id')) { array_push($this->tplVars['page_css'], 'livevalidation.css'); array_push($this->tplVars['page_js'], 'livevalidation.js'); array_push($this->tplVars['page_css'], 'product_edit.css'); array_push($this->tplVars['header']['actions']['names'], array('name' => 'edit', 'menu_name' => 'Edit Product')); $this->tplVars['header']['actions']['names'][] = array('name' => 'platforms', 'menu_name' => 'Platform list'); $this->tplVars['header']['actions']['names'][] = array('name' => 'os', 'menu_name' => 'OS list'); $this->tplVars['header']['actions']['names'][] = array('name' => 'changelog', 'menu_name' => 'Edit change log', 'params' => array('id' => $this->_getParam('id'))); $this->tplVars['lvals']['isNewRecord'] = false; array_push($this->viewIncludes, 'products/productsEdit.tpl'); $id = $this->_getParam('id'); $this->tplVars['lvals']['postRes'] = 2; $products = new AdminProducts(); $this->tplVars['cats'] = $products->getCategories(TRUE); $this->tplVars['plat'] = $products->getPlatforms(TRUE); $this->tplVars['langs'] = $products->getProductLangs(TRUE); $this->tplVars['os'] = $products->getProductOS(TRUE); if ($this->_request->getPost('ispost')) { $this->to_log(); $this->tplVars['product'] = $this->_request->getPost(); $this->tplVars['cats']['select'] = $this->_request->getPost('p_cat'); $this->tplVars['plat']['select'] = $this->_request->getPost('p_platform'); $this->tplVars['langs']['select'] = $this->_request->getPost('p_languages'); $this->tplVars['os']['select'] = $this->_request->getPost('p_os'); $this->tplVars['lvals']['postRes'] = $products->setProductById($id, $this->tplVars['product']); } else { $this->tplVars['product'] = $products->getProductById($id); $this->tplVars['cats']['select'] = array($this->tplVars['product']['p_cat']); $this->tplVars['plat']['select'] = array($this->tplVars['product']['p_platform']); $this->tplVars['langs']['select'] = explode('|', trim($this->tplVars['product']['p_languages'], '|')); $this->tplVars['os']['select'] = explode('|', trim($this->tplVars['product']['p_os'], '|')); } } }