public function agenda($id) { $this->data['title'] = 'Agenda'; $this->data['agendalist'] = Models\Agenda::find($id); return view('front.agenda', $this->data); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $agenda = Agenda::find($id); if ($agenda->delete()) { return response()->json(array('success' => TRUE)); } }
public function showAgenda() { $model = new Slot(); $exist = Agenda::find()->where(['agendaID' => $this->agendaID])->one(); $permAgendaID = Agenda::find()->where(['owner' => $exist['owner'], 'type' => 'perm'])->one(); $tempSlotIDs = array(); if ($exist['type'] == 'temp') { $tempSlotIDs = $model->getIDs($this->agendaID); } $permSlotIDs = $model->getIDs($permAgendaID['agendaID']); $permindex = 0; $tempindex = 0; $agendforShow = array(); $index = 0; while ($permindex < sizeof($permSlotIDs) && $tempindex < sizeof($tempSlotIDs)) { if ($tempSlotIDs[$tempindex]['slotnum'] == $permSlotIDs[$permindex]['slotnum']) { $agendforShow[$index]['slotID'] = $tempSlotIDs[$tempindex]['slotID']; $agendforShow[$index]['maxBookers'] = $tempSlotIDs[$tempindex]['numberOfBookers']; $agendforShow[$index]['content'] = $tempSlotIDs[$tempindex]['content']; $count = Book::find()->where(['slotID' => $agendforShow[$index]['slotID'], 'date' => $exist['lastUpdate']])->count(); $agendforShow[$index]['bookCount'] = $count; $tempindex++; $index++; } else { $agendforShow[$index]['slotID'] = $permSlotIDs[$permindex]['slotID']; $agendforShow[$index]['maxBookers'] = $permSlotIDs[$permindex]['numberOfBookers']; $agendforShow[$index]['content'] = $permSlotIDs[$permindex]['content']; $count = Book::find()->where(['slotID' => $agendforShow[$index]['slotID'], 'date' => $exist['lastUpdate']])->count(); $agendforShow[$index]['bookCount'] = $count; $index++; } $permindex++; } while ($tempindex < sizeof($tempSlotIDs)) { $agendforShow[$index]['slotID'] = $tempSlotIDs[$tempindex]['slotID']; $agendforShow[$index]['maxBookers'] = $tempSlotIDs[$tempindex]['numberOfBookers']; $agendforShow[$index]['content'] = $tempSlotIDs[$tempindex]['content']; $count = Book::find()->where(['slotID' => $agendforShow[$index]['slotID'], 'date' => $exist['lastUpdate']])->count(); $agendforShow[$index]['bookCount'] = $count; $tempindex++; $index++; } while ($permindex < sizeof($permSlotIDs)) { $agendforShow[$index]['slotID'] = $permSlotIDs[$permindex]['slotID']; $agendforShow[$index]['maxBookers'] = $permSlotIDs[$permindex]['numberOfBookers']; $agendforShow[$index]['content'] = $permSlotIDs[$permindex]['content']; $count = Book::find()->where(['slotID' => $agendforShow[$index]['slotID'], 'date' => $exist['lastUpdate']])->count(); $agendforShow[$index]['bookCount'] = $count; $permindex++; $index++; } return $agendforShow; }
public function actionIsException() { $owner = $_POST['owner']; $lastUpdate = $_POST['date']; $exist = Agenda::find()->select('lastUpdate')->where(['owner' => $owner, 'type' => 'temp', 'lastUpdate' => $lastUpdate])->asArray()->all(); echo json_encode($exist); }