public function editAction() { if ($this->tplVars['lvals']['canEdit'] && $this->_hasParam('id')) { include_once 'support.php'; $id = $this->_getParam('id'); $this->tplVars['lvals']['postRes'] = 2; $support = new Support(); $this->tplVars['support'] = $support->getById($id); if ($this->_request->getPost('ispost')) { $this->tplVars['platforms'] = $this->_request->getPost(); if (($this->tplVars['lvals']['postRes'] = $support->update($id, $this->_request->getPost())) > 0) { $this->_redirect('support/'); } $select_prods = $this->_request->getPost('products_support'); foreach ($select_prods as $val) { $select[$val] = $val; } } else { $select_prods = $support->selectSuportProd($id); foreach ($select_prods as $val) { $select[$val['ps_product_id']] = $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'] = false; $this->tplVars['header']['actions']['names'][] = array('name' => 'supportedit', 'menu_name' => 'Support Edit'); array_push($this->viewIncludes, 'support/Edit.tpl'); unset($os); } else { $this->_redirect('support/'); } }