Exemplo n.º 1
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  */
 public function getGuestSettingsCalendar()
 {
     $token = $this->params('t');
     if (isset($token)) {
         $linkItem = \OCP\Share::getShareByToken($token, false);
         if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
             // seems to be a valid share
             if ($linkItem['item_type'] === CalendarApp::SHARECALENDAR) {
                 $sPrefix = CalendarApp::SHARECALENDARPREFIX;
             }
             if ($linkItem['item_type'] === CalendarApp::SHAREEVENT) {
                 $sPrefix = CalendarApp::SHAREEVENTPREFIX;
             }
             $itemSource = CalendarApp::validateItemSource($linkItem['item_source'], $sPrefix);
             $shareOwner = $linkItem['uid_owner'];
             $rootLinkItem = \OCP\Share::resolveReShare($linkItem);
             if (isset($rootLinkItem['uid_owner'])) {
                 \OCP\JSON::checkUserExists($rootLinkItem['uid_owner']);
                 $calendar = CalendarCalendar::find($itemSource);
                 if (!array_key_exists('active', $calendar)) {
                     $calendar['active'] = 1;
                 }
                 if ($calendar['active'] == 1) {
                     $eventSources[] = CalendarCalendar::getEventSourceInfo($calendar, true);
                     $eventSources[0]['url'] = \OC::$server->getURLGenerator()->linkToRoute($this->appName . '.public.getEventsPublic') . '?t=' . $token;
                     $calendarInfo[$calendar['id']] = array('bgcolor' => $calendar['calendarcolor'], 'color' => CalendarCalendar::generateTextColor($calendar['calendarcolor']));
                     $myRefreshChecker[$calendar['id']] = $calendar['ctag'];
                 }
             }
         }
         $defaultView = 'month';
         if ($this->session->get('public_currentView') != '') {
             $defaultView = (string) $this->session->get('public_currentView');
         }
         $params = ['status' => 'success', 'defaultView' => $defaultView, 'agendatime' => 'HH:mm { - HH:mm}', 'defaulttime' => 'HH:mm', 'firstDay' => '1', 'calendarId' => $calendar['id'], 'eventSources' => $eventSources, 'calendarcolors' => $calendarInfo, 'myRefreshChecker' => $myRefreshChecker];
         $response = new JSONResponse($params);
         return $response;
     }
 }
 /**
  * @NoAdminRequired
  */
 public function getUserSettingsCalendar()
 {
     $firstDayConfig = $this->configInfo->getUserValue($this->userId, $this->appName, 'firstday', 'mo');
     $firstDay = $this->prepareFirstDay($firstDayConfig);
     $agendaTime = 'hh:mm tt { - hh:mm tt}';
     $defaultTime = 'hh:mm tt';
     if ($this->configInfo->getUserValue($this->userId, $this->appName, 'timeformat', '24') === '24') {
         $agendaTime = 'HH:mm { - HH:mm}';
         $defaultTime = 'HH:mm';
     }
     $checkCat = CalendarApp::loadTags();
     $checkCatTagsList = '';
     $checkCatCategory = '';
     foreach ($checkCat['categories'] as $category) {
         $checkCatCategory[] = $category;
     }
     foreach ($checkCat['tagslist'] as $tag) {
         $checkCatTagsList[$tag['name']] = array('name' => $tag['name'], 'color' => $tag['color'], 'bgcolor' => $tag['bgcolor']);
     }
     $eventSources = [];
     $calendars = CalendarCalendar::allCalendars($this->userId);
     $calendarInfo = [];
     $myCalendars = [];
     $myRefreshChecker = [];
     foreach ($calendars as $calendar) {
         $isAktiv = $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) {
             $eventSources[] = CalendarCalendar::getEventSourceInfo($calendar);
             $calendarInfo[$calendar['id']] = ['bgcolor' => $calendar['calendarcolor'], 'color' => CalendarCalendar::generateTextColor($calendar['calendarcolor'])];
             $myCalendars[$calendar['id']] = ['id' => $calendar['id'], 'name' => $calendar['displayname'], 'issubscribe' => (int) $calendar['issubscribe'], 'permissions' => (int) $calendar['permissions']];
             $myRefreshChecker[$calendar['id']] = $calendar['ctag'];
         }
     }
     $events_baseURL = \OC::$server->getURLGenerator()->linkToRoute($this->appName . '.event.getEvents');
     $eventSources[] = array('url' => $events_baseURL . '?calendar_id=shared_events', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false');
     if ($this->configInfo->getUserValue($this->userId, $this->appName, 'userconfig')) {
         $userConfig = json_decode($this->configInfo->getUserValue($this->userId, $this->appName, 'userconfig'));
     } else {
         //Guest Config Public Page
         $userConfig = '{"agendaDay":"true","agendaThreeDays":"false","agendaWorkWeek":"false","agendaWeek":"true","month":"true","year":"false","list":"false"}';
         $userConfig = json_decode($userConfig);
     }
     $params = ['status' => 'success', 'defaultView' => $this->configInfo->getUserValue($this->userId, $this->appName, 'currentview', 'month'), 'agendatime' => $agendaTime, 'defaulttime' => $defaultTime, 'firstDay' => $firstDay, 'categories' => $checkCatCategory, 'tags' => $checkCatTagsList, 'eventSources' => $eventSources, 'calendarcolors' => $calendarInfo, 'mycalendars' => $myCalendars, 'myRefreshChecker' => $myRefreshChecker, 'choosenCalendar' => $this->configInfo->getUserValue($this->userId, $this->appName, 'choosencalendar'), 'userConfig' => $userConfig, 'sharetypeevent' => CalendarApp::SHAREEVENT, 'sharetypecalendar' => CalendarApp::SHARECALENDAR];
     $response = new JSONResponse($params);
     return $response;
 }
 /**
  * @NoAdminRequired
  */
 public function getUserSettingsCalendar()
 {
     $firstDayConfig = $this->configInfo->getUserValue($this->userId, $this->appName, 'firstday', 'mo');
     $firstDay = $this->prepareFirstDay($firstDayConfig);
     $agendaTime = 'hh:mm tt { - hh:mm tt}';
     $defaultTime = 'hh:mm tt';
     $timeFormat = $this->configInfo->getUserValue($this->userId, $this->appName, 'timeformat', '24');
     if ($timeFormat === '24') {
         $agendaTime = 'HH:mm { - HH:mm}';
         $defaultTime = 'HH:mm { - HH:mm}';
     }
     $dateFormat = $this->configInfo->getUserValue($this->userId, $this->appName, 'dateformat', 'd-m-Y');
     $checkCat = CalendarApp::loadTags();
     $checkCatTagsList = '';
     $checkCatCategory = '';
     foreach ($checkCat['categories'] as $category) {
         $checkCatCategory[] = $category;
     }
     foreach ($checkCat['tagslist'] as $tag) {
         $checkCatTagsList[$tag['name']] = array('id' => $tag['id'], 'name' => $tag['name'], 'color' => $tag['color'], 'bgcolor' => $tag['bgcolor']);
     }
     $eventSources = [];
     $calendars = CalendarCalendar::allCalendars($this->userId);
     $calendarInfo = [];
     $myCalendars = [];
     $myRefreshChecker = [];
     foreach ($calendars 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 ($this->userId !== $calendar['userid']) {
             $calendar['uri'] = $calendar['uri'] . '_shared_by_' . $calendar['userid'];
         }
         $addClass = '';
         if (isset($calendar['className'])) {
             $addClass = $calendar['className'];
         }
         $bgColor = '';
         $textColor = '';
         if (isset($calendar['calendarcolor'])) {
             $bgColor = $calendar['calendarcolor'];
             /*DEFAULT*/
             $textColorDefault = CalendarCalendar::generateTextColor($bgColor);
             $textColor = $bgColor;
         }
         if (isset($calendar['textColor'])) {
             /*DEFAULT*/
             $textColorDefault = $calendar['textColor'];
             $textColor = $bgColor;
         }
         $calendarInfo[$calendar['id']] = ['bgcolor' => $bgColor, 'color' => $textColorDefault, 'colorDefault' => $textColorDefault, 'name' => $calendar['displayname'], 'externuri' => $calendar['externuri'], 'uri' => $calendar['uri'], 'className' => $addClass];
         if ((int) $isAktiv === 1) {
             $eventSources[] = CalendarCalendar::getEventSourceInfo($calendar);
             $myCalendars[$calendar['id']] = ['id' => $calendar['id'], 'name' => $calendar['displayname'], 'uri' => $calendar['uri'], 'issubscribe' => (int) $calendar['issubscribe'], 'permissions' => (int) $calendar['permissions']];
             $myRefreshChecker[$calendar['id']] = $calendar['ctag'];
         }
     }
     $events_baseURL = \OC::$server->getURLGenerator()->linkToRoute($this->appName . '.event.getEvents');
     $eventSources[] = array('url' => $events_baseURL . '?calendar_id=shared_events', 'className' => 'shared-events', 'editable' => 'false');
     if ($this->configInfo->getUserValue($this->userId, $this->appName, 'userconfig')) {
         $userConfig = json_decode($this->configInfo->getUserValue($this->userId, $this->appName, 'userconfig'));
     } else {
         //Guest Config Public Page
         $userConfig = '{"agendaDay":"true","agendaThreeDays":"false","agendaWorkWeek":"false","agendaWeek":"true","month":"true","year":"false","list":"false"}';
         $userConfig = json_decode($userConfig);
     }
     $leftNavAktiv = $this->configInfo->getUserValue($this->userId, $this->appName, 'calendarnav');
     $rightNavAktiv = $this->configInfo->getUserValue($this->userId, $this->appName, 'tasknav');
     $taskAppActive = \OC::$server->getAppManager()->isEnabledForUser('tasksplus');
     $params = ['status' => 'success', 'defaultView' => $this->configInfo->getUserValue($this->userId, $this->appName, 'currentview', 'month'), 'agendatime' => $agendaTime, 'defaulttime' => $defaultTime, 'dateformat' => $dateFormat, 'timeformat' => $timeFormat, 'firstDay' => $firstDay, 'firstDayString' => $firstDayConfig, 'categories' => $checkCatCategory, 'tags' => $checkCatTagsList, 'eventSources' => $eventSources, 'calendarcolors' => $calendarInfo, 'mycalendars' => $myCalendars, 'myRefreshChecker' => $myRefreshChecker, 'choosenCalendar' => $this->configInfo->getUserValue($this->userId, $this->appName, 'choosencalendar'), 'userConfig' => $userConfig, 'sharetypeevent' => CalendarApp::SHAREEVENT, 'sharetypecalendar' => CalendarApp::SHARECALENDAR, 'leftnavAktiv' => $leftNavAktiv, 'rightnavAktiv' => $rightNavAktiv, 'taskAppActive' => $taskAppActive];
     $response = new JSONResponse($params);
     return $response;
 }
Exemplo n.º 4
0
 public static function arrayForJSON($id, $vtodo, $user_timezone, $aCalendar, $aTask)
 {
     $output = array();
     if (Object::getowner($id) !== \OCP\USER::getUser()) {
         // do not show events with private or unknown access class
         // \OCP\Util::writeLog('calendar','Sharee ID: ->'.$event['calendarid'].':'.$event['summary'], \OCP\Util::DEBUG);
         $aTask['summary'] = strtr($vtodo->getAsString('SUMMARY'), array('\\,' => ',', '\\;' => ';'));
         if (isset($vtodo->CLASS) && ($vtodo->CLASS->getValue() === 'PRIVATE' || $vtodo->CLASS->getValue() === '')) {
             return $output;
         }
         if (isset($vtodo->CLASS) && $vtodo->CLASS->getValue() === 'CONFIDENTIAL') {
             $aTask['summary'] = (string) App::$l10n->t('Busy');
         }
         $vtodo = Object::cleanByAccessClass($id, $vtodo);
     }
     $aTask['id'] = $id;
     $aTask['privat'] = false;
     if (isset($vtodo->CLASS) && $vtodo->CLASS->getValue() === 'PRIVATE') {
         $aTask['privat'] = 'private';
     }
     if (isset($vtodo->CLASS) && $vtodo->CLASS->getValue() === 'CONFIDENTIAL') {
         $aTask['privat'] = 'confidential';
     }
     $aTask['bgcolor'] = $aCalendar['calendarcolor'];
     $aTask['displayname'] = $aCalendar['displayname'];
     $aTask['color'] = Calendar::generateTextColor($aCalendar['calendarcolor']);
     $aTask['permissions'] = $aCalendar['permissions'];
     $aTask['calendarid'] = $aCalendar['id'];
     $aTask['rightsoutput'] = Calendar::permissionReader($aCalendar['permissions']);
     if ($aTask['rightsoutput'] === 'full access') {
         $aTask['rightsoutput'] = '';
     }
     if (array_key_exists('calendarowner', $aCalendar) && $aCalendar['calendarowner'] !== '') {
         $aTask['summary'] .= ' (by ' . $aCalendar['calendarowner'] . ')';
     }
     $aTask['description'] = strtr($vtodo->getAsString('DESCRIPTION'), array('\\,' => ',', '\\;' => ';'));
     $aTask['description'] = nl2br($aTask['description']);
     $aTask['location'] = strtr($vtodo->getAsString('LOCATION'), array('\\,' => ',', '\\;' => ';'));
     $aTask['url'] = strtr($vtodo->getAsString('URL'), array('\\,' => ',', '\\;' => ';'));
     $aTask['categories'] = $vtodo->getAsArray('CATEGORIES');
     $aTask['isOnlySharedTodo'] = false;
     if (array_key_exists('isOnlySharedTodo', $aCalendar) && $aCalendar['isOnlySharedTodo'] !== '') {
         $aTask['isOnlySharedTodo'] = true;
     }
     $aTask['orgevent'] = false;
     if (array_key_exists('org_objid', $aTask) && $aTask['org_objid'] > 0) {
         $aTask['orgevent'] = true;
         $aTask['permissions'] = self::getPermissions($aTask['org_objid'], self::TODO);
         $aTask['summary'] .= ' (' . self::$l10n->t('by') . ' ' . Object::getowner($aTask['org_objid']) . ')';
     }
     if (isset($aTask['isalarm'])) {
         $aTask['isalarm'] = $aTask['isalarm'];
     }
     if (isset($aTask['shared'])) {
         $aTask['shared'] = $aTask['shared'];
     }
     $aTask['sAlarm'] = '';
     if ($vtodo->VALARM) {
         $counter = 0;
         $valarm = '';
         foreach ($vtodo->getComponents() as $param) {
             if ($param->name === 'VALARM') {
                 $attr = $param->children();
                 foreach ($attr as $attrInfo) {
                     $valarm[$counter][$attrInfo->name] = (string) $attrInfo->getValue();
                 }
                 $counter++;
             }
         }
         foreach ($valarm as $vInfo) {
             if ($vInfo['ACTION'] === 'DISPLAY' && strstr($vInfo['TRIGGER'], 'P')) {
                 if (substr_count($vInfo['TRIGGER'], 'PT', 0, 2) === 1) {
                     $TimeCheck = substr($vInfo['TRIGGER'], 2);
                     $aTask['sAlarm'][] = 'TRIGGER:+PT' . $TimeCheck;
                 }
                 if (substr_count($vInfo['TRIGGER'], '+PT', 0, 3) === 1) {
                     $TimeCheck = substr($vInfo['TRIGGER'], 3);
                     $aTask['sAlarm'][] = 'TRIGGER:+PT' . $TimeCheck;
                 }
                 if (substr_count($vInfo['TRIGGER'], 'P', 0, 1) === 1 && substr_count($vInfo['TRIGGER'], 'PT', 0, 2) === 0 && substr_count($vInfo['TRIGGER'], 'T', strlen($vInfo['TRIGGER']) - 1, 1) === 0) {
                     $TimeCheck = substr($vInfo['TRIGGER'], 1);
                     $aTask['sAlarm'][] = 'TRIGGER:+PT' . $TimeCheck;
                 }
                 if (substr_count($vInfo['TRIGGER'], 'P', 0, 1) === 1 && substr_count($vInfo['TRIGGER'], 'PT', 0, 2) === 0 && substr_count($vInfo['TRIGGER'], 'T', strlen($vInfo['TRIGGER']) - 1, 1) === 1) {
                     $TimeCheck = substr($vInfo['TRIGGER'], 1);
                     $TimeCheck = substr($TimeCheck, 0, -1);
                     $aTask['sAlarm'][] = 'TRIGGER:+PT' . $TimeCheck;
                 }
                 if (substr_count($vInfo['TRIGGER'], '-PT', 0, 3) === 1) {
                     $TimeCheck = substr($vInfo['TRIGGER'], 3);
                     $aTask['sAlarm'][] = 'TRIGGER:-PT' . $TimeCheck;
                 }
                 if (substr_count($vInfo['TRIGGER'], '-P', 0, 2) === 1 && substr_count($vInfo['TRIGGER'], '-PT', 0, 3) === 0 && substr_count($vInfo['TRIGGER'], 'T', strlen($vInfo['TRIGGER']) - 1, 1) === 0) {
                     $TimeCheck = substr($vInfo['TRIGGER'], 2);
                     $aTask['sAlarm'][] = 'TRIGGER:-PT' . $TimeCheck;
                 }
                 if (substr_count($vInfo['TRIGGER'], '-P', 0, 2) === 1 && substr_count($vInfo['TRIGGER'], '-PT', 0, 3) === 0 && substr_count($vInfo['TRIGGER'], 'T', strlen($vInfo['TRIGGER']) - 1, 1) === 1) {
                     $TimeCheck = substr($vInfo['TRIGGER'], 2);
                     $TimeCheck = substr($TimeCheck, 0, -1);
                     $aTask['sAlarm'][] = 'TRIGGER:-PT' . $TimeCheck;
                 }
                 if ($vInfo['TRIGGER'] === 'PT0S') {
                     $aTask['sAlarm'] = '';
                 }
             }
             if ($vInfo['ACTION'] === 'DISPLAY' && !strstr($vInfo['TRIGGER'], 'P')) {
                 if (!strstr($vInfo['TRIGGER'], 'DATE-TIME')) {
                     $aTask['sAlarm'][] = 'TRIGGER;VALUE=DATE-TIME:' . $vInfo['TRIGGER'];
                 } else {
                     $aTask['sAlarm'][] = $vInfo['TRIGGER'];
                 }
             }
         }
     }
     //FIXME
     $today = strtotime(date('d.m.Y'));
     $tomorrow = $today + 3600 * 24;
     $yesterday = $today - 3600 * 24;
     $iTagAkt = date("w", $today);
     $firstday = 1;
     $iBackCalc = ($iTagAkt - $firstday) * 24 * 3600;
     $actWeekBeginn = $today - $iBackCalc;
     $iForCalc = 6 * 24 * 3600;
     $actWeekEnd = $actWeekBeginn + $iForCalc;
     $aTask['period'] = '';
     $aTask['startsearch'] = '';
     if ($vtodo->DTSTART) {
         $dateStartType = $vtodo->DTSTART->getValueType();
         $timestamp = strtotime($vtodo->DTSTART->getDateTime()->format('d.m.Y'));
         $aTask['startsearch'] = $vtodo->DTSTART->getDateTime()->format('d.m.Y');
         if ($dateStartType === 'DATE') {
             $aTask['startdate'] = $vtodo->DTSTART->getDateTime()->format('d.m.Y');
             if ($timestamp == $today) {
                 $aTask['startdate'] = self::$l10n->t('today');
                 $aTask['period'] = 'today';
             } elseif ($timestamp === $yesterday) {
                 $aTask['startdate'] = self::$l10n->t('yesterday');
                 $aTask['period'] = 'yesterday';
             } elseif ($timestamp === $tomorrow) {
                 $aTask['startdate'] = self::$l10n->t('tomorrow');
                 $aTask['period'] = 'tomorrow';
             } elseif ($timestamp >= $actWeekBeginn && $timestamp <= $actWeekEnd) {
                 $aTask['period'] = 'actweek';
             } elseif ($timestamp > $actWeekEnd) {
                 $aTask['period'] = 'comingsoon';
             } elseif ($timestamp < $actWeekBeginn) {
                 $aTask['period'] = 'missedactweek';
             }
         }
         if ($dateStartType === 'DATE-TIME') {
             $aTask['startdate'] = $vtodo->DTSTART->getDateTime()->format('d.m.Y H:i');
             if ($timestamp === $today) {
                 $aTask['startdate'] = self::$l10n->t('today') . ' ' . $vtodo->DTSTART->getDateTime()->format('H:i');
                 $aTask['period'] = 'today';
             } elseif ($timestamp === $yesterday) {
                 $aTask['startdate'] = self::$l10n->t('yesterday') . ' ' . $vtodo->DTSTART->getDateTime()->format('H:i');
                 $aTask['period'] = 'yesterday';
             } elseif ($timestamp === $tomorrow) {
                 $aTask['startdate'] = self::$l10n->t('tomorrow') . ' ' . $vtodo->DTSTART->getDateTime()->format('H:i');
                 $aTask['period'] = 'tomorrow';
             } elseif ($timestamp >= $actWeekBeginn && $timestamp <= $actWeekEnd) {
                 $aTask['period'] = 'actweek';
             } elseif ($timestamp > $actWeekEnd) {
                 $aTask['period'] = 'comingsoon';
             } elseif ($timestamp < $actWeekBeginn) {
                 $aTask['period'] = 'missedactweek';
             }
         }
     } else {
         $aTask['startdate'] = false;
     }
     //higher prior than startdate
     $aTask['perioddue'] = '';
     $aTask['duesearch'] = '';
     if ($vtodo->DUE) {
         $dateDueType = $vtodo->DUE->getValueType();
         $timestamp = strtotime($vtodo->DUE->getDateTime()->format('d.m.Y'));
         $aTask['duesearch'] = $vtodo->DUE->getDateTime()->format('d.m.Y');
         if ($dateDueType === 'DATE') {
             $aTask['due'] = $vtodo->DUE->getDateTime()->format('d.m.Y');
             if ($timestamp === $today) {
                 $aTask['due'] = self::$l10n->t('today');
                 $aTask['perioddue'] = 'today';
             } elseif ($timestamp === $yesterday) {
                 $aTask['due'] = self::$l10n->t('yesterday');
                 $aTask['perioddue'] = 'yesterday';
             } elseif ($timestamp === $tomorrow) {
                 $aTask['due'] = self::$l10n->t('tomorrow');
                 $aTask['perioddue'] = 'tomorrow';
             } elseif ($timestamp >= $actWeekBeginn && $timestamp <= $actWeekEnd) {
                 $aTask['perioddue'] = 'actweek';
             } elseif ($timestamp > $actWeekEnd) {
                 $aTask['perioddue'] = 'comingsoon';
             } elseif ($timestamp < $actWeekBeginn) {
                 $aTask['perioddue'] = 'missedactweek';
             }
         }
         if ($dateDueType === 'DATE-TIME') {
             $aTask['due'] = $vtodo->DUE->getDateTime()->format('d.m.Y H:i');
             if ($timestamp === $today) {
                 $aTask['due'] = self::$l10n->t('today') . ' ' . $vtodo->DUE->getDateTime()->format('H:i');
                 $aTask['perioddue'] = 'today';
             } elseif ($timestamp === $yesterday) {
                 $aTask['due'] = self::$l10n->t('yesterday') . ' ' . $vtodo->DUE->getDateTime()->format('H:i');
                 $aTask['perioddue'] = 'yesterday';
             } elseif ($timestamp === $tomorrow) {
                 $aTask['due'] = self::$l10n->t('tomorrow') . ' ' . $vtodo->DUE->getDateTime()->format('H:i');
                 $aTask['perioddue'] = 'tomorrow';
             } elseif ($timestamp >= $actWeekBeginn && $timestamp <= $actWeekEnd) {
                 $aTask['perioddue'] = 'actweek';
             } elseif ($timestamp > $actWeekEnd) {
                 $aTask['perioddue'] = 'comingsoon';
             } elseif ($timestamp < $actWeekBeginn) {
                 $aTask['perioddue'] = 'missedactweek';
             }
         }
         if ($vtodo->getAsString('RRULE') !== '') {
             $rrule = explode(';', $vtodo->getAsString('RRULE'));
             $aRrule = array();
             foreach ($rrule as $rule) {
                 list($attr, $val) = explode('=', $rule);
                 if ($attr === 'UNTIL') {
                     $aRrule['enddate'] = $val;
                 }
                 if ($attr === 'FREQ') {
                     $aRrule['freq'] = $val;
                 }
             }
         }
     } else {
         $aTask['due'] = false;
     }
     if ($aTask['due'] === false && $aTask['startdate'] === false) {
         $aTask['period'] = 'withoutdate';
         $aTask['perioddue'] = 'withoutdate';
     }
     $aTask['priority'] = '';
     $aTask['priorityDescr'] = '';
     $aTask['priorityLang'] = '';
     if (isset($vtodo->PRIORITY)) {
         $aTask['priority'] = $vtodo->getAsString('PRIORITY');
         if ($aTask['priority'] == 1 || $aTask['priority'] == 2 || $aTask['priority'] == 3 || $aTask['priority'] == 4) {
             $aTask['priorityDescr'] = (string) self::$l10n->t('priority %s ', array((string) self::$l10n->t('high')));
             $aTask['priorityLang'] = 'high';
         } elseif ($aTask['priority'] == 5) {
             $aTask['priorityDescr'] = (string) self::$l10n->t('priority %s ', array((string) self::$l10n->t('medium')));
             $aTask['priorityLang'] = 'medium';
         } elseif ($aTask['priority'] == 6 || $aTask['priority'] == 7 || $aTask['priority'] == 8 || $aTask['priority'] == 9) {
             $aTask['priorityDescr'] = (string) self::$l10n->t('priority %s ', array((string) self::$l10n->t('low')));
             $aTask['priorityLang'] = 'low';
         }
     }
     if (!isset($aCalendar['iscompleted'])) {
         $aCalendar['iscompleted'] = false;
     }
     $aTask['iscompleted'] = $aCalendar['iscompleted'];
     $completed = $vtodo->COMPLETED;
     if ($completed) {
         $completed = $completed->getDateTime();
         $completed->setTimezone(new \DateTimeZone($user_timezone));
         $timestamp = strtotime($vtodo->COMPLETED->getDateTime()->format('d.m.Y'));
         $aTask['completed'] = $completed->format('d.m.Y');
         if ($timestamp === $today) {
             $aTask['completed'] = self::$l10n->t('today') . ' ' . $completed->format('H:i');
         }
         if ($timestamp === $today - 3600 * 24) {
             $aTask['completed'] = self::$l10n->t('yesterday') . ' ' . $completed->format('H:i');
         }
         $aTask['iscompleted'] = true;
     } else {
         $aTask['completed'] = false;
     }
     $aTask['complete'] = $vtodo->getAsString('PERCENT-COMPLETE');
     $output = $aTask;
     return $output;
 }