Beispiel #1
0
 function edit($id = 0)
 {
     $adminmenu = new adminmenu($id);
     if ($_SERVER['REQUEST_METHOD'] == "GET") {
     } else {
         $adminmenu->name = $this->input->post('name');
         $adminmenu->link = $this->input->post('link');
         $parentmenu = new adminmenu(trim($this->input->post('parent')));
         $adminmenu->class = $this->input->post('class');
         $adminmenu->li_class = $this->input->post('li_class');
         if ($adminmenu->save(array('parentmenu' => $parentmenu))) {
             redirect($this->admin . 'adminmenus/list_all/');
         }
     }
     $parentmenu = new adminmenu();
     $parentmenu->where('parentmenu_id', NULL);
     if ($adminmenu->exists()) {
         $parentmenu->where('id !=', $adminmenu->id);
     }
     $parentmenu->order_by('position', 'asc');
     $parentmenu->get();
     $dis['base_url'] = base_url();
     $dis['parentmenu'] = $parentmenu;
     $dis['title'] = "Menu";
     $dis['menu_active'] = "Adminmenu";
     $dis['view'] = "adminmenu/edit";
     $dis['object'] = $adminmenu;
     $this->viewadmin($dis);
 }
Beispiel #2
0
 function down_position()
 {
     $min = new adminmenu();
     $min->select_min('position');
     $min->where('position >', $this->position);
     $min->where('parentmenu_id', $this->parentmenu->id);
     $min->get();
     $o = new adminmenu();
     $o->where('position', $min->position);
     $o->where('parentmenu_id', $this->parentmenu->id);
     $o->get();
     if ($o->result_count() > 0) {
         $tg = $this->position;
         $this->position = $o->position;
         $o->position = $tg;
         $o->save();
         $this->save();
         return true;
     } else {
         return false;
     }
 }