public function actionIndex() { $searchModel = new IssueSearch(); if (is_null(Yii::$app->authManager->getAssignment(User::ROLE_ADMIN, Yii::$app->user->getId()))) { $searchModel->assignee_id = Yii::$app->user->getId(); } $dataProvider = $searchModel->search(\Yii::$app->request->get()); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionIndex($id) { $project = $this->loadModel('app\\models\\Project', $id); if (!\Yii::$app->user->can('viewProject', ['project' => $project])) { throw new ForbiddenHttpException('Access denied'); } $this->view->params['appSettings'] = ['app_name' => $project->title]; $searchModel = new IssueSearch(); $searchModel->project_id = $project->id; $dataProvider = $searchModel->search(\Yii::$app->request->queryParams); if (\Yii::$app->request->post('hasEditable') && !\Yii::$app->user->isGuest) { $model = Issue::findOne(['id' => (int) \Yii::$app->request->post('editableKey')]); $out = Json::encode(['output' => '', 'message' => '']); $post = current(\Yii::$app->request->post('Issue')); if (isset($post['status_id'])) { $model->status_id = (int) $post['status_id']; $output = StatusEnum::i()->getMap()[$post['status_id']]; $this->sendMessage($model, ['subject' => \Yii::t('app', 'Issue Status Changed'), 'view' => 'changeStatus']); } if (isset($post['priority_id'])) { $model->priority_id = (int) $post['priority_id']; $output = PriorityEnum::i()->getMap()[$post['priority_id']]; } if (isset($post['assignee_id'])) { if ($post['assignee_id']) { $model->assignee_id = (int) $post['assignee_id']; $output = \app\models\Project::getAssigneeOptions($project->id)[$post['assignee_id']]; $this->sendMessage($model); } else { $model->assignee_id = null; $output = '<i>(' . \Yii::t('app', 'not set') . ')</i>'; } } if ($model->save()) { $out = Json::encode(['output' => $output, 'message' => '']); } echo $out; return; } return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'project' => $project]); }
/** * Lists all Issue models. * @return mixed */ public function actionIndex() { $searchModel = new IssueSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }