/**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $calendars = CalendarCalendar::allCalendars($this->userId);
     $allcached = true;
     foreach ($calendars as $calendar) {
         if (!$this->repeatController->isCalendarCached($calendar['id'])) {
             $allcached = 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 = ['appname' => $this->appName, 'timezone' => $this->configInfo->getUserValue($this->userId, $this->appName, 'timezone', ''), 'timezones' => \DateTimeZone::listIdentifiers(), 'calendars' => $calendars, 'mySharedCalendars' => Object::getCalendarSharees(), 'isShareApiActive' => \OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes'), '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'), 'allCalendarCached' => $allcached, 'userConfig' => $userConfig];
     $response = new TemplateResponse($this->appName, 'settings', $params, '');
     return $response;
 }
Exemplo n.º 2
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;
    }