/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Event::find()->indexBy('id'); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'allDay' => $this->allDay, 'editable' => $this->editable, 'startEditable' => $this->startEditable, 'durationEditable' => $this->durationEditable, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'start', $this->start])->andFilterWhere(['like', 'end', $this->end])->andFilterWhere(['like', 'created_at', $this->created_at])->andFilterWhere(['like', 'updated_at', $this->updated_at])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'dow', $this->dow])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'className', $this->className])->andFilterWhere(['like', 'source', $this->source])->andFilterWhere(['like', 'color', $this->color])->andFilterWhere(['like', 'backgroundColor', $this->backgroundColor])->andFilterWhere(['like', 'borderColor', $this->borderColor])->andFilterWhere(['like', 'textColor', $this->textColor]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Event::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(['id' => $this->id, 'created_date' => $this->created_date]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
public function actionIndex() { $events = Event::find()->all(); $tasks = []; foreach ($events as $eve) { $event = new \yii2fullcalendar\models\Event(); $event->id = $eve->id; $event->backgroundColor = 'red'; $event->title = $eve->title; $event->start = $eve->created_date; $tasks[] = $event; } return $this->render('index', ['events' => $tasks]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Event::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_no' => $this->event_no, 'start_date_time' => $this->start_date_time, 'end_date_time' => $this->end_date_time]); $query->andFilterWhere(['like', 'venue', $this->venue])->andFilterWhere(['like', 'type', $this->type]); return $dataProvider; }
/** * Lists all Event models. * @return mixed */ public function actionIndex() { // $searchModel = new EventSearch(); // $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $events = Event::find()->all(); $tasks = []; foreach ($events as $eve) { $event = new \yii2fullcalendar\models\Event(); $event->id = $eve->id; $event->title = $eve->title; $event->start = $eve->created_date; $tasks[] = $event; } return $this->render('index', ['events' => $tasks]); }
/** * Lists all Event models. * @return mixed */ public function actionIndex() { $events = Event::find()->all(); $eventos = []; foreach ($events as $event) { $Event = new \yii2fullcalendar\models\Event(); $Event->id = $event->id; $Event->className = 'btn'; $Event->backgroundColor = 'gray'; $Event->borderColor = 'black'; $Event->title = $event->title; $Event->start = $event->created_date; $eventos[] = $Event; } return $this->render('index', ['events' => $eventos]); }
public function actionSample() { //$objPHPExcel = new \PHPExcel(); $template = Util::templateExcel(); $model = new Event(); $date = date('YmdHis'); $name = $date . 'Event'; //$attributes = $model->attributeLabels(); $models = Event::find()->all(); $excelChar = Util::excelChar(); $not = Util::excelNot(); foreach ($model->attributeLabels() as $k => $v) { if (!in_array($k, $not)) { $attributes[$k] = $v; } } $objReader = \PHPExcel_IOFactory::createReader('Excel5'); $objPHPExcel = $objReader->load(Yii::getAlias($template)); return $this->render('sample', ['models' => $models, 'attributes' => $attributes, 'excelChar' => $excelChar, 'not' => $not, 'name' => $name, 'objPHPExcel' => $objPHPExcel]); }