Beispiel #1
0
 public function validateAttribute($model, $attribute)
 {
     $hash = $model->{$attribute};
     $res = $this->onlyOne ? Hashids::decodeOne($hash) : Yii::$app->hashids->decode($hash);
     if (!$res) {
         $this->addError($model, $attribute, 'This hash can not be decoded');
         return;
     }
     if ($this->targetAttribute) {
         $model->{$this->targetAttribute} = $res;
     }
 }
 public function actionKimTekst($kim)
 {
     $kim = Hashids::decodeOne($kim);
     if (!$kim) {
         throw new NotFoundHttpException();
     }
     $kimRecord = Kim::findOne($kim);
     if (!$kimRecord) {
         throw new NotFoundHttpException();
     }
     //todo check access ability
     return $this->render('kim_tekst', compact('kimRecord'));
 }
Beispiel #3
0
 public function actionSlushateli($kurs)
 {
     $kurs = Hashids::decodeOne($kurs);
     if (!$kurs) {
         throw new NotFoundHttpException();
     }
     $model = Kurs::findOne($kurs);
     if (!$model) {
         throw new NotFoundHttpException();
     }
     //todo with()
     $query = FizLico::findSlushateliKursa($kurs)->andWhere(['kurs_fiz_lica.status' => StatusKursaFizLica::ZAPISAN])->orderBy('id');
     $data = new ActiveDataProvider(['query' => $query, 'key' => 'hashids', 'pagination' => false, 'sort' => false]);
     return $this->render('slushateli', compact('data', 'model'));
 }