Example #1
3
 public function actionExportArrivals($id)
 {
     if (!Yii::$app->user->isGuest && Yii::$app->user->identity->isadmin) {
         $model = Flights::find()->andWhere(['airport_id' => $id, 'isarrival' => 1])->all();
         if (!$model) {
             $model = new Flights();
         }
         \moonland\phpexcel\Excel::export(['models' => $model, 'fileName' => 'arrivals.xlsx', 'format' => 'Excel2007', 'columns' => ['airline', 'flightnumber', 'gate', 'aircraft', 'icaofrom', 'timefrom', 'timeto'], 'headers' => ['airline' => 'Airline', 'flightnumber' => 'Flight', 'gate' => 'Gate', 'aircraft' => 'Aircraft', 'icaofrom' => 'From', 'timefrom' => 'Departure', 'timeto' => 'Arrival']]);
     }
 }
Example #2
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');
     }
 }
Example #3
0
 public function actionGettrnflight()
 {
     $id = Yii::$app->request->post('id');
     $f = Flights::find()->andWhere(['turnaround_id' => $id])->asArray()->one();
     echo json_encode($f);
 }