Exemplo n.º 1
0
 public function actionIndex()
 {
     if (!\Yii::$app->user->isGuest) {
         $flights = new ActiveDataProvider(['query' => Flights::find()->andWhere(['vid' => \Yii::$app->user->identity->vid]), 'pagination' => false, 'sort' => false]);
         $slots = new ActiveDataProvider(['query' => Slots::find()->andWhere(['vid' => \Yii::$app->user->identity->vid]), 'pagination' => false, 'sort' => false]);
         return $this->render('my_reservations', ['flights' => $flights, 'slots' => $slots]);
     } else {
         return $this->redirect('/site/login');
     }
 }
Exemplo n.º 2
0
 public function getTurn()
 {
     return $this->turnaround_id ? $this->hasOne(Flights::className(), ['id' => 'turnaround_id']) : null;
 }
Exemplo n.º 3
0
 public function actionGettrnflight()
 {
     $id = Yii::$app->request->post('id');
     $f = Flights::find()->andWhere(['turnaround_id' => $id])->asArray()->one();
     echo json_encode($f);
 }
Exemplo n.º 4
0
 public function actionCancel($id)
 {
     if (!Yii::$app->user->isGuest) {
         $model = Flights::findOne($id);
         if ($model->vid == Yii::$app->user->identity->vid) {
             $model->vid = null;
             $model->save();
         }
         $this->redirect(Yii::$app->user->returnUrl);
     }
 }