Beispiel #1
0
 function edit($id = 0)
 {
     $this->checkRole(array(1));
     $adminuser = new adminuser($id);
     if ($_SERVER['REQUEST_METHOD'] == "GET") {
     } else {
         $adminuser->username = $this->input->post('username');
         $adminuser->password = trim($this->input->post('password'));
         $adminuser->confirm_password = trim($this->input->post('confirm_password'));
         $adminuser->fullname = $this->input->post('fullname');
         $adminuser->phone = $this->input->post('phone');
         $adminuser->email = $this->input->post('email');
         $adminuser->address = $this->input->post('address');
         $role = new adminrole(trim($this->input->post('adminrole')));
         $adminuser->kfm_username = $this->input->post('kfm_username');
         $adminuser->kfm_password = $this->input->post('kfm_password');
         if ($adminuser->save($role)) {
             redirect($this->admin . 'adminusers/edit/' . $adminuser->id);
         }
     }
     $adminrole = new adminrole();
     $adminrole->where('id !=', 1);
     $adminrole->where('level >=', $this->logged_in_user->adminrole->level);
     $adminrole->get();
     $dis['adminrole'] = $adminrole;
     $dis['base_url'] = base_url();
     $dis['title'] = "Admin User";
     $dis['menu_active'] = "adminuser";
     $dis['view'] = "adminuser/edit";
     $dis['object'] = $adminuser;
     $this->viewadmin($dis);
 }
Beispiel #2
0
 function delete()
 {
     $id = $this->uri->segment(4);
     $adminrole = new adminrole($id);
     if (!$adminrole->exists()) {
         show_404();
     }
     $adminrole->delete();
     redirect($this->admin . 'adminroles/list_all/');
 }