Example #1
0
 public function actionDetail($id)
 {
     $profiler = $this->findProfiler($id);
     LastActiveDate::getModel(LastActiveDate::TYPE_PROFILER)->setData((int) $id)->setUserId(\Yii::$app->user->id)->save();
     $project = Project::findOne($profiler->project_id);
     if (!$project) {
         throw new NotFoundHttpException('Проект профайлера не найден');
     }
     \Yii::$app->getView()->params['leftMenu']['active'] = "profiler_{$profiler->id}";
     $data = new ActiveDataProvider(['query' => DurationGraph::getQuery($id), 'pagination' => ['pageSize' => self::PAGE_SIZE], 'sort' => false]);
     return $this->render('detail.tpl', ['model' => $project, 'profiler' => $profiler, 'data' => $data, 'totalMessage' => Profiler::find()->where(['message_id' => $id])->count(), 'total' => ListProfiler::find()->where(['project_id' => $project->id])->count()]);
 }
Example #2
0
 /**
  * Получение модели проекта
  * @param $id
  * @return null|static
  * @throws NotFoundHttpException
  */
 protected function findModel($id)
 {
     if (($model = Project::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Проект не найден');
     }
 }