public function actionProgrammaKursa($kurs) { $kurs = Hashids::decodeOne($kurs); if (!$kurs) { throw new NotFoundHttpException(); } /* @var $kursRecord KursExtended */ $kursRecord = KursExtended::findOne($kurs); if (!$kursRecord) { throw new NotFoundHttpException(); } if (!Yii::$app->user->can(Rol::SOTRUDNIK_UCHEBNOGO_OTDELA)) { if ($kursRecord->getAvailableAction()[0] !== KursExtended::AVAILABLE_ACTION_PROGRAMMA) { throw new HttpException(422); } if ($kursRecord->statusProgrammy !== StatusProgrammyKursa::ZAVERSHENA) { return $this->render('programma-kursa-isnt-ready', compact('kursRecord')); } } return $this->render('programma-kursa', compact('kursRecord')); }