public function GET__0()
 {
     $repo = new TimetableRepository();
     $template = $this->includeTemplate('dashboard/timetable_list');
     $template->timetables = $repo->listAll();
     $template->render();
 }
Esempio n. 2
0
 /**
  * @param string $date in format yyyy-mm-dd
  * @param int $lastModified
  * @return News
  */
 public function getNews($date, $lastModified)
 {
     $now = time();
     $replacements = new ReplacementsRepository();
     $luckyNumbers = new LuckyNumberRepository();
     $timetables = new TimetableRepository();
     $bells = new BellsRepository();
     $settings = new SettingRepository();
     $news = new News();
     $news->timestamp = $now;
     $news->replacements = $replacements->getByDateAndLastModified($date, $lastModified);
     $news->luckyNumbers = $luckyNumbers->getByDateAndLastModified($date, $lastModified);
     $news->timetables = $timetables->getByLastModified($lastModified);
     $news->bells = $bells->getByLastModified($lastModified);
     $news->version = (int) $settings->get('version');
     return $news;
 }
 public function PUT_timetables_1($class)
 {
     if (!Auth::isAuthenticated()) {
         Json::unauthorized();
     }
     $value = json_decode(file_get_contents('php://input'));
     $error = Timetable::validateValue($value);
     if ($error !== null) {
         Json::badRequest($error);
     }
     $repo = new TimetableRepository();
     if ($repo->setValue($class, $value)) {
         Json::OK(['message' => 'Saved']);
     } else {
         Json::internalServerError();
     }
 }