Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Mission::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 2]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'personal_user_id' => $this->personal_user_id, 'date_start' => $this->date_start, 'date_end' => $this->date_end, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
 public function actionJsoncalendar($start = NULL, $end = NULL, $_ = NULL)
 {
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $times = Mission::find()->all();
     $events = array();
     foreach ($times as $time) {
         //Testing
         $Event = new \yii2fullcalendar\models\Event();
         $Event->id = $time->id;
         $Event->title = $time->title . ' - ' . $time->personal->firstname . ' ' . $time->personal->lastname;
         $Event->start = $time->date_start;
         $Event->end = $time->date_end;
         $Event->color = $time->personal->color;
         $Event->url = Url::to(['/mission/mission/view', 'id' => $time->id]);
         $events[] = $Event;
     }
     return $events;
 }
Beispiel #3
0
 public function findUserModel($id)
 {
     if (($model = Mission::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }