summaryrefslogtreecommitdiff
path: root/app/Controller/Timetableday.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller/Timetableday.php')
-rw-r--r--app/Controller/Timetableday.php88
1 files changed, 0 insertions, 88 deletions
diff --git a/app/Controller/Timetableday.php b/app/Controller/Timetableday.php
deleted file mode 100644
index c8f7ac8a..00000000
--- a/app/Controller/Timetableday.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-namespace Controller;
-
-/**
- * Day Timetable controller
- *
- * @package controller
- * @author Frederic Guillot
- */
-class Timetableday extends User
-{
- /**
- * Display timetable for the user
- *
- * @access public
- */
- public function index(array $values = array(), array $errors = array())
- {
- $user = $this->getUser();
-
- $this->response->html($this->layout('timetable_day/index', array(
- 'timetable' => $this->timetableDay->getByUser($user['id']),
- 'values' => $values + array('user_id' => $user['id']),
- 'errors' => $errors,
- 'user' => $user,
- )));
- }
-
- /**
- * Validate and save
- *
- * @access public
- */
- public function save()
- {
- $values = $this->request->getValues();
- list($valid, $errors) = $this->timetableDay->validateCreation($values);
-
- if ($valid) {
-
- if ($this->timetableDay->create($values['user_id'], $values['start'], $values['end'])) {
- $this->session->flash(t('Time slot created successfully.'));
- $this->response->redirect($this->helper->url->to('timetableday', 'index', array('user_id' => $values['user_id'])));
- }
- else {
- $this->session->flashError(t('Unable to save this time slot.'));
- }
- }
-
- $this->index($values, $errors);
- }
-
- /**
- * Confirmation dialag box to remove a row
- *
- * @access public
- */
- public function confirm()
- {
- $user = $this->getUser();
-
- $this->response->html($this->layout('timetable_day/remove', array(
- 'slot_id' => $this->request->getIntegerParam('slot_id'),
- 'user' => $user,
- )));
- }
-
- /**
- * Remove a row
- *
- * @access public
- */
- public function remove()
- {
- $this->checkCSRFParam();
- $user = $this->getUser();
-
- if ($this->timetableDay->remove($this->request->getIntegerParam('slot_id'))) {
- $this->session->flash(t('Time slot removed successfully.'));
- }
- else {
- $this->session->flash(t('Unable to remove this time slot.'));
- }
-
- $this->response->redirect($this->helper->url->to('timetableday', 'index', array('user_id' => $user['id'])));
- }
-}