Ejemplo n.º 1
0
    function exportFromDatabase($range_id = null, $start = 0, $end = Calendar::CALENDAR_END, $event_types = null, $except = NULL)
    {
        global $_calendar_error, $user;

        if (!$range_id) {
            $range_id = $user->id;
        }
        $calendar = new SingleCalendar($range_id);

        $this->_export($this->_writer->writeHeader());
        $calendar->getEvents($event_types, $start, $end);

        foreach ($calendar->events as $event) {
            $this->_export($this->_writer->write($event));
        }
        $this->count = sizeof($events);

        if ($this->count == 0) {
            $message =  _('Es wurden keine Termine exportiert.');
        } else {
            $message = sprintf(ngettext('Es wurde 1 Termin exportiert', 'Es wurden %s Termine exportiert', $export_driver->getCount()), $export_driver->getCount());
        }
        
        $this->_export($this->_writer->writeFooter());
    }
Ejemplo n.º 2
0
 private function parseUser($id)
 {
     $restrictions = $GLOBALS['user']->id == $id ? array() : array('CLASS' => 'PUBLIC');
     $events = SingleCalendar::getEventList($id, $this->start, $this->start + $this->timespan, null, $restrictions);
     // Prepare termine
     $this->termine = array();
     foreach ($events as $termin) {
         // Adjust title
         if (date("Ymd", $termin->getStart()) == date("Ymd", time())) {
             $title = _("Heute") . date(", H:i", $termin->getStart());
         } else {
             $title = substr(strftime("%a", $termin->getStart()), 0, 2);
             $title .= date(". d.m.Y, H:i", $termin->getStart());
         }
         if ($termin->getStart() < $termin->getEnd()) {
             if (date("Ymd", $termin->getStart()) < date("Ymd", $termin->getEnd())) {
                 $title .= " - " . substr(strftime("%a", $termin->getEnd()), 0, 2);
                 $title .= date(". d.m.Y, H:i", $termin->getEnd());
             } else {
                 $title .= " - " . date("H:i", $termin->getEnd());
             }
         }
         if ($termin->getTitle()) {
             $tmp_titel = htmlReady(mila($termin->getTitle()));
             //Beschneiden des Titels
             $title .= ", " . $tmp_titel;
         }
         // Store for view
         $this->termine[] = array('id' => $termin->id, 'type' => get_class($termin), 'range_id' => $termin->range_id, 'event_id' => $termin->event_id, 'chdate' => $termin->chdate, 'title' => $title, 'description' => $termin->getDescription(), 'room' => $termin->getLocation(), 'info' => array(_('Kategorie') => $termin->toStringCategories(), _('Priorität') => $termin->toStringPriority(), _('Sichtbarkeit') => $termin->toStringAccessibility(), _('Wiederholung') => $termin->toStringRecurrence()));
     }
 }
Ejemplo n.º 3
0
 /**
  * Returns an array with all days between start and end of this SingleCalendar.
  * The keys are the timestamps of the days (12:00) and the values are number
  * of events for a day.
  *
  * @param string $user_id Use the permissions of this user.
  * @param array $restrictions
  * @return array An array with year day as key and number of events per day as value.
  */
 public function getListCountEvents($class_names = null, $user_id = null, $restrictions = null)
 {
     if (!is_array($class_names)) {
         $class_names = array('CalendarEvent', 'CourseEvent', 'CourseCancelledEvent', 'CourseMarkedEvent');
     }
     $end = $this->getEnd();
     $start = $this->getStart();
     $year = date('Y', $start);
     $end_ts = mktime(12, 0, 0, date('n', $end), date('j', $end), date('Y', $end));
     $start_ts = mktime(12, 0, 0, date('n', $start), date('j', $start), date('Y', $start));
     $this->getEvents($class_names)->sortEvents();
     $daylist = array();
     $this->ts = mktime(12, 0, 0, 1, 1, $year);
     foreach ($this->events as $event) {
         if (!$event->havePermission(Event::PERMISSION_CONFIDENTIAL, $user_id)) {
             continue;
         }
         if (!SingleCalendar::checkRestriction($event, $restrictions)) {
             continue;
         }
         $properties = $event->getProperties();
         $rep = $properties['RRULE'];
         $duration = (int) ((mktime(12, 0, 0, date('n', $properties['DTEND']), date('j', $properties['DTEND']), date('Y', $properties['DTEND'])) - mktime(12, 0, 0, date('n', $properties['DTSTART']), date('j', $properties['DTSTART']), date('Y', $properties['DTSTART']))) / 86400);
         // single event or first event
         $lwst = mktime(12, 0, 0, date('n', $properties['DTSTART']), date('j', $properties['DTSTART']), date('Y', $properties['DTSTART']));
         if ($start_ts > $lwst) {
             $adate = $start_ts;
         } else {
             $adate = $lwst;
         }
         $hgst = $lwst + $duration * 86400;
         while ($adate >= $start_ts && $adate <= $end_ts && $adate <= $hgst) {
             $md_date = $adate - date('I', $adate) * 3600;
             $this->countListEvent($properties, $md_date, $properties['DTSTART'], $properties['DTEND'], $daylist);
             $adate += 86400;
         }
         switch ($rep['rtype']) {
             case 'DAILY':
                 if ($rep['ts'] < $start) {
                     // brauche den ersten Tag nach $start an dem dieser Termin wiederholt wird
                     if ($rep['linterval'] == 1) {
                         $adate = $this->ts;
                     } else {
                         $adate = $this->ts + ($rep['linterval'] - ($this->ts - $rep['ts']) / 86400 % $rep['linterval']) * 86400;
                     }
                     while ($adate <= $end_ts && $adate >= $this->ts && $adate <= $rep['expire']) {
                         $hgst = $adate + $duration * 86400;
                         $md_date = $adate;
                         while ($md_date <= $end_ts && $md_date >= $this->ts && $md_date <= $hgst) {
                             $md_date -= 3600 * date('I', $md_date);
                             $this->countListEvent($properties, $md_date, $adate, $hgst, $daylist);
                             $md_date += 86400;
                         }
                         $adate += $rep['linterval'] * 86400;
                     }
                 } else {
                     $adate = $rep['ts'];
                 }
                 while ($adate <= $end_ts && $adate >= $this->ts && $adate <= $rep['expire']) {
                     $hgst = $adate + $duration * 86400;
                     $md_date = $adate;
                     while ($md_date <= $end_ts && $md_date >= $this->ts && $md_date <= $hgst) {
                         $md_date += 3600 * date('I', $md_date);
                         $this->countListEvent($properties, $md_date, $adate, $hgst, $daylist);
                         $md_date += 86400;
                     }
                     $adate += $rep['linterval'] * 86400;
                 }
                 break;
             case 'WEEKLY':
                 if ($properties['DTSTART'] >= $start && $properties['DTSTART'] <= $end) {
                     $lwst = mktime(12, 0, 0, date('n', $properties['DTSTART']), date('j', $properties['DTSTART']), date('Y', $properties['DTSTART']));
                     $hgst = $lwst + $duration * 86400;
                     if ($rep['ts'] != $adate) {
                         $wdate = $lwst;
                         while ($wdate <= $end_ts && $wdate >= $start_ts && $wdate <= $hgst) {
                             //  $md_date = $wdate - date('I', $wdate) * 3600;
                             $this->countListEvent($properties, $wdate, $lwst, $hgst, $daylist);
                             $wdate += 86400;
                         }
                     }
                     $aday = strftime('%u', $lwst) - 1;
                     for ($i = 0; $i < strlen($rep['wdays']); $i++) {
                         $awday = (int) substr($rep['wdays'], $i, 1) - 1;
                         if ($awday > $aday) {
                             $lwst = $lwst + ($awday - $aday) * 86400;
                             $hgst = $lwst + $duration * 86400;
                             $wdate = $lwst;
                             while ($wdate >= $start_ts && $wdate <= $end_ts && $wdate <= $hgst) {
                                 //  $md_date = $wdate - date('I', $wdate) * 3600;
                                 $this->countListEvent($properties, $wdate, $lwst, $hgst, $daylist);
                                 $wdate += 86400;
                             }
                         }
                     }
                 }
                 if ($rep['ts'] < $start) {
                     $adate = $start_ts - (strftime('%u', $start_ts) - 1) * 86400;
                     $adate += ($rep['linterval'] - ($adate - $rep['ts']) / 604800 % $rep['linterval']) * 604800;
                     $adate -= $rep['linterval'] * 604800;
                 } else {
                     $adate = $rep['ts'] + 604800 * $rep['linterval'];
                 }
                 while ($adate >= $properties['DTSTART'] && $adate <= $rep['expire'] && $adate <= $end) {
                     // event is repeated on different week days
                     for ($i = 0; $i < strlen($rep['wdays']); $i++) {
                         $awday = (int) $rep['wdays'][$i];
                         $lwst = $adate + ($awday - 1) * 86400;
                         $hgst = $lwst + $duration * 86400;
                         if ($lwst < $start_ts) {
                             $lwst = $start_ts;
                         }
                         $wdate = $lwst;
                         while ($wdate >= $start_ts && $wdate <= $end_ts && $wdate <= $hgst) {
                             // $md_date = $wdate - date('I', $wdate) * 3600;
                             $this->countListEvent($properties, $wdate, $lwst, $hgst, $daylist);
                             $wdate += 86400;
                         }
                     }
                     $adate += 604800 * $rep['linterval'];
                 }
                 break;
             case 'MONTHLY':
                 $bmonth = ($rep['linterval'] - (($year - date('Y', $rep['ts'])) * 12 - date('n', $rep['ts'])) % $rep['linterval']) % $rep['linterval'];
                 for ($amonth = $bmonth - $rep['linterval']; $amonth <= $bmonth; $amonth += $rep['linterval']) {
                     if ($rep['ts'] < $start) {
                         // is repeated at X. week day of X. month...
                         if (!$rep['day']) {
                             $lwst = mktime(12, 0, 0, $amonth - (($year - date('Y', $rep['ts'])) * 12 + ($amonth - date('n', $rep['ts']))) % $rep['linterval'], 1, $year) + ($rep['sinterval'] - 1) * 604800;
                             $aday = strftime('%u', $lwst);
                             $lwst -= ($aday - $rep['wdays']) * 86400;
                             if ($rep['sinterval'] == 5) {
                                 if (date('j', $lwst) < 10) {
                                     $lwst -= 604800;
                                 }
                                 if (date('n', $lwst) == date('n', $lwst + 604800)) {
                                     $lwst += 604800;
                                 }
                             } else {
                                 if ($aday > $rep['wdays']) {
                                     $lwst += 604800;
                                 }
                             }
                         } else {
                             // or at X. day of month ?
                             $lwst = mktime(12, 0, 0, $amonth - (($year - date('Y', $rep['ts'])) * 12 + ($amonth - date('n', $rep['ts']))) % $rep['linterval'], $rep['day'], $year);
                         }
                     } else {
                         // first recurrence
                         $lwst = $rep['ts'];
                         $lwst = mktime(12, 0, 0, $amonth - (($year - date('Y', $rep['ts'])) * 12 + ($amonth - date('n', $rep['ts']))) % $rep['linterval'], $rep['day'], $year);
                     }
                     $hgst = $lwst + $duration * 86400;
                     $md_date = $lwst;
                     // events last longer than one day
                     while ($md_date >= $start_ts && $md_date <= $hgst && $md_date <= $end_ts) {
                         $this->countListEvent($properties, $md_date, $lwst, $hgst, $daylist);
                         $md_date += 86400;
                     }
                 }
                 break;
             case 'YEARLY':
                 for ($ayear = $this->year - 1; $ayear <= $this->year; $ayear++) {
                     if ($rep['day']) {
                         $lwst = mktime(12, 0, 0, $rep['month'], $rep['day'], $ayear);
                         $hgst = $lwst + $duration * 86400;
                         $wdate = $lwst;
                         while ($hgst >= $start_ts && $wdate <= $hgst && $wdate <= $end_ts) {
                             $this->countListEvent($properties, $wdate, $lwst, $hgst, $daylist);
                             $wdate += 86400;
                         }
                     } else {
                         if ($rep['ts'] < $start) {
                             $adate = mktime(12, 0, 0, $rep['month'], 1, $ayear) + ($rep['sinterval'] - 1) * 604800;
                             $aday = strftime('%u', $adate);
                             $adate -= ($aday - $rep['wdays']) * 86400;
                             if ($rep['sinterval'] == 5) {
                                 if (date('j', $adate) < 10) {
                                     $adate -= 604800;
                                 }
                             } elseif ($aday > $rep['wdays']) {
                                 $adate += 604800;
                             }
                         } else {
                             $adate = $rep['ts'];
                         }
                         $lwst = $adate;
                         $hgst = $lwst + $duration * 86400;
                         while ($hgst >= $start_ts && $adate <= $hgst && $adate <= $end_ts) {
                             $this->countListEvent($properties, $adate, $lwst, $hgst, $daylist);
                             $adate += 86400;
                         }
                     }
                 }
         }
     }
     return $daylist;
 }
 private function getContentAppointments () {
     if (get_config('CALENDAR_ENABLE')) {
         $events = SingleCalendar::getEventList($this->user_id, time(), time() + 60 * 60 * 24 * 7, null, array('class' => 'PUBLIC'), array('CalendarEvent'));
         $content['APPOINTMENTS']['LIST-START'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . ' %X', time()));
         $content['APPOINTMENTS']['LIST-END'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . ' %X', time() + 60 * 60 * 24 * 7));
         if (sizeof($events)) {
             $i = 0;
             foreach ($events as $event) {
                 if ($event->isDayEvent()) {
                     $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat'), $event->getStart()) . ' (' . _("ganztügig") . ')');
                 } else {
                     $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->getStart()));
                     if (date("dmY", $event->getStart()) == date("dmY", $event->getEnd())) {
                         $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] .= ExternModule::ExtHtmlReady(strftime(" - %X", $event->getEnd()));
                     } else {
                         $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] .= ExternModule::ExtHtmlReady(strftime(" - " . $this->config->getValue('Main', 'dateformat') . " %X", $event->getEnd()));
                     }
                 }
                 $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['TITLE'] = ExternModule::ExtHtmlReady($event->getTitle());
                 $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DESCRIPTION'] = ExternModule::ExtHtmlReady($event->getDescription());
                 $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['LOCATION'] = ExternModule::ExtHtmlReady($event->getLocation());
                 $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['REPETITION'] = ExternModule::ExtHtmlReady($event->toStringRecurrence());
                 $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['CATEGORY'] = ExternModule::ExtHtmlReady($event->toStringCategories());
                 $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['PRIORITY'] = ExternModule::ExtHtmlReady($event->toStringPriority());
                 $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['START'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->getStart()));
                 $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['END'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->getEnd()));
                 $i++;
             }
         } else {
             $content['APPOINTMENTS']['NO-APPOINTMENTS']['NO-APPOINTMENTS_TEXT'] = $this->config->getValue('Main', 'noappointmentstext');
         }
         return $content;
     }
     return NULL;
 }
Ejemplo n.º 5
0
 public function year_action($range_id = null)
 {
     $this->range_id = $range_id ?: $this->range_id;
     $start = mktime(0, 0, 0, 1, 1, date('Y', $this->atime));
     $end = mktime(23, 59, 59, 12, 31, date('Y', $this->atime));
     $this->calendars[0] = new SingleCalendar($GLOBALS['user']->id, $start, $end);
     $this->count_lists[0] = $this->calendars[0]->getListCountEvents();
     // check and get the group
     $group = $this->getGroup($this->calendars[0]);
     $n = 1;
     // get the calendars of the group members
     foreach ($group->members as $member) {
         $calendar = new SingleCalendar($member->user_id);
         if ($calendar->havePermission(Calendar::PERMISSION_READABLE)) {
             $this->calendars[$n] = $calendar->setStart($start)->setEnd($end);
             $this->count_lists[$n] = $this->calendars[$n]->getListCountEvents();
             $n++;
         }
     }
     PageLayout::setTitle($this->getTitle($group) . ' - ' . _('Jahresansicht'));
     Navigation::activateItem("/calendar/calendar");
     $this->last_view = 'year';
     $this->createSidebar('year');
     $this->createSidebarFilter();
 }
Ejemplo n.º 6
0
 protected function getTitle(SingleCalendar $calendar, $title_end)
 {
     $title = '';
     $status = '';
     if ($calendar->getRangeId() == $GLOBALS['user']->id) {
         $title = _('Mein persönlicher Terminkalender');
     } else {
         if ($calendar->getRange() == Calendar::RANGE_USER) {
             $title = sprintf(_('Terminkalender von %s'), $calendar->range_object->getFullname());
         } else {
             $title = getHeaderLine($calendar->getRangeId());
         }
         if ($calendar->havePermission(Calendar::PERMISSION_WRITABLE)) {
             $status = ' (' . _('schreibberechtigt') . ')';
         } else {
             $status = ' (' . _('leseberechtigt') . ')';
         }
     }
     return $title . ' - ' . $title_end . $status;
 }
Ejemplo n.º 7
0
function termine (&$module, $row, $alias_content, $text_div, $text_div_end)
{
    if (Config::get()->CALENDAR_ENABLE && Visibility::verify('dates', $row['user_id']) || 1) {
        if ($margin = $module->config->getValue("TableParagraphSubHeadline", "margin")) {
            $subheadline_div = "<div style=\"margin-left:$margin;\">";
            $subheadline_div_end = "</div>";
        }
        else {
            $subheadline_div = "";
            $subheadline_div_end = "";
        }

        $event_list = SingleCalendar::getEventList($row['user_id'], time(),
                time() + 60 * 60 * 24 * 7, null, array('class' => 'PUBLIC'),
                array('CalendarEvent'));
        if (sizeof($event_list)) {
            echo "<tr><td width=\"100%\">\n";
            echo "<table" . $module->config->getAttributes("TableParagraph", "table") . ">\n";
            echo "<tr" . $module->config->getAttributes("TableParagraphHeadline", "tr") . ">";
            echo "<td" . $module->config->getAttributes("TableParagraphHeadline", "td") . ">";
            echo "<font" . $module->config->getAttributes("TableParagraphHeadline", "font") . ">";
            echo "$alias_content</font></td></tr>\n";

            foreach ($event_list as $event) {
                echo "<tr" . $module->config->getAttributes("TableParagraphSubHeadline", "tr") . ">";
                echo "<td" . $module->config->getAttributes("TableParagraphSubHeadline", "td") . ">";
                echo $subheadline_div;
                echo "<font" . $module->config->getAttributes("TableParagraphSubHeadline", "font") . ">";
                echo strftime($module->config->getValue("Main", "dateformat") . " %H:%M", $event->getStart());
                if (date("dmY", $event->getStart()) == date("dmY", $event->getEnd()))
                    echo strftime(" - %H:%M", $event->getEnd());
                else
                    echo strftime(" - " . $module->config->getValue("Main", "dateformat") . " %H:%M", $event->getEnd());
                echo " &nbsp;" . htmlReady($event->getTitle());
                echo "</font>$subheadline_div_end</td></tr>\n";
                if ($event->getDescription()) {
                    echo "<tr" . $module->config->getAttributes("TableParagraphText", "tr") . ">";
                    echo "<td" . $module->config->getAttributes("TableParagraphText", "td") . ">";
                    echo "$text_div<font" . $module->config->getAttributes("TableParagraphText", "font") . ">";
                    echo htmlReady($event->getDescription());
                    echo "</font>$text_div_end</td></tr>\n";
                }
            }
            echo "</table>\n</td></tr>\n";
        }
    }
}
Ejemplo n.º 8
0
 protected function storeEventData(CalendarEvent $event, SingleCalendar $calendar)
 {
     if (Request::int('isdayevent')) {
         $dt_string = Request::get('start_date') . ' 00:00:00';
     } else {
         $dt_string = Request::get('start_date') . ' ' . Request::int('start_hour') . ':' . Request::int('start_minute');
     }
     $event->setStart($this->parseDateTime($dt_string));
     if (Request::int('isdayevent')) {
         $dt_string = Request::get('end_date') . ' 23:59:59';
     } else {
         $dt_string = Request::get('end_date') . ' ' . Request::int('end_hour') . ':' . Request::int('end_minute');
     }
     $event->setEnd($this->parseDateTime($dt_string));
     if ($event->getStart() > $event->getEnd()) {
         $messages[] = _('Die Startzeit muss vor der Endzeit liegen.');
     }
     if (Request::isXhr()) {
         $event->setTitle(studip_utf8decode(Request::get('summary', '')));
         $event->event->description = studip_utf8decode(Request::get('description', ''));
         $event->setUserDefinedCategories(studip_utf8decode(Request::get('categories', '')));
         $event->event->location = studip_utf8decode(Request::get('location', ''));
     } else {
         $event->setTitle(Request::get('summary'));
         $event->event->description = Request::get('description', '');
         $event->setUserDefinedCategories(Request::get('categories', ''));
         $event->event->location = Request::get('location', '');
     }
     $event->event->category_intern = Request::int('category_intern', 1);
     $event->setAccessibility(Request::option('accessibility', 'PRIVATE'));
     $event->setPriority(Request::int('priority', 0));
     if (!$event->getTitle()) {
         $messages[] = _('Es muss eine Zusammenfassung angegeben werden.');
     }
     $rec_type = Request::option('recurrence', 'single');
     $expire = Request::option('exp_c', 'never');
     $rrule = array('linterval' => null, 'sinterval' => null, 'wdays' => null, 'month' => null, 'day' => null, 'rtype' => 'SINGLE', 'count' => null, 'expire' => null);
     if ($expire == 'count') {
         $rrule['count'] = Request::int('exp_count', 10);
     } else {
         if ($expire == 'date') {
             if (Request::isXhr()) {
                 $exp_date = studip_utf8decode(Request::get('exp_date'));
             } else {
                 $exp_date = Request::get('exp_date');
             }
             $exp_date = $exp_date ?: strftime('%x', time());
             $rrule['expire'] = $this->parseDateTime($exp_date . ' 12:00');
         }
     }
     switch ($rec_type) {
         case 'daily':
             if (Request::option('type_daily', 'day') == 'day') {
                 $rrule['linterval'] = Request::int('linterval_d', 1);
                 $rrule['rtype'] = 'DAILY';
             } else {
                 $rrule['linterval'] = 1;
                 $rrule['wdays'] = '12345';
                 $rrule['rtype'] = 'WEEKLY';
             }
             break;
         case 'weekly':
             $rrule['linterval'] = Request::int('linterval_w', 1);
             $rrule['wdays'] = implode('', Request::intArray('wdays', array(strftime('%u', $event->getStart()))));
             $rrule['rtype'] = 'WEEKLY';
             break;
         case 'monthly':
             if (Request::option('type_m', 'day') == 'day') {
                 $rrule['linterval'] = Request::int('linterval_m1', 1);
                 $rrule['day'] = Request::int('day_m', strftime('%e', $event->getStart()));
                 $rrule['rtype'] = 'MONTHLY';
             } else {
                 $rrule['linterval'] = Request::int('linterval_m2', 1);
                 $rrule['sinterval'] = Request::int('sinterval_m', 1);
                 $rrule['wdays'] = Request::int('wday_m', strftime('%u', $event->getStart()));
                 $rrule['rtype'] = 'MONTHLY';
             }
             break;
         case 'yearly':
             if (Request::option('type_y', 'day') == 'day') {
                 $rrule['linterval'] = 1;
                 $rrule['day'] = Request::int('day_y', strftime('%e', $event->getStart()));
                 $rrule['month'] = Request::int('month_y1', date('n', $event->getStart()));
                 $rrule['rtype'] = 'YEARLY';
             } else {
                 $rrule['linterval'] = 1;
                 $rrule['sinterval'] = Request::int('sinterval_y', 1);
                 $rrule['wdays'] = Request::int('wday_y', strftime('%u', $event->getStart()));
                 $rrule['month'] = Request::int('month_y2', date('n', $event->getStart()));
                 $rrule['rtype'] = 'YEARLY';
             }
             break;
     }
     if (sizeof($messages)) {
         PageLayout::postMessage(MessageBox::error(_('Bitte Eingaben korrigieren'), $messages));
         return false;
     } else {
         $event->setRecurrence($rrule);
         $exceptions = array_diff(Request::getArray('exc_dates'), Request::getArray('del_exc_dates'));
         $event->setExceptions($this->parseExceptions($exceptions));
         // if this is a group event, store event in the calendars of each attendee
         if (get_config('CALENDAR_GROUP_ENABLE')) {
             $attendee_ids = Request::optionArray('attendees');
             return $calendar->storeEvent($event, $attendee_ids);
         } else {
             return $calendar->storeEvent($event);
         }
     }
 }