Return to Snippet

Revision: 45192
at April 27, 2011 03:45 by shinokada


Initial Code
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
        $this->module=basename(dirname(dirname(__FILE__)));
        // Set breadcrumb
        $this->bep_site->set_crumb($this->lang->line('backendpro_menus'),$this->module.'/admin');
    }


 function _fields(){
        $data = array(
            '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{
	

	}
  }

}

Initial URL

                                

Initial Description

                                

Initial Title
Kaimonokago create and update

Initial Tags
update

Initial Language
PHP