/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class Admin extends Shop_Admin_Controller { private $module; function Admin(){ parent::Shop_Admin_Controller(); // Check for access permission check('Menus'); // define this module which will be used later // Set breadcrumb $this->bep_site->set_crumb($this->lang->line('backendpro_menus'),$this->module.'/admin'); } function _fields(){ 'name' => db_clean($_POST['name']), 'shortdesc' => db_clean($_POST['shortdesc']), 'status' => db_clean($_POST['status'],8), 'parentid' => id_clean($_POST['parentid']), 'order' => id_clean($_POST['order'],10), 'page_uri_id' => db_clean($_POST['page_uri_id']), 'lang_id' => db_clean($_POST['lang_id']), 'menu_id' => db_clean($_POST['menu_id']) ); // $this->MKaimonokago->addItem($this->module, $data); return $data; } function create(){ if ($this->input->post('name')){ $data = $this-> _fields(); $this->MKaimonokago->addItem($this->module, $data); flashMsg('success',$this->lang->line('kago_created')); redirect($this->module.'/admin/index','refresh'); }else{ } } function edit($id=0){ if ($this->input->post('name')){ $data = $this-> _fields(); $this->MKaimonokago->updateItem($this->module,$data); $this->session->set_flashdata('message','Menu updated'); flashMsg('success',$this->lang->line('kago_updated')); redirect($this->module.'/admin/index','refresh'); }else{ } } }