Exemple #1
0
 /**
  * @description  编辑管理员页面
  * @author
  * @final
  * @param int $id 管理员id
  */
 public function edit($id = 0)
 {
     if (!$this->check_power('cpuser_manage')) {
         return;
     }
     $id = intval($id);
     $id && ($cpuser = CpUserModel::get_cpuser($id));
     if (empty($cpuser)) {
         message('管理员不存在');
         return;
     }
     //$data['subjects'] = C('subject');
     $data['role_list'] = RoleModel::get_role_list();
     /*
      * 获取管理员的角色节点
      */
     $old_data = $this->db->query("select role_id from {pre}admin_role where admin_id=" . $id)->result_array();
     $tmp_data = array();
     foreach ($old_data as $val) {
         $tmp_data[] = $val['role_id'];
     }
     $data['roleIds'] = $tmp_data;
     $data['cpuser'] = $cpuser;
     $data['is_cpuser'] = $cpuser['admin_id'] == $this->session->userdata('admin_id');
     // 模版
     $this->load->view('cpuser/edit', $data);
 }