示例#1
0
 public function act_deletePowerGroup()
 {
     $gid = isset($_GET['gid']) ? abs(intval($_GET['gid'])) : 0;
     if (!$gid) {
         //未指定id
         self::$errCode = 0;
         self::$errMsg = '未指定分组';
         return;
     }
     $groupmodel = new PowerActionGroupModel();
     $groupmodel->deletGroup($gid);
     self::$errCode = 1;
     self::$errMsg = '删除成功';
     return;
 }
示例#2
0
 public function act_powerValidateUnique()
 {
     $gid = isset($_GET['gid']) ? abs(intval($_GET['gid'])) : 0;
     $powercode = isset($_GET['code']) ? trim($_GET['code']) : 0;
     if (empty($gid)) {
         //未指定所属组
         self::$errCode = 0;
         self::$errMsg = '未指定所属组!';
         return;
     }
     if (empty($powercode)) {
         //没有指定权限代码
         self::$errCode = 0;
         self::$errMsg = '未指定代码!';
         return;
     }
     $groupmode = new PowerActionGroupModel();
     $row = $groupmode->getGroupInfoById($gid);
     if (empty($row)) {
         //组id不正确
         self::$errCode = 0;
         self::$errMsg = '指定组不存在!';
         return;
     }
     $powermodel = new powerActionModel();
     $isexist = $powermodel->checkCodeExist($gid, $powercode);
     if ($isexist) {
         self::$errCode = 0;
         self::$errMsg = '改代码已使用,请重填!';
         return;
     } else {
         self::$errCode = 1;
         self::$errMsg = 'OK!';
         return;
     }
 }
示例#3
0
 public function view_searchgroup()
 {
     // $key = isset($_GET['keywords']) ? trim($_GET['keywords']) : '';
     $key = isset($_POST['keywords']) ? trim($_POST['keywords']) : '';
     if (strlen($key) == 0) {
         //传入了空值
         $urldata = array('msg' => array('请输入要搜索的关键字'), 'link' => 'index.php?mod=powergroup&act=grouplist');
         $urldata = urlencode(json_encode($urldata));
         header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
         exit;
     }
     $groupmodel = new PowerActionGroupModel();
     $result = $groupmodel->searchGroup($key);
     //var_dump($result);
     $this->tp_obj->set_file('powerpagese', 'powergroup_search.html');
     //主模板
     $location_ar = array('<a href="index.php?mod=poweruser&act=list" class="navhref">权限管理</a>', '>', '<a href="index.php?mod=powergroup&act=grouplist" class="navhref">权限组管理</a>', '>', '<span class="navlast">权限组搜索</span>', '>', '【' . "{$key}" . '】');
     $this->tp_obj->set_var('keywords', $key);
     $this->tp_obj->set_var('pagehtml', $showpage);
     $this->tp_obj->set_file('header', 'header.html');
     $this->tp_obj->set_file('footer', 'footer.html');
     $this->tp_obj->set_file('navbar', 'transmanagernav.html');
     $this->tp_obj->set_file('powerleftmenu', 'powerleftmenu.html');
     $this->tp_obj->set_block('navbar', 'navlist', 'locationlist');
     //导航
     foreach ($location_ar as $lval) {
         $this->tp_obj->set_var('location', $lval);
         $this->tp_obj->parse('locationlist', 'navlist', TRUE);
     }
     $this->tp_obj->set_block('powerpagese', 'grouplist', 'glist');
     //权限组列表
     foreach ($result as $gval) {
         $this->tp_obj->set_var('gid', $gval['id']);
         $this->tp_obj->set_var('gname', $gval['groupname']);
         $this->tp_obj->set_var('gnamezh', $gval['groupnamezh']);
         $this->tp_obj->set_var('updatetime', date('Y-m-d H:i:s', $gval['lastupdatetime']));
         $this->tp_obj->parse('glist', 'grouplist', true);
     }
     $this->tp_obj->set_var('username', $_SESSION['userName']);
     $this->tp_obj->parse('header', 'header');
     $this->tp_obj->parse('footer', 'footer');
     $this->tp_obj->parse('powerleftmenu', 'powerleftmenu');
     $this->tp_obj->parse('powerpage', 'powerpagese');
     $this->tp_obj->p('powerpage');
 }
示例#4
0
 public function view_searchpower()
 {
     $group = isset($_POST['group']) ? abs(intval($_POST['group'])) : 0;
     if (!$group) {
         //为指定组 报错
         $urldata = array('msg' => array('要指定所属组!'), 'link' => 'index.php?mod=power&act=powerlist');
         $urldata = urlencode(json_encode($urldata));
         header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
         exit;
     }
     $key = isset($_POST['keywords']) ? trim($_POST['keywords']) : '';
     if (strlen($key) == 0) {
         //传入了空值
         $urldata = array('msg' => array('请输入要搜索的关键字'), 'link' => 'index.php?mod=power&act=powerlist');
         $urldata = urlencode(json_encode($urldata));
         header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
         exit;
     }
     $powermodel = new powerActionModel();
     $result = $powermodel->searchPower($group, $key);
     $this->tp_obj->set_file('powerpagese', 'power_search.html');
     //主模板
     $location_ar = array('<a href="index.php?mod=poweruser&act=list" class="navhref">授权管理</a>', '>', '<a href="index.php?mod=power&act=powerlist" class="navhref">权限管理</a>', '>', '权限搜索', '>', $key);
     $this->tp_obj->set_var('pagehtml', $showpage);
     $this->tp_obj->set_var('keywords', $key);
     $this->tp_obj->set_file('header', 'header.html');
     $this->tp_obj->set_file('footer', 'footer.html');
     $this->tp_obj->set_file('navbar', 'transmanagernav.html');
     $this->tp_obj->set_file('powerleftmenu', 'powerleftmenu.html');
     $this->tp_obj->set_block('navbar', 'navlist', 'locationlist');
     //导航
     foreach ($location_ar as $lval) {
         $this->tp_obj->set_var('location', $lval);
         $this->tp_obj->parse('locationlist', 'navlist', TRUE);
     }
     $groupmodel = new PowerActionGroupModel();
     $garray = $groupmodel->getAllPowerGroupList();
     $this->tp_obj->set_block('powerpagese', 'gplist', 'gxlist');
     foreach ($garray as $val) {
         $this->tp_obj->set_var('gid', $val['id']);
         if ($val['id'] == $group) {
             $this->tp_obj->set_var('isselect', 'selected="selected"');
         } else {
             $this->tp_obj->set_var('isselect', '');
         }
         $this->tp_obj->set_var('text', $val['groupname']);
         $this->tp_obj->parse('gxlist', 'gplist', TRUE);
     }
     $this->tp_obj->set_block('powerpagese', 'grouplist', 'glist');
     //权限列表
     foreach ($result as $gval) {
         $this->tp_obj->set_var('id', $gval['id']);
         $this->tp_obj->set_var('gname', $gval['groupname']);
         $this->tp_obj->set_var('name', $gval['actcode']);
         $this->tp_obj->set_var('desc', $gval['actnamezh']);
         $this->tp_obj->set_var('updatetime', date('Y-m-d H:i:s', $gval['lastupdatetime']));
         $this->tp_obj->parse('glist', 'grouplist', true);
     }
     $this->tp_obj->set_var('username', $_SESSION['userName']);
     $this->tp_obj->parse('header', 'header');
     $this->tp_obj->parse('footer', 'footer');
     $this->tp_obj->parse('powerleftmenu', 'powerleftmenu');
     $this->tp_obj->parse('powerpage', 'powerpagese');
     $this->tp_obj->p('powerpage');
 }
示例#5
0
 public function translatePowerList($powerlist)
 {
     $power = array();
     $groupmodel = new PowerActionGroupModel();
     $powermodel = new powerActionModel();
     foreach ($powerlist as $key => $value) {
         $group = $groupmodel->getGroupInfoById($key);
         $power[$group['groupname']] = array();
         foreach ($value as $v) {
             $powerinfo = $powermodel->getPowerInfoById($v);
             $power[$group['groupname']][] = $powerinfo['actcode'];
         }
     }
     return $power;
 }
示例#6
0
 public function view_powerEditSubmit()
 {
     $actlist = $_POST['action'];
     $userid = isset($_POST['userid']) ? abs(intval($_POST['userid'])) : 0;
     if (empty($userid)) {
         //没有指定用户id
         $urldata = array('msg' => array('没有指定要编辑的用户!'), 'link' => 'index.php?mod=poweruser&act=list');
         $urldata = urlencode(json_encode($urldata));
         header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
         exit;
     }
     //var_dump($actlist);
     $groupmodel = new PowerActionGroupModel();
     $actmodel = new powerActionModel();
     /* 验证数据 */
     $dataok = TRUE;
     //var_dump($actlist);exit;
     foreach ($actlist as $key => $value) {
         $groupinfo = $groupmodel->getGroupInfoById($key);
         if (empty($groupinfo)) {
             //没找到改组的信息 数据验证失败 退出循环
             $dataok = FALSE;
             break;
         }
         foreach ($value as $actval) {
             $actinfo = $actmodel->getPowerInfoById($actval);
             if (empty($actinfo)) {
                 //没找到对应的action信息 数据验证失败
                 $dataok = FALSE;
                 break;
             }
         }
         if ($dataok === FALSE) {
             //数据验证失败 退出循环
             break;
         }
     }
     if ($dataok === FALSE) {
         $urldata = array('msg' => array('提交数据不正确'), 'link' => 'index.php?mod=poweruser&act=list');
         $urldata = urlencode(json_encode($urldata));
         header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
         exit;
     }
     $usermanager = new localUserManageModel();
     $usermanager->updateUserPower($actlist, $userid);
     $urldata = array('msg' => array('更新成功'), 'link' => 'index.php?mod=poweruser&act=list');
     $urldata = urlencode(json_encode($urldata));
     header('location:index.php?mod=showerror&act=showok&data=' . $urldata);
     exit;
 }