Пример #1
0
 /**
  * @NoAdminRequired
  */
 public function rebuildLeftNavigation()
 {
     $leftNavAktiv = $this->configInfo->getUserValue($this->userId, $this->appName, 'calendarnav');
     //make it as template
     //if ($leftNavAktiv === 'true') {
     $calendars = CalendarCalendar::allCalendars($this->userId, false);
     $bShareApi = \OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes');
     $activeCal = (int) $this->configInfo->getUserValue($this->userId, $this->appName, 'choosencalendar');
     $bActiveCalFound = false;
     $aCalendars = array();
     foreach ($calendars as $calInfo) {
         if ($activeCal === (int) $calInfo['id']) {
             $bActiveCalFound = true;
         }
         $calInfo['bShare'] = false;
         if ($calInfo['permissions'] & $this->shareConnector->getShareAccess() && $bShareApi === 'yes') {
             $calInfo['bShare'] = true;
         }
         $calInfo['shareInfo'] = '';
         if ($calInfo['bShare'] === false) {
             $calInfo['shareInfoLink'] = false;
             if ($this->shareConnector->getItemSharedWithByLinkCalendar($calInfo['id'], $calInfo['userid'])) {
                 $calInfo['shareInfoLink'] = true;
             }
             $calInfo['shareInfo'] = CalendarCalendar::permissionReader($calInfo['permissions']);
         }
         $calInfo['download'] = \OC::$server->getURLGenerator()->linkToRoute($this->appName . '.export.exportEvents') . '?calid=' . $calInfo['id'];
         $calInfo['isActive'] = (int) $calInfo['active'];
         $calInfo['bRefresh'] = true;
         $calInfo['bAction'] = true;
         if ($calInfo['userid'] !== $this->userId) {
             $calInfo['isActive'] = (int) $calInfo['active'];
             if ($this->configInfo->getUserValue($this->userId, $this->appName, 'calendar_' . $calInfo['id']) !== '') {
                 $calInfo['isActive'] = (int) $this->configInfo->getUserValue($this->userId, $this->appName, 'calendar_' . $calInfo['id']);
             }
             $calInfo['bRefresh'] = false;
             $calInfo['bAction'] = false;
         }
         if ((bool) $calInfo['issubscribe'] === false) {
             $aCalendars['cal'][] = $calInfo;
         } else {
             $calInfo['birthday'] = false;
             if ($calInfo['id'] === 'bdaycpltocal_' . $this->userId) {
                 $calInfo['birthday'] = true;
             }
             $aCalendars['abo'][] = $calInfo;
         }
     }
     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);
     }
     if ($bActiveCalFound === false) {
         $activeCal = $aCalendars['cal'][0]['id'];
         $this->configInfo->setUserValue($this->userId, $this->appName, 'choosencalendar', $activeCal);
     }
     $params = ['calendars' => $aCalendars, 'activeCal' => $activeCal, 'shareType' => $this->shareConnector->getConstShareCalendar(), 'shareTypePrefix' => $this->shareConnector->getConstSharePrefixCalendar(), 'timezone' => $this->configInfo->getUserValue($this->userId, $this->appName, 'timezone', ''), 'timezones' => \DateTimeZone::listIdentifiers(), 'timeformat' => $this->configInfo->getUserValue($this->userId, $this->appName, 'timeformat', '24'), 'dateformat' => $this->configInfo->getUserValue($this->userId, $this->appName, 'dateformat', 'd-m-Y'), 'timezonedetection' => $this->configInfo->getUserValue($this->userId, $this->appName, 'timezonedetection'), 'firstday' => $this->configInfo->getUserValue($this->userId, $this->appName, 'firstday', 'mo'), 'userConfig' => $userConfig, 'appname' => $this->appName];
     $response = new TemplateResponse($this->appName, 'navigationleft', $params, '');
     return $response;
 }
Пример #2
0
    /**
     * @NoAdminRequired
     */
    public function rebuildLeftNavigation()
    {
        $leftNavAktiv = $this->configInfo->getUserValue($this->userId, $this->appName, 'calendarnav');
        //make it as template
        if ($leftNavAktiv === 'true') {
            $calendars = CalendarCalendar::allCalendars($this->userId, false);
            //$mySharees=Object::getCalendarSharees();
            $activeCal = $this->configInfo->getUserValue($this->userId, $this->appName, 'choosencalendar');
            $outputAbo = '';
            $output = '<div id="leftcontentInner">
							<div class="view navigation-left button-group" style="float:none;">
							<button class="button viewaction" data-action="agendaDay" data-view="true" data-weekends="true">' . $this->l10n->t('Day') . '</button>
							<button class="button viewaction" data-action="agendaThreeDays" data-view="true" data-weekends="true">' . $this->l10n->t('3-Days') . '</button>	
							<button class="button viewaction" data-action="agendaWorkWeek" data-view="true" data-weekends="false">' . $this->l10n->t('W-Week') . '</button>			
							<button class="button viewaction" data-action="agendaWeek" data-view="true" data-weekends="true">' . $this->l10n->t('Week') . '</button>
						  <button class="button viewaction" data-action="month" data-view="true" data-weekends="true">' . $this->l10n->t('Month') . '</button>
						   <button class="button viewaction" data-action="list" data-view="true" data-weekends="true"><i class="ioc ioc-th-list" title="' . $this->l10n->t('List') . '"></i></button>
						   	<button class="button viewaction" data-action="year" data-view="true" data-weekends="true">' . $this->l10n->t('Year') . '</button>
						   
						   <br />
						   <button class="button" data-action="prev" data-view="false" data-weekends="false"><i class="ioc ioc-angle-left"></i></button>		
						  <button class="button"  data-action="next" data-view="false" data-weekends="false"><i class="ioc ioc-angle-right"></i></button>	
				
			  </div>	
				<div id="datepickerNav"></div>
					<h3><i class="ioc ioc-calendar"></i>&nbsp;' . $this->l10n->t('Calendar') . '</h3>
								<ul id="calendarList">';
            $bShareApi = \OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes');
            foreach ($calendars as $calInfo) {
                $rightsOutput = '';
                $share = '';
                $checkBox = '';
                $isActiveUserCal = '';
                $addCheckClass = '';
                $sharedescr = '';
                if ($activeCal === $calInfo['id']) {
                    $isActiveUserCal = 'isActiveCal';
                    $addCheckClass = 'isActiveUserCal';
                }
                /*
                						  if((is_array($mySharees) && array_key_exists($calInfo['id'], $mySharees))) {
                						 	$sharedescr=$mySharees[$calInfo['id']];	
                						 	$share='<i class="ioc ioc-share toolTip" title="<b>'. $this->l10n->t('Shared with').'</b><br>'.$sharedescr.'"></i> '; 	
                						 }*/
                $shareLink = '';
                if ($calInfo['permissions'] & \OCP\PERMISSION_SHARE && $bShareApi === 'yes') {
                    $shareLink = '<a href="#" class="share icon-share" 
							  	data-item-type="' . CalendarApp::SHARECALENDAR . '" 
							    data-item="' . CalendarApp::SHARECALENDARPREFIX . $calInfo['id'] . '" 
							    data-link="true"
							    data-title="' . $calInfo['displayname'] . '"
								data-possible-permissions="' . $calInfo['permissions'] . '"
								title="' . (string) $this->l10n->t('Share Calendar') . '"
								style="float:right;"
								>
								</a>';
                }
                $displayName = '<span class="descr toolTip"  title="' . $calInfo['displayname'] . '">' . $calInfo['displayname'] . '</span>' . $shareLink;
                $checked = $calInfo['active'] ? ' checked="checked"' : '';
                $notice = '';
                $shareInfo = '';
                if ($calInfo['userid'] !== $this->userId) {
                    if ($shareLink === '') {
                        if (\OCP\Share::getItemSharedWithByLink(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $calInfo['id'], $calInfo['userid'])) {
                            $notice = '<b>Notice</b><br>This calendar is also shared by Link for public!<br>';
                        }
                        $rightsOutput = CalendarCalendar::permissionReader($calInfo['permissions']);
                        $shareInfo = '<i style="float:right;" class="toolTip ioc ioc-info" title="' . $notice . (string) $this->l10n->t('by') . ' ' . $calInfo['userid'] . '<br />(' . $rightsOutput . ')"></i>';
                    }
                    $calShare = $calInfo['active'];
                    if ($this->configInfo->getUserValue($this->userId, 'calendar', 'calendar_' . $calInfo['id']) !== '') {
                        $calShare = $this->configInfo->getUserValue($this->userId, 'calendar', 'calendar_' . $calInfo['id']);
                    }
                    $checked = $calShare ? ' checked="checked"' : '';
                    $displayName = '<span class="descr toolTip" title="' . $calInfo['displayname'] . '">' . $calInfo['displayname'] . '</span>' . $shareLink . $shareInfo;
                    // $checkBox='';
                }
                $checkBox = '<input class="activeCalendarNav regular-checkbox" data-id="' . $calInfo['id'] . '" style="float:left;" id="edit_active_' . $calInfo['id'] . '" type="checkbox" ' . $checked . ' /><label style="float:left;margin-right:5px;" class="toolTip" title="' . $this->l10n->t('show / hide calendar') . '" for="edit_active_' . $calInfo['id'] . '"></label>';
                if ((bool) $calInfo['issubscribe'] === false) {
                    $output .= '<li data-id="' . $calInfo['id'] . '" class="calListen ' . $isActiveUserCal . '">' . $checkBox . '<div class="colCal toolTip iCalendar ' . $addCheckClass . '" title="' . $this->l10n->t('choose calendar as default') . '" style="cursor:pointer;background:' . $calInfo['calendarcolor'] . '">&nbsp;</div> ' . $displayName . '</li>';
                } else {
                    if ($calInfo['userid'] === $this->userId) {
                        $refreshImage = '<i title="refresh"  class="refreshSubscription ioc ioc-refresh" style="cursor:pointer;float:right;position:absolute;right:18px;">&nbsp;</i>';
                    }
                    $outputAbo .= '<li data-id="' . $calInfo['id'] . '" class="calListen ' . $isActiveUserCal . '">' . $checkBox . '<div class="colCal" style="cursor:pointer;background:' . $calInfo['calendarcolor'] . '">&nbsp;</div> ' . $displayName . $refreshImage . '</li>';
                }
            }
            if ($outputAbo !== '') {
                $outputAbo = '<br style="clear:both;"><br /><h3><i class="ioc ioc-rss-alt"></i>&nbsp;' . $this->l10n->t('Subscription') . '</h3><ul>' . $outputAbo . '</ul>';
            }
            $output .= '</ul>' . $outputAbo . '<br />
				   <br style="clear:both;"><br />
				   <h3 data-id="lCategory" style=" cursor:pointer; line-height:24px;" ><label id="showCategory"><i style="font-size:22px;" class="ioc ioc-angle-down ioc-rotate-270"></i>&nbsp;<i class="ioc ioc-tags"></i>&nbsp;' . $this->l10n->t('Tags') . '</label> 
				   	 	
				   
				   </h3>
					 <ul id="categoryCalendarList">
					 </ul>
					  </div>
					     ';
            return $output;
        } else {
            return '';
        }
    }
Пример #3
0
    /**
     * @NoAdminRequired
     */
    public function buildLeftNavigation()
    {
        $calendars = CalendarCalendar::allCalendars($this->userId, true);
        $bShareApi = \OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes');
        $activeCalendars = '';
        foreach ($calendars as $calendar) {
            $isAktiv = $calendar['active'];
            if ($this->configInfo->getUserValue($this->userId, CalendarApp::$appname, 'calendar_' . $calendar['id']) != '') {
                $isAktiv = $this->configInfo->getUserValue($this->userId, CalendarApp::$appname, 'calendar_' . $calendar['id']);
            }
            if (!array_key_exists('active', $calendar)) {
                $isAktiv = 1;
            }
            if ((int) $isAktiv === 1 && (int) $calendar['issubscribe'] === 0) {
                $activeCalendars[] = $calendar;
            }
        }
        $cDataTimeLine = new Timeline();
        $cDataTimeLine->setCalendars($activeCalendars);
        $outputTodoNav = $cDataTimeLine->generateTodoOutput();
        $mySharees = Object::getCalendarSharees();
        $activeCal = $this->configInfo->getUserValue($this->userId, CalendarApp::$appname, 'choosencalendar');
        $outputCalendar = '';
        foreach ($activeCalendars as $calInfo) {
            $rightsOutput = '';
            $share = '';
            $isActiveUserCal = '';
            $notice = '';
            if ($activeCal === $calInfo['id']) {
                $isActiveUserCal = 'isActiveCal';
            }
            $shareLink = '';
            $calInfo['bShare'] = false;
            if ($calInfo['permissions'] & $this->shareConnector->getShareAccess() && $bShareApi === 'yes') {
                $calInfo['bShare'] = true;
                $shareLink = '<a href="#" class="share icon-share" 
				  	data-item-type="' . $this->shareConnector->getConstShareCalendar() . '" 
				    data-item="' . $this->shareConnector->getConstSharePrefixCalendar() . $calInfo['id'] . '" 
				    data-link="true"
				    data-title="' . $calInfo['displayname'] . '"
					data-possible-permissions="' . $calInfo['permissions'] . '"
					title="' . (string) $this->l10n->t('Share Calendar') . '"
					>
					</a>';
            }
            $notice = '';
            if ($calInfo['bShare'] === false) {
                if ($this->shareConnector->getItemSharedWithByLinkCalendar($calInfo['id'], $calInfo['userid'])) {
                    $notice = '<b>Notice</b><br>This calendar is also shared by Link for public!<br>';
                }
                $calInfo['shareInfo'] = CalendarCalendar::permissionReader($calInfo['permissions']);
                $shareLink = '<i class="toolTip ioc ioc-info" title="' . $notice . (string) $this->l10n->t('by') . ' ' . $calInfo['userid'] . '<br />(' . $calInfo['shareInfo'] . ')"></i>';
            }
            $displayName = '<span class="toolTip descr"  title="' . $notice . (string) $this->l10n->t('Calendar') . ' ' . $calInfo['displayname'] . '">' . $calInfo['displayname'] . '</span>';
            if ($calInfo['userid'] !== $this->userId) {
                if (\OCP\Share::getItemSharedWithByLink(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $calInfo['id'], $calInfo['userid'])) {
                    $notice = '<b>Notice</b><br>' . (string) $this->l10n->t('This calendar is also shared by Link for public!') . '<br>';
                }
                $rightsOutput = CalendarCalendar::permissionReader($calInfo['permissions']);
                $displayName = '<span class="toolTip descr" title="' . $notice . (string) $this->l10n->t('Calendar') . ' ' . $calInfo['displayname'] . '">' . $calInfo['displayname'] . '</span>';
            }
            $countCalEvents = 0;
            if (array_key_exists($calInfo['id'], $outputTodoNav['aCountCalEvents'])) {
                $countCalEvents = $outputTodoNav['aCountCalEvents'][(string) $calInfo['id']];
            }
            $actionCalender = '';
            if ($calInfo['userid'] === $this->userId) {
                //$actionCalender = '<li><i class="ioc ioc-rename"></i></li><li><i class="ioc ioc-delete"></i></li>';
            }
            $addMenu = '<div class="app-navigation-entry-utils-menu-button"><button></button>
						  <div class="app-navigation-entry-menu" data-calendarid="' . $calInfo['id'] . '">
							  <ul>
							  <li><i class="ioc ioc-globe"></i></li>
							  ' . $actionCalender . '
							  </ul>
						  </div>
					  </div>';
            $outputCalendar .= '<li class="calListen ' . $isActiveUserCal . '" data-permissions="' . $calInfo['permissions'] . '" data-id="' . $calInfo['id'] . '"><span class="colCal iCalendar toolTip" title="' . $this->l10n->t('choose calendar as default') . '" style="background-color:' . $calInfo['calendarcolor'] . ';">&nbsp;</span> ' . $displayName . $shareLink . $addMenu . '<span class="iCount">' . $countCalEvents . '</span></li>';
        }
        $params = ['calendarslist' => $outputCalendar, 'tasksCount' => $outputTodoNav['tasksCount'], 'aTaskTime' => $outputTodoNav['aTaskTime']];
        $response = new TemplateResponse($this->appName, 'tasks.list', $params, '');
        return $response;
    }
Пример #4
0
    /**
     * @brief Returns all  shared calendar where user is owner
     * 
     * @return array
     * FIXME search for function on OCP\Share
     */
    public static function getCalendarSharees()
    {
        $SQL = 'SELECT `item_source`, `share_with`, `share_type` ,`permissions`, `item_type` FROM `*PREFIX*share` 
		WHERE `uid_owner` = ? AND `item_type` = ? 
		ORDER BY `item_source` ASC
		';
        $stmt = \OCP\DB::prepare($SQL);
        $result = $stmt->execute(array(\OCP\User::getUser(), App::SHARECALENDAR));
        $aSharees = '';
        while ($row = $result->fetchRow()) {
            $shareWith = '';
            $itemSource = App::validateItemSource($row['item_source'], App::SHARECALENDARPREFIX);
            if ($row['share_with'] && $row['share_type'] != 3) {
                $shareWith = ': ' . $row['share_with'];
            }
            if ($row['share_with'] && $row['share_type'] == 3) {
                $shareWith = ': password protected ';
            }
            $shareDescr = self::shareTypeDescription($row['share_type']) . ' ' . $shareWith . ' (' . Calendar::permissionReader($row['permissions']) . ")<br>";
            //$aSharees[][$itemSource]=array('myShare'=>1,'shareTypeDescr'=>$shareDescr);
            $aSharees[] = ['itemSource' => $itemSource, 'descr' => $shareDescr];
        }
        if (is_array($aSharees)) {
            $aReturn = [];
            $oldId = '';
            foreach ($aSharees as $shareInfo) {
                if ($shareInfo['itemSource'] != $oldId) {
                    $aReturn[$shareInfo['itemSource']] = $shareInfo['descr'];
                } else {
                    $aReturn[$shareInfo['itemSource']] .= $shareInfo['descr'];
                }
                $oldId = $shareInfo['itemSource'];
            }
            return $aReturn;
        } else {
            return false;
        }
    }
Пример #5
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;
 }