public function searchAll($params) { $today = new DateTime(); $prevWeek = date('d') - 7; $query = DraggableEvent::find()->where('date > :date', [':date' => $today->format('Y-m-d')])->orWhere(['date' => null])->orWhere(['between', 'date', $today->format('Y-m-' . $prevWeek), $today->format('Y-m-d')])->orderBy(['date' => SORT_ASC]); $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 $query->all(); } $query->andFilterWhere(['title' => $this->title, 'description' => $this->description, 'url' => $this->url]); // $query->andFilterWhere(['like', 'status', $this->status]); return $query->all(); }
} } EOF; $JSEventClick = <<<EOF function(calEvent, jsEvent, view) { alert('Event: ' + calEvent.title); alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); } EOF; ?> <div id="external-events"> <h4>Події</h4> <?php $drags = \app\models\DraggableEvent::find()->all(); foreach ($drags as $draggable) { echo '<div class="fc-event ui-draggable ui-draggable-handle">'; echo $draggable->title; echo '</div>'; } ?> <div class="fc-event ui-draggable ui-draggable-handle">Event 1</div> <div class="fc-event ui-draggable ui-draggable-handle">Event 2</div> <div class="fc-event ui-draggable ui-draggable-handle">Event 3</div> <div class="fc-event ui-draggable ui-draggable-handle">Event 4</div> <div class="fc-event ui-draggable ui-draggable-handle">Event 5</div> <p> <input type="checkbox" id="drop-remove"> <label for="drop-remove">Видалити після додавання</label> </p>
public function actionDelete($id) { DraggableEvent::findOne($id)->delete(); return $this->redirect(['index']); }
/** * Finds the DraggableEvent model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return DraggableEvent the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = DraggableEvent::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }