private function getAccess() { if ($GLOBALS['config']['superadmin'] == $_SESSION['username']) { $this->accesslist = Common::infinate(App::find()->toArray()); } else { $arr = array(); $acc = Permission::find('did=' . $this->depart); if ($acc) { foreach ($acc as $v) { array_push($arr, $v->app->toArray()); } } $this->accesslist = Common::infinate($arr); } }
public function permissionAction() { //权限管理 $did = intval($this->dispatcher->getParam(0)); if (!$did) { $this->view->disable(); echo "<script>alert('选择部门出错');history.back();</script>"; } if ($this->request->isPost()) { $this->modelsManager->executeQuery("delete from Backend\\Models\\Permission where did=:did:", array('did' => $did)); foreach ($_POST['app'] as $v) { $model = new Permission(); $model->setAid($v); $model->setDid($did); $model->create(); } } $perm = App::find('active=1'); $arr = array(); $acc = Permission::find('did=' . $did); if ($acc) { foreach ($acc as $v) { array_push($arr, $v->aid); } } $list = infinate($perm->toArray(), 0, $arr); $this->view->list = $list; }