Example #1
0
 /**
  * @NoAdminRequired
  */
 public function getEditFormEvent()
 {
     $id = $this->params('id');
     $choosenDate = $this->params('choosendate');
     $data = CalendarApp::getEventObject($id, false, false);
     $editInfo = $this->getVobjectData($id, $choosenDate, $data);
     if ($editInfo['permissions'] !== $this->shareConnector->getAllAccess()) {
         $aCalendar = CalendarCalendar::find($data['calendarid']);
         $calendar_options[0]['id'] = $data['calendarid'];
         $calendar_options[0]['permissions'] = $editInfo['permissions'];
         $calendar_options[0]['displayname'] = $aCalendar['displayname'];
         $calendar_options[0]['calendarcolor'] = $aCalendar['calendarcolor'];
     } else {
         $calendarsAll = CalendarCalendar::allCalendars($this->userId);
         $calendar_options = array();
         foreach ($calendarsAll as $calendar) {
             $isAktiv = (int) $calendar['active'];
             if ($this->configInfo->getUserValue($this->userId, $this->appName, 'calendar_' . $calendar['id']) !== '') {
                 $isAktiv = (int) $this->configInfo->getUserValue($this->userId, $this->appName, 'calendar_' . $calendar['id']);
             }
             if (!array_key_exists('active', $calendar)) {
                 $isAktiv = 1;
             }
             if ((int) $isAktiv === 1) {
                 $calendar_options[] = $calendar;
             }
         }
     }
     $category_options = CalendarApp::getCategoryOptions();
     $access_class_options = CalendarApp::getAccessClassOptions();
     $repeat_options = CalendarApp::getRepeatOptions();
     $repeat_end_options = CalendarApp::getEndOptions();
     $repeat_month_options = CalendarApp::getMonthOptions();
     $repeat_year_options = CalendarApp::getYearOptions();
     $repeat_weekly_options = CalendarApp::getWeeklyOptions();
     $repeat_weekofmonth_options = CalendarApp::getWeekofMonth();
     $repeat_byyearday_options = CalendarApp::getByYearDayOptions();
     $repeat_bymonth_options = CalendarApp::getByMonthOptions();
     $repeat_byweekno_options = CalendarApp::getByWeekNoOptions();
     $repeat_bymonthday_options = CalendarApp::getByMonthDayOptions();
     //NEW
     $repeat_weeklyshort_options = CalendarApp::getWeeklyOptionsShort();
     $repeat_advancedoptions = CalendarApp::getAdvancedRepeatOptions();
     $repeat_monthshort_options = CalendarApp::getByMonthShortOptions();
     //NEW Reminder
     $reminder_advanced_options = CalendarApp::getAdvancedReminderOptions();
     $reminder_time_options = CalendarApp::getReminderTimeOptions();
     $start = new \DateTime($editInfo['dtstart'], new \DateTimeZone('UTC'));
     $tWeekDay = Object::getWeeklyOptionsCheck($start->format('D'));
     $transWeekDay[$tWeekDay] = $tWeekDay;
     if ((string) $editInfo['rrule']['repeat'] !== 'doesnotrepeat') {
         $paramsRepeat = ['logicCheckWeekDay' => $tWeekDay, 'rRadio0' => isset($editInfo['rrule']['rRadio0']) ? $editInfo['rrule']['rRadio0'] : 'checked="checked"', 'rClass0' => isset($editInfo['rrule']['rClass0']) ? $editInfo['rrule']['rClass0'] : '', 'rRadio1' => isset($editInfo['rrule']['rRadio1']) ? $editInfo['rrule']['rRadio1'] : '', 'rClass1' => isset($editInfo['rrule']['rClass1']) ? $editInfo['rrule']['rClass1'] : 'class="ui-isDisabled"', 'checkedMonth' => isset($editInfo['rrule']['checkedMonth']) ? $editInfo['rrule']['checkedMonth'] : '', 'bdayClass' => isset($editInfo['rrule']['bdayClass']) ? $editInfo['rrule']['bdayClass'] : 'class="ui-isDisabled"', 'repeat_rules' => isset($editInfo['rrule']['repeat_rules']) ? $editInfo['rrule']['repeat_rules'] : '', 'advancedrepeat' => isset($editInfo['rrule']['rAdvanced']) ? $editInfo['rrule']['rAdvanced'] : 'DAILY', 'repeat_weekdaysSingle' => $transWeekDay, 'repeat_weekdays' => isset($editInfo['rrule']['weekdays']) ? $editInfo['rrule']['weekdays'] : array(), 'repeat_bymonthday' => isset($editInfo['rrule']['bymonthday']) ? $editInfo['rrule']['bymonthday'] : array(), 'repeat_bymonth' => isset($editInfo['rrule']['bymonth']) ? $editInfo['rrule']['bymonth'] : array(), 'repeat_weekofmonth' => isset($editInfo['rrule']['weekofmonth']) ? $editInfo['rrule']['weekofmonth'] : '1', 'repeat_interval' => isset($editInfo['rrule']['interval']) ? $editInfo['rrule']['interval'] : '1', 'repeat_end' => isset($editInfo['rrule']['end']) ? $editInfo['rrule']['end'] : 'never', 'repeat_count' => isset($editInfo['rrule']['count']) ? $editInfo['rrule']['count'] : '10', 'repeat_date' => isset($editInfo['rrule']['date']) ? $editInfo['rrule']['date'] : ''];
     } else {
         $tDayOfMonth[$start->format('j')] = $start->format('j');
         $tMonth[$start->format('n')] = $start->format('n');
         $first_of_month = $start->format('Y-m-1');
         $day_of_first = date('N', $start->format('U'));
         $day_of_month = $start->format('j');
         $weekNum = floor(($day_of_first + $day_of_month - 1) / 7) + 1;
         if ($weekNum >= 1 && $weekNum <= 4) {
             $weekNum = '+' . $weekNum;
         } else {
             $weekNum = '-1';
         }
         $paramsRepeat = ['logicCheckWeekDay' => $tWeekDay, 'rRadio0' => 'checked="checked"', 'rClass0' => '', 'rRadio1' => '', 'rClass1' => 'class="ui-isDisabled"', 'checkedMonth' => '', 'bdayClass' => 'class="ui-isDisabled"', 'repeat_rules' => '', 'advancedrepeat' => 'DAILY', 'repeat_weekdaysSingle' => $transWeekDay, 'repeat_weekdays' => $transWeekDay, 'repeat_bymonthday' => $tDayOfMonth, 'repeat_bymonth' => $tMonth, 'repeat_weekofmonth' => $weekNum, 'repeat_interval' => 1, 'repeat_end' => 'never', 'repeat_count' => '10', 'repeat_date' => ''];
     }
     $params = ['eventid' => $id, 'appname' => $this->appName, 'permissions' => $editInfo['permissions'], 'lastmodified' => $editInfo['lastmodified'], 'calendar_options' => $calendar_options, 'access_class_options' => $access_class_options, 'repeat_options' => $repeat_options, 'repeat_month_options' => $repeat_month_options, 'repeat_weekly_options' => $repeat_weekly_options, 'repeat_end_options' => $repeat_end_options, 'repeat_year_options' => $repeat_year_options, 'repeat_byyearday_options' => $repeat_byyearday_options, 'repeat_bymonth_options' => $repeat_bymonth_options, 'repeat_byweekno_options' => $repeat_byweekno_options, 'repeat_bymonthday_options' => $repeat_bymonthday_options, 'repeat_weekofmonth_options' => $repeat_weekofmonth_options, 'repeat_advancedoptions' => $repeat_advancedoptions, 'repeat_weeklyshort_options' => $repeat_weeklyshort_options, 'repeat_monthshort_options' => $repeat_monthshort_options, 'reminder_options' => $editInfo['reminder_options'], 'reminder_advanced_options' => $reminder_advanced_options, 'reminder_time_options' => $reminder_time_options, 'reminder_advanced' => 'DISPLAY', 'reminder_rules' => array_key_exists('triggerRequest', $editInfo['alarm']) ? $editInfo['alarm']['triggerRequest'] : '', 'reminder' => $editInfo['alarm']['action'], 'remindertimeselect' => array_key_exists('reminder_time_select', $editInfo['alarm']) ? $editInfo['alarm']['reminder_time_select'] : '', 'remindertimeinput' => array_key_exists('reminder_time_input', $editInfo['alarm']) ? $editInfo['alarm']['reminder_time_input'] : '', 'reminderemailinput' => array_key_exists('email', $editInfo['alarm']) ? $editInfo['alarm']['email'] : '', 'reminderdate' => array_key_exists('reminderdate', $editInfo['alarm']) ? $editInfo['alarm']['reminderdate'] : '', 'remindertime' => array_key_exists('remindertime', $editInfo['alarm']) ? $editInfo['alarm']['remindertime'] : '', 'title' => $editInfo['summary'], 'accessclass' => $editInfo['accessclass'], 'location' => $editInfo['location'], 'categories' => $editInfo['categories'], 'calendar' => $data['calendarid'], 'allday' => $editInfo['allday'], 'startdate' => $editInfo['startdate'], 'starttime' => $editInfo['starttime'], 'enddate' => $editInfo['enddate'], 'endtime' => $editInfo['endtime'], 'description' => $editInfo['description'], 'link' => $editInfo['link'], 'addSingleDeleteButton' => $editInfo['addSingleDeleteButton'], 'choosendate' => $choosenDate, 'isShareApi' => $this->appConfig->getValue('core', 'shareapi_enabled', 'yes'), 'repeat' => $editInfo['rrule']['repeat'], 'mailNotificationEnabled' => $this->appConfig->getValue('core', 'shareapi_allow_mail_notification', 'yes'), 'allowShareWithLink' => $this->appConfig->getValue('core', 'shareapi_allow_links', 'yes'), 'mailPublicNotificationEnabled' => $this->appConfig->getValue('core', 'shareapi_allow_public_notification', 'no'), 'sharetypeevent' => $this->shareConnector->getConstShareEvent(), 'sharetypeeventprefix' => $this->shareConnector->getConstSharePrefixEvent()];
     $params = array_merge($params, $paramsRepeat);
     if ($editInfo['permissions'] & $this->shareConnector->getUpdateAccess()) {
         $response = new TemplateResponse($this->appName, 'part.editevent', $params, '');
     } elseif ($editInfo['permissions'] & $this->shareConnector->getReadAccess()) {
         //$response = new TemplateResponse('calendar', 'part.showevent',$params, '');
     }
     return $response;
 }