Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Events::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['event_id' => $this->event_id, 'event_start_date' => $this->event_start_date, 'event_end_date' => $this->event_end_date, 'event_type' => $this->event_type, 'event_all_day' => $this->event_all_day, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'event_title', $this->event_title])->andFilterWhere(['like', 'event_detail', $this->event_detail])->andFilterWhere(['like', 'event_url', $this->event_url]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function actionViewEvents($start = NULL, $end = NULL, $_ = NULL)
 {
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $eventList = Events::find()->where(['is_status' => 0])->all();
     $events = [];
     foreach ($eventList as $event) {
         $Event = new \yii2fullcalendar\models\Event();
         $Event->id = $event->event_id;
         $Event->title = $event->event_title;
         $Event->description = $event->event_detail;
         $Event->start = $event->event_start_date;
         $Event->end = $event->event_end_date;
         $Event->color = $event->event_type == 1 ? '#00A65A' : ($event->event_type == 2 ? '#00C0EF' : ($event->event_type == 3 ? '#F39C12' : '#074979'));
         $Event->textColor = '#FFF';
         $Event->borderColor = '#000';
         $Event->event_type = $event->event_type == 1 ? 'Holiday' : ($event->event_type == 2 ? 'Important Notice' : ($event->event_type == 3 ? 'Meeting' : 'Messages'));
         $Event->allDay = $event->event_all_day == 1 ? true : false;
         // $Event->url = $event->event_url;
         $events[] = $Event;
     }
     return $events;
 }