/** * Displays a single DcmdGroup model. * @param integer $id * @return mixed */ public function actionView($id) { /* $query = DcmdUserGroup::find()->andWhere("gid=".$id)->asArray()->all(); $users = "uid in (0"; foreach($query as $item) $users = $users.",".$item['uid']; $users .= ")"; $searchModel = new DcmdUserSearch(); $dataProvider = $searchModel->search(array(), $users); */ $group_model = $this->findModel($id); $show_div = "dcmd_group"; if (array_key_exists('show_div', Yii::$app->request->queryParams)) { $show_div = Yii::$app->request->queryParams['show_div']; } ///显示组用户标签 $user_searchModel = new DcmdUserGroupSearch(); $user_dataProvider = $user_searchModel->search(array('gid' => $id)); ///组操作 $cmd_searchModel = new DcmdGroupCmdSearch(); $params = array("DcmdGroupCmdSearch" => array("gid" => $id)); $cmd_dataProvider = $cmd_searchModel->search($params); ///重复操作 $repeat_cmd_searchModel = new DcmdGroupRepeatCmdSearch(); $params = array("DcmdGroupRepeatCmdSearch" => array("gid" => $id)); $repeat_cmd_dataProvider = $repeat_cmd_searchModel->search($params); return $this->render('view', ['model' => $this->findModel($id), 'user_searchModel' => $user_searchModel, 'user_dataProvider' => $user_dataProvider, 'cmd_dataProvider' => $cmd_dataProvider, 'repeat_cmd_dataProvider' => $repeat_cmd_dataProvider, 'gid' => $id, 'show_div' => $show_div, 'is_sys' => $group_model->gtype == 1 ? "none" : ""]); }
/** * Lists all DcmdUserGroup models. * @return mixed */ public function actionIndex($gid) { if (Yii::$app->user->getIdentity()->admin != 1) { Yii::$app->getSession()->setFlash('success', NULL); Yii::$app->getSession()->setFlash('error', "对不起, 你没有权限!"); return $this->redirect(array('index')); } $searchModel = new DcmdUserGroupSearch(array('gid' => $gid)); $dataProvider = $searchModel->search(array('gid' => $gid)); ///Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'gid' => $gid, 'gname' => $this->getGroupName($gid)]); }