Esempio n. 1
0
 /**
  +----------------------------------------------------------
 * 添加管理员
  +----------------------------------------------------------
 */
 public function addAdmin()
 {
     if (IS_POST) {
         //保存账户
         $this->checkToken();
         $acmod = new AccessModel();
         $info = $acmod->addAdmin();
         if ($info['status'] == 1) {
             $this->success($info['info'], $info['url']);
         } else {
             $this->error($info['info']);
         }
     } else {
         parent::_initalize();
         $systemConfig = $this->systemConfig;
         $this->assign("systemConfig", $systemConfig);
         //省市
         $cmod = new CityModel();
         #$city_list=$cmod->citylist();
         #print_r($city_list);exit;
         $city_list = $cmod->getprovince(1);
         $this->assign("pro_list", $city_list);
         $this->assign("info", $this->getRoleListOption(array('role_id' => 0)));
         $this->display();
     }
 }
Esempio n. 2
0
 public function actionAccess($id)
 {
     $nodes = new RolesModel();
     $this->template->nodes = $nodes;
     $this->template->parents = $nodes->getChildNodes(NULL);
     $role = dibi::fetch('SELECT key_name, name FROM [' . TABLE_ROLES . '] WHERE id=%i;', $id);
     $this->template->role = $role->name;
     $access = new AccessModel(array($role));
     $this->template->access = $access->getAccess();
 }
Esempio n. 3
0
 public function actionAccess($id)
 {
     $nodes = new RolesModel();
     $this->template->nodes = $nodes;
     $this->template->parents = $nodes->getChildNodes(NULL);
     $user = dibi::fetchSingle('SELECT login FROM [' . TABLE_USERS . '] WHERE id=%i;', $id);
     $this->template->user_name = $user;
     $roles = dibi::fetchAll('SELECT r.key_name FROM [' . TABLE_ROLES . '] AS r
                                 RIGHT JOIN [' . TABLE_USERS_ROLES . '] AS ur ON r.id=ur.role_id
                                 WHERE ur.user_id=%i;', $id);
     $access = new AccessModel($roles);
     $this->template->access = $access->getAccess();
 }