/** * Function get query filter * @param $messageid * @return ActiveQuery object */ public static function getQuery($messageId) { $filter = new Filter(); $filter->load(\Yii::$app->request->get()); $filter->validate(); $data = Profiler::find()->andWhere(['message_id' => $messageId])->andWhere(['>=', 'date_create', $filter->date_create_from])->andWhere(['<', 'date_create', $filter->date_create_to . ' 23:59']); return $data; }
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()]); }