예제 #1
0
 if (isset($_POST['addEvent']) && isset($_POST['calendarId']) && strlen($_POST['calendarId'])) {
     // event creator
     $site_title .= ' | Esemény';
     $event_date_ts = strtotime('tomorrow 12:00:00');
     $event_date_output = date('Y.m.d. H:i', $event_date_ts);
     $event_name = 'DummyEvent ' . mt_rand(100, 2000);
     $event_result = $calendar->createDummyEvent($_POST['calendarId'], $event_date_ts, $event_name);
     if ($event_result != CalendarModel::NO_ERRORS) {
         $site_title .= ' | Hiba';
         $template = file_get_contents(VIEW_PATH . 'error.html');
     } else {
         $template = str_replace(array('[EVENT_NAME]', '[EVENT_DATE]'), array($event_name, $event_date_output), file_get_contents(VIEW_PATH . 'event.html'));
     }
 } else {
     // listing
     $calendars = $calendar->getCalendars();
     if ($calendars[0] != CalendarModel::NO_ERRORS) {
         $site_title .= ' | Hiba';
         $template = file_get_contents(VIEW_PATH . 'error.html');
     } elseif (!count($calendars[1])) {
         $site_title .= ' | Naptárak';
         $template = file_get_contents(VIEW_PATH . 'listing_noitems.html');
     } else {
         $site_title .= ' | Naptárak';
         $list = '';
         $options = '';
         foreach ($calendars[1] as $cal) {
             $list .= '<div class="calendar-row">' . $cal->getSummary() . '</div>';
             $options .= '<option value="' . $cal->getId() . '">' . $cal->getSummary() . '</option>';
         }
         $template = str_replace(array('[CALENDAR_LIST]', '[CALENDAR_LIST_OPTIONS]'), array($list, $options), file_get_contents(VIEW_PATH . 'listing.html'));