Exemple #1
0
 /**
  * Draws a delete form for a calendar.
  * 
  * @param
  *        	boolean True if a location should be deleted
  * @param
  *        	object		The object to be deleted
  * @param
  *        	object		The cObject of the mother-class.
  * @param
  *        	object		The rights object.
  * @return string HTML output.
  */
 public function drawDeleteCalendar(&$calendar)
 {
     $page = $this->cObj->fileResource($this->conf['view.']['delete_calendar.']['template']);
     if ($page == '') {
         return '<h3>calendar: no confirm calendar template file found:</h3>' . $this->conf['view.']['delete_calendar.']['template'];
     }
     $this->object = $calendar;
     if (!$this->object->isUserAllowedToDelete()) {
         return 'You are not allowed to delete this calendar!';
     }
     $rems = array();
     $sims = array();
     $wrapped = array();
     $sims['###UID###'] = $this->conf['uid'];
     $sims['###TYPE###'] = $this->conf['type'];
     $sims['###VIEW###'] = 'save_event';
     $sims['###LASTVIEW###'] = $this->controller->extendLastView();
     $sims['###L_DELETE_CALENDAR###'] = $this->controller->pi_getLL('l_delete_calendar');
     $sims['###L_DELETE###'] = $this->controller->pi_getLL('l_delete');
     $sims['###L_CANCEL###'] = $this->controller->pi_getLL('l_cancel');
     $sims['###ACTION_URL###'] = htmlspecialchars($this->controller->pi_linkTP_keepPIvars_url(array('view' => 'remove_calendar')));
     $this->getTemplateSubpartMarker($page, $sims, $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     $sims = array();
     $rems = array();
     $wrapped = array();
     $this->getTemplateSingleMarker($page, $sims, $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     return \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
 }
 /**
  * Draws a delete form for a location or an organizer.
  * 
  * @param
  *        	boolean True if a location should be deleted
  * @param
  *        	object		The object to be deleted
  * @param
  *        	object		The cObject of the mother-class.
  * @param
  *        	object		The rights object.
  * @return string HTML output.
  */
 public function drawDeleteLocationOrOrganizer($isLocation = true, &$object)
 {
     $page = $this->cObj->fileResource($this->conf['view.']['delete_location.']['template']);
     if ($page == '') {
         return '<h3>category: no delete location template file found:</h3>' . $this->conf['view.']['delete_location.']['template'];
     }
     $this->isLocation = $isLocation;
     $this->object = $object;
     if ($isLocation) {
         $this->objectString = 'location';
     } else {
         $this->objectString = 'organizer';
     }
     $rems = array();
     $sims = array();
     $wrapped = array();
     $sims['###UID###'] = $this->conf['uid'];
     $sims['###TYPE###'] = $this->conf['type'];
     $sims['###VIEW###'] = 'remove_' . $this->objectString;
     $sims['###LASTVIEW###'] = $this->controller->extendLastView();
     $sims['###L_DELETE_LOCATION###'] = $this->controller->pi_getLL('l_delete_' . $this->objectString);
     $sims['###L_DELETE###'] = $this->controller->pi_getLL('l_delete');
     $sims['###L_CANCEL###'] = $this->controller->pi_getLL('l_cancel');
     $sims['###ACTION_URL###'] = htmlspecialchars($this->controller->pi_linkTP_keepPIvars_url(array('view' => 'remove_' . $this->objectString)));
     $this->getTemplateSubpartMarker($page, $sims, $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, array());
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     $sims = array();
     $rems = array();
     $wrapped = array();
     $this->object->getMarker($page, $sims, $rems, $wrapped);
     return \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, $rems, $wrapped);
 }
Exemple #3
0
 /**
  * Draws a delete form for a calendar.
  * 
  * @param
  *        	boolean True if a location should be deleted
  * @param
  *        	object		The object to be deleted
  * @param
  *        	object		The cObject of the mother-class.
  * @param
  *        	object		The rights object.
  * @return string HTML output.
  */
 public function drawDeleteCategory(&$category)
 {
     $page = $this->cObj->fileResource($this->conf['view.']['delete_category.']['template']);
     if ($page == '') {
         return '<h3>category: no delete category template file found:</h3>' . $this->conf['view.']['delete_category.']['template'];
     }
     $this->category = $category;
     $rems = array();
     $sims = array();
     $sims['###UID###'] = $this->conf['uid'];
     $sims['###TYPE###'] = $this->conf['type'];
     $sims['###VIEW###'] = 'remove_category';
     $sims['###LASTVIEW###'] = $this->controller->extendLastView();
     $sims['###L_DELETE_CATEGORY###'] = $this->controller->pi_getLL('l_delete_category');
     $sims['###L_DELETE###'] = $this->controller->pi_getLL('l_delete');
     $sims['###L_CANCEL###'] = $this->controller->pi_getLL('l_cancel');
     $sims['###ACTION_URL###'] = htmlspecialchars($this->controller->pi_linkTP_keepPIvars_url(array('view' => 'remove_category')));
     $this->getTemplateSubpartMarker($page, $sims, $rems);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, array());
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     $sims = array();
     $rems = array();
     $this->getTemplateSingleMarker($page, $sims, $rems);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, array());
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     return \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
 }
Exemple #4
0
 /**
  * Main function to draw the meeting manager view.
  * 
  * @return string output of the meeting manager.
  */
 public function drawMeetingManager()
 {
     $rems = array();
     $sims = array();
     $wrapped = array();
     $sims['###HEADING###'] = $this->controller->pi_getLL('l_manage_meeting');
     $sims['###STATUS###'] = '';
     $rems['###USER_LOGIN###'] = '';
     $rems['###MEETING_CONTAINER###'] = '';
     /* Get the meeting manager template */
     $page = $this->cObj->fileResource($this->conf['view.']['event.']['meeting.']['managerTemplate']);
     if ($page == '') {
         return '<h3>calendar: no meeting manager template file found:</h3>' . $this->conf['view.']['meeting.']['managerTemplate'];
     }
     $eventUID = $this->conf['uid'];
     $attendeeUid = intval($this->controller->piVars['attendee']);
     $meetingHash = strip_tags($this->controller->piVars['sid']);
     $attendeeStatus = strip_tags($this->controller->piVars['status']);
     /* If we have an event, email, and meeting id, try to subscribe or unsubscribe */
     if ($eventUID > 0 && $attendeeUid && $attendeeStatus && $meetingHash) {
         $event = $this->modelObj->findEvent($eventUID, 'tx_cal_phpicalendar', $this->conf['pidList'], false, false, false, true, true);
         unset($this->controller->piVars['monitor']);
         unset($this->controller->piVars['attendee']);
         unset($this->controller->piVars['sid']);
         $local_rems = array();
         $local_sims = array();
         $local_wrapped = array();
         $status = $this->cObj->getSubpart($page, '###STATUS###');
         switch ($attendeeStatus) {
             case 'accept':
                 /* user comes to the meeting */
                 if ($this->changeStatus($attendeeUid, $event, $meetingHash, 'ACCEPTED')) {
                     $sims['###STATUS###'] = sprintf($this->controller->pi_getLL('l_meeting_accepted'), $event->getTitle());
                 } else {
                     /* No user to unsubscribe. Output a message here? */
                     $sims['###STATUS###'] = sprintf($this->controller->pi_getLL('l_meeting_update_error'), $event->getTitle());
                 }
                 break;
             case 'decline':
                 /* user does not come to the meeting */
                 if ($this->changeStatus($attendeeUid, $event, $meetingHash, 'DECLINE')) {
                     $status = $this->cObj->getSubpart($page, '###STATUS_START###');
                     $sims['###STATUS###'] = sprintf($this->controller->pi_getLL('l_meeting_declined'), $event->getTitle());
                 } else {
                     /* No user to subscribe. Output a message here? */
                     $sims['###STATUS###'] = sprintf($this->controller->pi_getLL('l_meeting_update_error'), $event->getTitle());
                 }
                 break;
         }
     } else {
         $sims['###STATUS###'] = $this->controller->pi_getLL('l_meeting_error');
     }
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, $rems, $wrapped);
     $rems = array();
     return $this->finish($page, $rems);
 }
Exemple #5
0
 public function execute()
 {
     $event = BackendUtility::getRecord('tx_cal_event', $this->uid);
     $select = '*';
     $table = 'tx_cal_fe_user_event_monitor_mm';
     $where = 'schedulerId = ' . $this->getTaskUid();
     $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
     $eventMonitor = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
     if (!is_array($event)) {
         // the event could not be found, so we delete this reminder
         $this->remove();
         return true;
     }
     // ******************
     // Constants defined
     // ******************
     define('PATH_thisScript', str_replace('//', '/', str_replace('\\', '/', (php_sapi_name() == 'cgi' || php_sapi_name() == 'isapi' || php_sapi_name() == 'cgi-fcgi') && ($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) ? $_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED'] : ($_SERVER['ORIG_SCRIPT_FILENAME'] ? $_SERVER['ORIG_SCRIPT_FILENAME'] : $_SERVER['SCRIPT_FILENAME']))));
     define('PATH_site', dirname(PATH_thisScript) . '/');
     if (@is_dir(PATH_site . 'typo3/sysext/cms/tslib/')) {
         define('PATH_tslib', PATH_site . 'typo3/sysext/cms/tslib/');
     } elseif (@is_dir(PATH_site . 'tslib/')) {
         define('PATH_tslib', PATH_site . 'tslib/');
     } else {
         // define path to tslib/ here:
         $configured_tslib_path = '';
         // example:
         // $configured_tslib_path = '/var/www/mysite/typo3/sysext/cms/tslib/';
         define('PATH_tslib', $configured_tslib_path);
     }
     if (PATH_tslib == '') {
         die('Cannot find tslib/. Please set path by defining $configured_tslib_path in ' . basename(PATH_thisScript) . '.');
     }
     chdir(PATH_site);
     /* Check Page TSConfig for a preview page that we should use */
     $pageTSConf = BackendUtility::getPagesTSconfig($event['pid']);
     if ($pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']) {
         $pageIDForPlugin = $pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin'];
     } else {
         $pageIDForPlugin = $event['pid'];
     }
     $page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), "doktype");
     if ($page['doktype'] != 254) {
         /** @var \TYPO3\CMS\Cal\Controller\Api $calAPI */
         $calAPI = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Api');
         $calAPI =& $calAPI->tx_cal_api_without($pageIDForPlugin);
         $eventObject = $calAPI->modelObj->findEvent($event['uid'], 'tx_cal_phpicalendar', $calAPI->conf['pidList'], false, false, false, true);
         $calAPI->conf['view'] = 'event';
         $reminderService =& Functions::getReminderService();
         $reminderService->remind($eventObject, $eventMonitor);
         return true;
     }
     $message = 'Cal was not able to send a reminder notice. You have to point to a page containing the cal Plugin. Configure in pageTSConf of page ' . $event['pid'] . ': options.tx_cal_controller.pageIDForPlugin';
     throw new FailedExecutionException($message, 1250596541);
 }
 public function getRRuleMarker(&$template, &$sims, &$rems, &$wrapped, $view)
 {
     $eventStart = $this->origStartDate;
     if ($this->isAllday()) {
         $sims['###RRULE###'] = 'RECURRENCE-ID;VALUE=DATE:' . $eventStart->format('%Y%m%d');
     } else {
         if ($this->conf['view.']['ics.']['timezoneId'] != '') {
             $sims['###RRULE###'] = 'RECURRENCE-ID;TZID=' . $this->conf['view.']['ics.']['timezoneId'] . ':' . $eventStart->format('%Y%m%dT%H%M%S');
         } else {
             $offset = \TYPO3\CMS\Cal\Utility\Functions::strtotimeOffset($eventStart->getTime());
             $eventStart->subtractSeconds($offset);
             $sims['###RRULE###'] = 'RECURRENCE-ID:' . $eventStart->format('%Y%m%dT%H%M%SZ');
             $eventStart->addSeconds($offset);
         }
     }
 }
 function clearSessionApiAfterLogoff($_params, &$pObj)
 {
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('logintype') === 'logout' && $_COOKIE['fe_typo_user']) {
         session_id($_COOKIE['fe_typo_user']);
         session_start();
         if (!$_SESSION['cal_api_logoff'] == 1) {
             if (is_array($_SESSION)) {
                 $sessionEntries = array_keys($_SESSION);
                 foreach ($sessionEntries as $key) {
                     if (\TYPO3\CMS\Cal\Utility\Functions::beginsWith($key, 'cal_api')) {
                         unset($_SESSION[$key]);
                     }
                 }
             }
             $_SESSION['cal_api_logoff'] = 1;
         }
     }
 }
Exemple #8
0
 public function fillTemplate($subpartMarker)
 {
     $cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'cobj');
     $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cal']);
     $modelTemplate = $confArr['todoSubtype'] == 'event' ? 'todoInlineModelTemplate' : 'todoSeparateModelTemplate';
     $page = $cObj->fileResource($this->parentEvent->conf['view.']['todo.'][$modelTemplate]);
     if ($page == '') {
         return '<h3>calendar: no todo model template file found:</h3>' . $this->parentEvent->conf['view.']['todo.'][$modelTemplate];
     }
     $page = $cObj->getSubpart($page, $subpartMarker);
     if (!$page) {
         return 'could not find the >' . str_replace('###', '', $subpartMarker) . '< subpart-marker in ' . $this->parentEvent->conf['view.']['todo.']['todoModelTemplate'];
     }
     $rems = array();
     $sims = array();
     $wrapped = array();
     $this->getMarker($page, $sims, $rems, $wrapped, $this->parentEvent->conf['view']);
     return $this->parentEvent->finish(\TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, $rems, $wrapped));
 }
Exemple #9
0
 /**
  * The function adds location markers into the event template
  *
  * @param Object $moduleCaller
  *        	Instance of the event model (phpicalendar_model)
  */
 public function start(&$moduleCaller)
 {
     if ($moduleCaller->getLocationId() > 0) {
         $this->modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
         $this->cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'cobj');
         $moduleCaller->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cal']);
         $useLocationStructure = $moduleCaller->confArr['useLocationStructure'] ? $moduleCaller->confArr['useLocationStructure'] : 'tx_cal_location';
         $location = $this->modelObj->findLocation($moduleCaller->getLocationId(), $useLocationStructure);
         if (is_object($location)) {
             $page = $this->cObj->fileResource($moduleCaller->conf['module.']['locationloader.']['template']);
             if ($page == '') {
                 return '<h3>module locationloader: no template file found:</h3>' . $moduleCaller->conf['module.']['locationloader.']['template'];
             }
             $sims = array();
             $rems = array();
             $wrapped = array();
             $location->getMarker($page, $sims, $rems, $wrapped);
             return \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, $rems, array());
         }
     }
     return '';
 }
Exemple #10
0
 /**
  * Draws a create category form.
  * 
  * @param
  *        	string		Comma separated list of pids.
  * @param
  *        	object		A location or organizer object to be updated
  * @return string HTML output.
  */
 public function drawConfirmCategory()
 {
     $this->objectString = 'category';
     $this->isConfirm = true;
     unset($this->controller->piVars['formCheck']);
     $page = $this->cObj->fileResource($this->conf['view.']['confirm_category.']['template']);
     if ($page == '') {
         return '<h3>category: no create category template file found:</h3>' . $this->conf['view.']['confirm_category.']['template'];
     }
     $a = array();
     $this->object = new \TYPO3\CMS\Cal\Model\CategoryModel($a, '');
     $this->object->updateWithPIVars($this->controller->piVars);
     $lastViewParams = $this->controller->shortenLastViewAndGetTargetViewParameters();
     if ($lastViewParams['view'] == 'edit_category') {
         $this->isEditMode = true;
     }
     $rems = array();
     $sims = array();
     $wrapped = array();
     $sims['###L_CONFIRM_CATEGORY###'] = $this->controller->pi_getLL('l_confirm_category');
     $sims['###UID###'] = $this->conf['uid'];
     $sims['###TYPE###'] = $this->conf['type'];
     $sims['###VIEW###'] = 'save_category';
     $sims['###L_SUBMIT###'] = $this->controller->pi_getLL('l_submit');
     $sims['###L_CANCEL###'] = $this->controller->pi_getLL('l_cancel');
     $sims['###ACTION_URL###'] = htmlspecialchars($this->controller->pi_linkTP_keepPIvars_url(array('view' => 'save_category')));
     $this->getTemplateSubpartMarker($page, $sims, $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     $sims = array();
     $rems = array();
     $wrapped = array();
     $this->getTemplateSingleMarker($page, $sims, $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     return \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
 }
Exemple #11
0
 function retrievePostData(&$insertFields)
 {
     $hidden = 0;
     if ($this->conf['rights.']['create.']['location.']['fields.']['hidden.']['default'] && !$this->rightsObj->isAllowedTo('create', 'location', 'hidden') && !$this->rightsObj->isAllowedTo('create', 'location', 'hidden')) {
         $hidden = $this->conf['rights.']['create.']['location.']['fields.']['hidden.']['default'];
     } else {
         if ($this->conf['rights.']['edit.']['location.']['fields.']['hidden.']['default'] && !$this->rightsObj->isAllowedTo('edit', 'location', 'hidden') && !$this->rightsObj->isAllowedTo('create', 'location', 'hidden')) {
             $hidden = $this->conf['rights.']['location.']['event.']['fields.']['hidden.']['default'];
         } else {
             if ($this->controller->piVars['hidden'] == 'true' && ($this->rightsObj->isAllowedTo('edit', 'location', 'hidden') || $this->rightsObj->isAllowedTo('create', 'location', 'hidden'))) {
                 $hidden = 1;
             }
         }
     }
     $insertFields['hidden'] = $hidden;
     if ($this->rightsObj->isAllowedToEditLocationName() || $this->rightsObj->isAllowedToCreateLocationName()) {
         $insertFields['name'] = strip_tags($this->controller->piVars['name']);
     }
     if ($this->rightsObj->isAllowedToEditLocationDescription() || $this->rightsObj->isAllowedToCreateLocationDescription()) {
         $insertFields['description'] = $this->cObj->removeBadHTML($this->controller->piVars['description'], $this->conf);
     }
     if ($this->rightsObj->isAllowedToEditLocationStreet() || $this->rightsObj->isAllowedToCreateLocationStreet()) {
         $insertFields['street'] = strip_tags($this->controller->piVars['street']);
     }
     if ($this->rightsObj->isAllowedToEditLocationZip() || $this->rightsObj->isAllowedToCreateLocationZip()) {
         $insertFields['zip'] = strip_tags($this->controller->piVars['zip']);
     }
     if ($this->rightsObj->isAllowedToEditLocationCity() || $this->rightsObj->isAllowedToCreateLocationCity()) {
         $insertFields['city'] = strip_tags($this->controller->piVars['city']);
     }
     if ($this->rightsObj->isAllowedToEditLocationCountryZone() || $this->rightsObj->isAllowedToCreateLocationCountryZone()) {
         $insertFields['country_zone'] = strip_tags($this->controller->piVars['countryzone']);
     }
     if ($this->rightsObj->isAllowedToEditLocationCountry() || $this->rightsObj->isAllowedToCreateLocationCountry()) {
         $insertFields['country'] = strip_tags($this->controller->piVars['country']);
     }
     if ($this->rightsObj->isAllowedToEditLocationPhone() || $this->rightsObj->isAllowedToCreateLocationPhone()) {
         $insertFields['phone'] = strip_tags($this->controller->piVars['phone']);
     }
     if ($this->rightsObj->isAllowedTo('edit', 'location', 'fax') || $this->rightsObj->isAllowedTo('create', 'location', 'fax')) {
         $insertFields['fax'] = strip_tags($this->controller->piVars['fax']);
     }
     if ($this->rightsObj->isAllowedToEditLocationEmail() || $this->rightsObj->isAllowedToCreateLocationEmail()) {
         $insertFields['email'] = strip_tags($this->controller->piVars['email']);
     }
     if ($this->rightsObj->isAllowedTo('edit', 'location', 'link') || $this->rightsObj->isAllowedTo('create', 'location', 'link')) {
         $insertFields['link'] = strip_tags($this->controller->piVars['link']);
     }
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('wec_map') && ($insertFields['street'] != '' || $insertFields['city'] != '' || $insertFields['country_zone'] != '' || $insertFields['zip'] != '' || $insertFields['country'])) {
         /* Geocode the address */
         $lookupTable = \TYPO3\CMS\Cal\Utility\Functions::makeInstance('tx_wecmap_cache');
         $latlong = $lookupTable->lookup($insertFields['street'], $insertFields['city'], $insertFields['country_zone'], $insertFields['zip'], $insertFields['country']);
         $insertFields['latitude'] = $latlong['lat'];
         $insertFields['longitude'] = $latlong['long'];
     }
 }
 /**
  * Attempts to subscribe an email address to a particular event if the
  * subscription hash matches.
  * 
  * @param
  *        	string		Email address to subscribe.
  * @param
  *        	object		Event that email should be subscribed to.
  * @param
  *        	string		Unique Hash of email and event.
  * @return boolean whether subscribe was successful.
  * @todo Should we always try to subscribe as a frontend user first?
  */
 function subscribe($email, $event, $subscriptionHash)
 {
     $md5 = md5($event->getUid() . $email . $event->getCreationDate());
     $eventUID = $event->getUID();
     $eventPID = $event->getPID();
     $offset = $this->conf['view.']['event.']['remind.']['time'];
     /* If the subscription hash matches, subscribe */
     if ($md5 == $subscriptionHash) {
         $user_uid = $this->getFrontendUserUid($email);
         $user_table = 'fe_users';
         /* If we didn't find a matching frontend user, try unknown users */
         if (!$user_uid) {
             $user_uid = $this->getUnknownUserUid($email);
             $user_table = 'tx_cal_unknown_users';
         }
         /* Insert the user ID into the monitor table */
         $this->insertMMRow('tx_cal_fe_user_event_monitor_mm', $eventUID, $user_uid, $user_table, 1, $offset, $eventPID);
         $pageTSConf = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($eventPID);
         $offset = is_numeric($pageTSConf['options.']['tx_cal_controller.']['view.']['event.']['remind.']['time']) ? $pageTSConf['options.']['tx_cal_controller.']['view.']['event.']['remind.']['time'] * 60 : 0;
         $date = new \TYPO3\CMS\Cal\Model\CalDate($insertFields['start_date'] . '000000');
         $date->setTZbyId('UTC');
         $reminderTimestamp = $date->getTime() + $insertFields['start_time'] - $offset;
         $reminderService =& \TYPO3\CMS\Cal\Utility\Functions::getReminderService();
         $reminderService->scheduleReminder($eventUID);
         return true;
     }
     return false;
 }
Exemple #13
0
 function getEnddate()
 {
     $end = $this->getEnd();
     return $end->format(\TYPO3\CMS\Cal\Utility\Functions::getFormatStringFromConf($this->parentEvent->conf));
 }
Exemple #14
0
 public function getTabbedMenuMarker($template, &$sims, &$rems, $view)
 {
     $tabbedMenuConf = $this->conf['view.'][$view . '.']['tabbedMenu.'];
     foreach ((array) $tabbedMenuConf as $id => $tab) {
         if (\TYPO3\CMS\Cal\Utility\Functions::endsWith($id, '.') && $tab['requiredFields'] != '') {
             $requiredFields = GeneralUtility::trimExplode(',', $tab['requiredFields'], 1);
             $isAllowed = false;
             foreach ($requiredFields as $field) {
                 if ($this->isAllowed($field)) {
                     $isAllowed = true;
                     break;
                 }
             }
             if (!$isAllowed) {
                 unset($tabbedMenuConf[$id]);
                 unset($tabbedMenuConf[$id . '.']);
             }
         }
     }
     $sims['###TABBED_MENU###'] = $this->cObj->cObjGetSingle($this->conf['view.'][$view . '.']['tabbedMenu'], $tabbedMenuConf);
 }
Exemple #15
0
 function getFormStartMarker(&$template, &$sims, &$rems)
 {
     $temp = $this->cObj->getSubpart($template, '###FORM_START###');
     $temp_sims = array();
     $temp_sims['###L_WRONG_SPLIT_SYMBOL_MSG###'] = str_replace('###DATE_SPLIT_SYMBOL###', $this->conf['dateConfig.']['splitSymbol'], $this->controller->pi_getLL('l_wrong_split_symbol_msg'));
     $temp_sims['###L_WRONG_DATE_MSG###'] = $this->controller->pi_getLL('l_wrong_date');
     $temp_sims['###L_WRONG_TIME_MSG###'] = $this->controller->pi_getLL('l_wrong_time');
     $temp_sims['###L_IS_IN_PAST_MSG###'] = $this->controller->pi_getLL('l_is_in_past');
     $rems['###FORM_START###'] = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($temp, $temp_sims, array(), array());
 }
Exemple #16
0
    $_SESSION['cal_api_' . $pid . '_conf'] = $calAPI->conf;
    $_SESSION['cal_api_' . $pid . '_tsfe'] = $GLOBALS['TSFE'];
    $_SESSION['cal_api_' . $pid . '_tca'] = $GLOBALS['TCA'];
}
if ($controllerPiVars['translations']) {
    if ($calAPI->controller->conf['language']) {
        $calAPI->controller->LLkey = $calAPI->controller->conf['language'];
    }
    $tempScriptRelPath = $calAPI->controller->scriptRelPath;
    $calAPI->controller->scriptRelPath = $calAPI->controller->locallangPath;
    $calAPI->controller->pi_loadLL();
    $calAPI->controller->scriptRelPath = $tempScriptRelPath;
    switch ($controllerPiVars['translations']) {
        case 'day':
        case 'month':
            $returnValue = array("timeSeparator" => ' ' . $calAPI->controller->pi_getLL('l_to') . ' ', "newEventText" => $calAPI->controller->pi_getLL('l_new_event'), "shortMonths" => \TYPO3\CMS\Cal\Utility\Functions::getMonthNames('%b'), "longMonths" => \TYPO3\CMS\Cal\Utility\Functions::getMonthNames('%B'), "shortDays" => \TYPO3\CMS\Cal\Utility\Functions::getWeekdayNames('%a'), "longDays" => \TYPO3\CMS\Cal\Utility\Functions::getWeekdayNames('%A'), "buttonText" => array('today' => $calAPI->controller->pi_getLL('l_today'), 'lastWeek' => $calAPI->controller->pi_getLL('l_prev'), 'nextWeek' => $calAPI->controller->pi_getLL('l_next'), 'create' => $calAPI->controller->pi_getLL('l_create'), 'edit' => $calAPI->controller->pi_getLL('l_edit'), 'deleteText' => $calAPI->controller->pi_getLL('l_delete'), 'save' => $calAPI->controller->pi_getLL('l_save'), 'cancel' => $calAPI->controller->pi_getLL('l_cancel')));
            $ajax_return_data = json_encode($returnValue);
            $htmlheader_contenttype = 'Content-Type: application/json';
            break;
    }
} else {
    if (is_array($controllerPiVars['translate'])) {
        $tempScriptRelPath = $calAPI->controller->scriptRelPath;
        $calAPI->controller->scriptRelPath = $calAPI->controller->locallangPath;
        $calAPI->controller->pi_loadLL();
        $calAPI->controller->scriptRelPath = $tempScriptRelPath;
        $translationArray = array();
        foreach ($controllerPiVars['translate'] as $value) {
            $translationArray[$value] = $calAPI->controller->pi_getLL('l_' . strtolower($value));
        }
        $ajax_return_data = json_encode($translationArray);
Exemple #17
0
 /**
  *
  * @param
  *        	array	iCalendar component array
  * @return array
  */
 function insertCalEventsIntoDB($iCalendarComponentArray = array(), $calId, $pid = '', $cruserId = '', $isTemp = 1, $deleteNotUsedCategories = true)
 {
     $insertedOrUpdatedEventUids = array();
     $insertedOrUpdatedCategoryUids = array();
     if (empty($iCalendarComponentArray)) {
         return $insertedOrUpdatedEventUids;
     }
     $offsetArray = array();
     foreach ($iCalendarComponentArray as $component) {
         $table = 'tx_cal_event';
         $insertFields = array();
         $insertFields['isTemp'] = $isTemp;
         $insertFields['tstamp'] = time();
         $insertFields['crdate'] = time();
         $insertFields['pid'] = $pid;
         if (is_a($component, '\\TYPO3\\CMS\\Cal\\Model\\ICalendar\\vevent')) {
             $insertFields['cruser_id'] = $cruserId;
             $insertFields['calendar_id'] = $calId;
             if ($component->getAttribute('DTSTART')) {
                 $startdate = $component->getAttribute('DTSTART');
                 if (is_array($startdate)) {
                     $dateTime = new \TYPO3\CMS\Cal\Model\CalDate($startdate['year'] . $startdate['month'] . $startdate['mday'] . '000000');
                 } else {
                     $dateTime = new \TYPO3\CMS\Cal\Model\CalDate($startdate);
                 }
                 $params = $component->getAttributeParameters('DTSTART');
                 $timezone = $params['TZID'];
                 if ($timezone) {
                     $dateTime->convertTZbyID($timezone);
                 }
                 $insertFields['start_date'] = $dateTime->format('%Y%m%d');
                 $insertFields['start_time'] = $dateTime->hour * 3600 + $dateTime->minute * 60;
             } else {
                 continue;
             }
             if ($component->getAttribute('DTEND')) {
                 $enddate = $component->getAttribute('DTEND');
                 if (is_array($enddate)) {
                     $dateTime = new \TYPO3\CMS\Cal\Model\CalDate($enddate['year'] . $enddate['month'] . $enddate['mday'] . '000000');
                 } else {
                     $dateTime = new \TYPO3\CMS\Cal\Model\CalDate($enddate);
                 }
                 $params = $component->getAttributeParameters('DTEND');
                 $timezone = $params['TZID'];
                 if ($timezone) {
                     $dateTime->convertTZbyID($timezone);
                 }
                 $insertFields['end_date'] = $dateTime->format('%Y%m%d');
                 $insertFields['end_time'] = $dateTime->hour * 3600 + $dateTime->minute * 60;
             }
             if ($component->getAttribute('DURATION')) {
                 $enddate = $insertFields['start_time'] + $component->getAttribute('DURATION');
                 $dateTime = new \TYPO3\CMS\Cal\Model\CalDate($insertFields['start_date']);
                 $dateTime->addSeconds($enddate);
                 $params = $component->getAttributeParameters('DURATION');
                 $timezone = $params['TZID'];
                 if ($timezone) {
                     $dateTime->convertTZbyID($timezone);
                 }
                 $insertFields['end_date'] = $dateTime->format('%Y%m%d');
                 $insertFields['end_time'] = $dateTime->hour * 3600 + $dateTime->minute * 60;
             }
             $insertFields['icsUid'] = $component->getAttribute('UID');
             $insertFields['title'] = $component->getAttribute('SUMMARY');
             if ($component->organizerName()) {
                 $insertFields['organizer'] = str_replace('"', '', $component->organizerName());
             }
             $insertFields['location'] = $component->getAttribute('LOCATION');
             if ($insertFields['location'] == null) {
                 $insertFields['location'] = '';
             }
             $insertFields['description'] = $component->getAttribute('DESCRIPTION');
             $categoryString = $component->getAttribute('CATEGORY');
             if ($categoryString == "") {
                 $categoryString = $component->getAttribute('CATEGORIES');
             }
             $categories = GeneralUtility::trimExplode(',', $categoryString, 1);
             $categoryUids = array();
             foreach ($categories as $category) {
                 $category = trim($category);
                 $categorySelect = '*';
                 $categoryTable = 'tx_cal_category';
                 $categoryWhere = 'calendar_id = ' . intval($calId) . ' AND title =' . $GLOBALS['TYPO3_DB']->fullQuoteStr($category, $categoryTable);
                 $foundCategory = false;
                 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($categorySelect, $categoryTable, $categoryWhere);
                 if ($result) {
                     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                         $foundCategory = true;
                         $categoryUids[] = $row['uid'];
                     }
                     $GLOBALS['TYPO3_DB']->sql_free_result($result);
                 }
                 if (!$foundCategory) {
                     $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery($categoryTable, array('tstamp' => $insertFields['tstamp'], 'crdate' => $insertFields['crdate'], 'pid' => $pid, 'title' => $category, 'calendar_id' => $calId));
                     if (FALSE === $result) {
                         throw new \RuntimeException('Could not write ' . $categoryTable . ' record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458143);
                     }
                     $categoryUids[] = $GLOBALS['TYPO3_DB']->sql_insert_id();
                 }
             }
             if ($component->getAttribute('RRULE')) {
                 $rrule = $component->getAttribute('RRULE');
                 $this->insertRuleValues($rrule, $insertFields);
             }
             if ($component->getAttribute('RDATE')) {
                 $rdate = $component->getAttribute('RDATE');
                 if (is_array($rdate)) {
                     $insertFields['rdate'] = implode(',', $rdate);
                 } else {
                     $insertFields['rdate'] = $rdate;
                 }
                 if ($component->getAttributeParameters('RDATE')) {
                     $parameterArray = $component->getAttributeParameters('RDATE');
                     $keys = array_keys($parameterArray);
                     $insertFields['rdate_type'] = strtolower($keys[0]);
                 } else {
                     $insertFields['rdate_type'] = 'date_time';
                 }
             }
             // Fix for allday events
             if ($insertFields['start_time'] == 0 && $insertFields['end_time'] == 0) {
                 $date = new \TYPO3\CMS\Cal\Model\CalDate($insertFields['end_date'] . '000000');
                 $date->setTZbyId('UTC');
                 $date->subtractSeconds(86400);
                 $insertFields['end_date'] = $date->format('%Y%m%d');
             }
             $eventRow = BackendUtility::getRecordRaw('tx_cal_event', 'icsUid="' . $insertFields['icsUid'] . '"');
             if ($eventRow['uid']) {
                 $result = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . $eventRow['uid'], $insertFields);
                 $eventUid = $eventRow['uid'];
             } else {
                 $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields);
                 if (FALSE === $result) {
                     throw new \RuntimeException('Could not write ' . $table . ' record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458144);
                 }
                 $eventUid = $GLOBALS['TYPO3_DB']->sql_insert_id();
             }
             $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cal']);
             if ($component->getAttribute('RECURRENCE-ID')) {
                 $recurrenceIdStart = new \TYPO3\CMS\Cal\Model\CalDate($component->getAttribute('RECURRENCE-ID'));
                 $params = $component->getAttributeParameters('RECURRENCE-ID');
                 $timezone = $params['TZID'];
                 if ($timezone) {
                     $recurrenceIdStart->convertTZbyID($timezone);
                 }
                 $indexEntry = BackendUtility::getRecordRaw('tx_cal_index', 'event_uid="' . $eventUid . '" AND start_datetime="' . $recurrenceIdStart->format('%Y%m%d%H%M%S') . '"');
                 if ($indexEntry) {
                     $origStartDate = new \TYPO3\CMS\Cal\Model\CalDate();
                     $origStartDate = new \TYPO3\CMS\Cal\Model\CalDate();
                     $table = 'tx_cal_event_deviation';
                     $insertFields['parentid'] = $eventUid;
                     $insertFields['orig_start_time'] = $recurrenceIdStart->getHour() * 3600 + $recurrenceIdStart->getMinute() * 60;
                     $recurrenceIdStart->setHour(0);
                     $recurrenceIdStart->setMinute(0);
                     $recurrenceIdStart->setSecond(0);
                     $insertFields['orig_start_date'] = $recurrenceIdStart->getTime();
                     unset($insertFields['calendar_id']);
                     if ($indexEntry['event_deviation_uid'] > 0) {
                         $result = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . $indexEntry['event_deviation_uid'], $insertFields);
                         $eventDeviationUid = $indexEntry['event_deviation_uid'];
                     } else {
                         $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields);
                         if (FALSE === $result) {
                             throw new \RuntimeException('Could not write ' . $table . ' record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458145);
                         }
                         $eventDeviationUid = $GLOBALS['TYPO3_DB']->sql_insert_id();
                     }
                     $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_cal_index', 'uid=' . $indexEntry['uid'], array('event_deviation_uid' => $eventDeviationUid));
                 }
             } else {
                 /* Delete the old exception relations */
                 $exceptionEventUidsToBeDeleted = array();
                 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_cal_exception_event.uid', 'tx_cal_exception_event,tx_cal_exception_event_mm', 'tx_cal_exception_event.uid = tx_cal_exception_event_mm.uid_foreign AND tx_cal_exception_event_mm.uid_local=' . $eventUid);
                 if ($result) {
                     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                         $exceptionEventUidsToBeDeleted[] = $row['uid'];
                     }
                     $GLOBALS['TYPO3_DB']->sql_free_result($result);
                 }
                 if (!empty($exceptionEventUidsToBeDeleted)) {
                     $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_exception_event', 'uid in (' . implode(',', $exceptionEventUidsToBeDeleted) . ')');
                 }
                 $exceptionEventGroupUidsToBeDeleted = array();
                 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_cal_exception_event_group.uid', 'tx_cal_exception_event_group,tx_cal_exception_event_group_mm', 'tx_cal_exception_event_group.uid = tx_cal_exception_event_group_mm.uid_foreign AND tx_cal_exception_event_group_mm.uid_local=' . $eventUid);
                 if ($result) {
                     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                         $exceptionEventGroupUidsToBeDeleted[] = $row['uid'];
                     }
                     $GLOBALS['TYPO3_DB']->sql_free_result($result);
                 }
                 if (!empty($exceptionEventGroupUidsToBeDeleted)) {
                     $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_exception_event_group', 'uid in (' . implode(',', $exceptionEventGroupUidsToBeDeleted) . ')');
                 }
                 $where = ' uid_local=' . $eventUid;
                 $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_exception_event_mm', $where);
                 $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_exception_event_group_mm', $where);
                 // Exceptions:
                 if ($component->getAttribute('EXDATE')) {
                     if (is_array($component->getAttribute('EXDATE'))) {
                         foreach ($component->getAttribute('EXDATE') as $exceptionDescription) {
                             $this->createException($pid, $cruserId, $eventUid, $exceptionDescription);
                         }
                     } else {
                         $this->createException($pid, $cruserId, $eventUid, $component->getAttribute('EXDATE'));
                     }
                 }
                 if ($component->getAttribute('EXRULE')) {
                     if (is_array($component->getAttribute('EXRULE'))) {
                         foreach ($component->getAttribute('EXRULE') as $exceptionDescription) {
                             $this->createExceptionRule($pid, $cruserId, $eventUid, $exceptionDescription);
                         }
                     } else {
                         $this->createExceptionRule($pid, $cruserId, $eventUid, $component->getAttribute('EXRULE'));
                     }
                 }
                 $pageTSConf = BackendUtility::getPagesTSconfig($pid);
                 if ($pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']) {
                     $pageIDForPlugin = $pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin'];
                 } else {
                     $pageIDForPlugin = $pid;
                 }
                 /** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
                 $rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator', $pageIDForPlugin);
                 $rgc->generateIndexForUid($eventUid, 'tx_cal_event');
                 if ($this->conf['view.']['event.']['remind']) {
                     /* Schedule reminders for new and changed events */
                     $pageTSConf = BackendUtility::getPagesTSconfig($pid);
                     $offset = is_numeric($pageTSConf['options.']['tx_cal_controller.']['view.']['event.']['remind.']['time']) ? $pageTSConf['options.']['tx_cal_controller.']['view.']['event.']['remind.']['time'] * 60 : 0;
                     $date = new \TYPO3\CMS\Cal\Model\CalDate($insertFields['start_date'] . '000000');
                     $date->setTZbyId('UTC');
                     $reminderTimestamp = $date->getTime() + $insertFields['start_time'] - $offset;
                     $reminderService =& \TYPO3\CMS\Cal\Utility\Functions::getReminderService();
                     $reminderService->scheduleReminder($eventUid);
                 }
                 /* Delete the old category relations */
                 $where = ' uid_local=' . $eventUid;
                 $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_event_category_mm', $where);
                 foreach ($categoryUids as $uid) {
                     $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_cal_event_category_mm', array('uid_local' => $eventUid, 'uid_foreign' => $uid));
                     if (FALSE === $result) {
                         throw new \RuntimeException('Could not write tx_cal_event_category_mm record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458146);
                     }
                 }
                 $insertedOrUpdatedEventUids[] = $eventUid;
                 $insertedOrUpdatedCategoryUids = array_merge($insertedOrUpdatedCategoryUids, $categoryUids);
                 // Hook: insertCalEventsIntoDB
                 $hookObjectsArr = \TYPO3\CMS\Cal\Utility\Functions::getHookObjectsArray('tx_cal_icalendar_service', 'iCalendarServiceClass', 'service');
                 foreach ($hookObjectsArr as $hookObj) {
                     if (method_exists($hookObj, 'insertCalEventsIntoDB')) {
                         $hookObj->insertCalEventsIntoDB($this, $eventUid, $component);
                     }
                 }
             }
         }
     }
     if ($deleteNotUsedCategories) {
         /* Delete the categories */
         $where = ' calendar_id=' . $calId;
         if (!empty($insertedOrUpdatedCategoryUids)) {
             array_unique($insertedOrUpdatedCategoryUids);
             $where .= ' AND uid NOT IN (' . implode(',', $insertedOrUpdatedCategoryUids) . ')';
         }
         $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cal']);
         $GLOBALS['TYPO3_DB']->exec_DELETEquery($extConf['categoryService'], $where);
     }
     return $insertedOrUpdatedEventUids;
 }
Exemple #18
0
 public function testFirstDayOfWeek1OfYear2013WeekstartSunday_is_20130304()
 {
     $this->assertEquals('20130304', \TYPO3\CMS\Cal\Utility\Functions::getDayByWeek(2013, 10, 1));
 }
Exemple #19
0
 /**
  * Draws the week view.
  * 
  * @param $master_array array
  *        	The events to be drawn.
  * @param $getdate integer
  *        	The date of the event
  * @return string The HTML output.
  */
 public function drawWeek(&$master_array, $getdate)
 {
     if ($this->conf['useNewTemplatesAndRendering']) {
         return $this->newDrawWeek($master_array, $getdate);
     }
     $this->_init($master_array);
     $page = $this->cObj->fileResource($this->conf['view.']['week.']['weekTemplate']);
     if ($page == '') {
         return "<h3>week: no template file found:</h3>" . $this->conf['view.']['week.']['weekTemplate'] . "<br />Please check your template record and add both cal items at 'include static (from extension)'";
     }
     $weekTemplate = $this->cObj->getSubpart($page, '###WEEK_TEMPLATE###');
     if ($weekTemplate == '') {
         $rems = array();
         return $this->finish($page, $rems);
     }
     $dayStart = $this->conf['view.']['day.']['dayStart'];
     // '0700'; // Start time for day grid
     $dayEnd = $this->conf['view.']['day.']['dayEnd'];
     // '2300'; // End time for day grid
     $gridLength = $this->conf['view.']['day.']['gridLength'];
     // '15'; // Grid distance in minutes for day view, multiples of 15 preferred
     if (!isset($getdate) || $getdate == '') {
         $getdate_obj = new \TYPO3\CMS\Cal\Model\CalDate();
         $getdate = $getdate_obj->format('%Y%m%d');
     }
     $day_array2 = array();
     preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $getdate, $day_array2);
     $this_day = $day_array2[3];
     $this_month = $day_array2[2];
     $this_year = $day_array2[1];
     $unix_time = new \TYPO3\CMS\Cal\Model\CalDate($getdate . '000000');
     $today = new \TYPO3\CMS\Cal\Model\CalDate();
     $todayFormatted = $today->format('%Y%m%d');
     $now = new \TYPO3\CMS\Cal\Model\CalDate($getdate . '000000');
     $endOfNextMonth = new \TYPO3\CMS\Cal\Model\CalDate(Calc::endOfNextMonth($this_day, $this_month, $this_year));
     $now->addSeconds(60 * 60 * 24 * 31);
     $next_month = $now->format('%Y%m%d');
     if ($now->after($endOfNextMonth)) {
         $next_month = $endOfNextMonth->format('%Y%m%d');
     }
     $now = new \TYPO3\CMS\Cal\Model\CalDate($getdate . '000000');
     $startOfPrevMonth = new \TYPO3\CMS\Cal\Model\CalDate(Calc::endOfPrevMonth($this_day, $this_month, $this_year));
     $startOfPrevMonth->setDay(1);
     $now->subtractSeconds(60 * 60 * 24 * 31);
     $prev_month = $now->format('%Y%m%d');
     if ($now->before($startOfPrevMonth)) {
         $prev_month = $startOfPrevMonth->format('%Y%m%d');
     }
     $dateOfMonth = Calc::beginOfWeek(1, $this_month, $this_year);
     $start_month_day = new \TYPO3\CMS\Cal\Model\CalDate($dateOfMonth . '000000');
     $thisday2 = $unix_time->format($this->conf['view.']['week.']['dateFormatWeekList']);
     $num_of_events2 = 0;
     $next_week_obj = new \TYPO3\CMS\Cal\Model\CalDate();
     $next_week_obj->copy($unix_time);
     $next_week_obj->addSeconds(60 * 60 * 24 * 7);
     $next_week = $next_week_obj->format('%Y%m%d');
     $next_week_obj->subtractSeconds(60 * 60 * 24 * 7 * 2);
     $prev_week = $next_week_obj->format('%Y%m%d');
     $next_day_obj = $unix_time->getNextDay();
     $next_day = $next_day_obj->format('%Y%m%d');
     $prev_day_obj = $unix_time->getPrevDay();
     $prev_day = $prev_day_obj->format('%Y%m%d');
     $dateOfWeek = Calc::beginOfWeek($unix_time->getDay(), $unix_time->getMonth(), $unix_time->getYear());
     $week_start_day = new \TYPO3\CMS\Cal\Model\CalDate($dateOfWeek . '000000');
     // Nasty fix to work with TS strftime
     $start_week_time = new \TYPO3\CMS\Cal\Model\CalDate($dateOfWeek . '000000');
     $start_week_time->setTZbyID('UTC');
     $end_week_time = new \TYPO3\CMS\Cal\Model\CalDate();
     $end_week_time->copy($start_week_time);
     $end_week_time->addSeconds(604799);
     $GLOBALS['TSFE']->register['cal_week_endtime'] = $end_week_time->getTime();
     $GLOBALS['TSFE']->register['cal_week_starttime'] = $start_week_time->getTime();
     $display_date = $this->cObj->cObjGetSingle($this->conf['view.']['week.']['titleWrap'], $this->conf['view.']['week.']['titleWrap.']);
     $this->initLocalCObject();
     $dayLinkViewTarget =& $this->conf['view.']['dayLinkTarget'];
     $this->local_cObj->data['view'] = $dayLinkViewTarget;
     $this->local_cObj->setCurrentVal($this->conf['view.']['week.']['legendNextDayLink']);
     $legend_next_day_link = $this->local_cObj->cObjGetSingle($this->conf['view.']['week.']['legendNextDayLink'], $this->conf['view.']['week.']['legendNextDayLink.']);
     $this->local_cObj->setCurrentVal($this->conf['view.']['week.']['legendPrevDayLink']);
     $legend_prev_day_link = $this->local_cObj->cObjGetSingle($this->conf['view.']['week.']['legendPrevDayLink'], $this->conf['view.']['week.']['legendPrevDayLink.']);
     // Figure out colspans
     $dayborder = 0;
     $thisdate = $start_week_time;
     $eventArray = array();
     $view_array = array();
     $rowspan_array = array();
     $endOfDay = new \TYPO3\CMS\Cal\Model\CalDate();
     $startOfDay = new \TYPO3\CMS\Cal\Model\CalDate();
     // creating the dateObjects only once:
     $starttime = new \TYPO3\CMS\Cal\Model\CalDate();
     $endtime = new \TYPO3\CMS\Cal\Model\CalDate();
     $j = new \TYPO3\CMS\Cal\Model\CalDate();
     if (count($this->master_array) > 0) {
         $masterKeys = array_keys($this->master_array);
         foreach ($masterKeys as $ovlKey) {
             $dTimeStart = array();
             $dTimeEnd = array();
             $dDate = array();
             preg_match('/([0-9]{2})([0-9]{2})/', $this->conf['view.']['day.']['dayStart'], $dTimeStart);
             preg_match('/([0-9]{2})([0-9]{2})/', $this->conf['view.']['day.']['dayEnd'], $dTimeEnd);
             preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $ovlKey, $dDate);
             $d_start = new \TYPO3\CMS\Cal\Model\CalDate($dDate[1] . $dDate[2] . $dDate[3] . ' ' . $dTimeStart[1] . ':' . sprintf("%02d", $dTimeStart[2]) . ':00');
             $d_start->setTZbyID('UTC');
             $d_end = new \TYPO3\CMS\Cal\Model\CalDate($dDate[1] . $dDate[2] . $dDate[3] . ' ' . $dTimeEnd[1] . ':' . sprintf("%02d", $dTimeEnd[2]) . ':00');
             $d_end->setTZbyID('UTC');
             // minus 1 second to allow endtime 24:00
             $d_end->subtractSeconds(1);
             $ovlTimeKeys = array_keys($this->master_array[$ovlKey]);
             foreach ($ovlTimeKeys as $ovl_time_key) {
                 $ovlDayKeys = array_keys($this->master_array[$ovlKey][$ovl_time_key]);
                 foreach ($ovlDayKeys as $ovl2Key) {
                     $event =& $this->master_array[$ovlKey][$ovl_time_key][$ovl2Key];
                     $eventStart = $event->getStart();
                     $eventMappingKey = $event->getType() . '_' . $event->getUid() . '_' . $eventStart->format('%Y%m%d%H%M');
                     $eventArray[$ovlKey . '_' . $eventMappingKey] =& $event;
                     $starttime->copy($event->getStart());
                     $endtime->copy($event->getEnd());
                     if ($ovl_time_key == '-1') {
                         $j->copy($starttime);
                         $view_array[$j->format('%Y%m%d')]['-1'][] = $ovlKey . '_' . $eventMappingKey;
                         $j->addSeconds(86400);
                         for (; $j->before($endtime) && $j->before($end_week_time); $j->addSeconds(86400)) {
                             $view_array[$j->format('%Y%m%d')]['-1'][] = $ovlKey . '_' . $eventMappingKey;
                         }
                     } else {
                         if ($starttime->before($end_week_time)) {
                             $starttime->subtractSeconds($starttime->getMinute() % $gridLength * 60);
                             $endtime->addSeconds($endtime->getMinute() % $gridLength * 60);
                             $entries = 1;
                             $old_day = new \TYPO3\CMS\Cal\Model\CalDate($ovlKey . '000000');
                             $endOfDay->copy($d_end);
                             $startOfDay->copy($d_start);
                             // get x-array possition
                             for ($k = 0; $k < count($view_array[$ovlKey]); $k++) {
                                 if (empty($view_array[$starttime->format('%Y%m%d')][$starttime->format('%H%M')][$k])) {
                                     break;
                                 }
                             }
                             $j->copy($starttime);
                             if ($j->before($startOfDay)) {
                                 $j->copy($startOfDay);
                             }
                             $counter = 0;
                             while ($j->before($endtime) && $j->before($end_week_time)) {
                                 $counter++;
                                 $view_array[$j->format('%Y%m%d')][$j->format('%H%M')][] = $ovlKey . '_' . $eventMappingKey;
                                 if ($j->after($endOfDay)) {
                                     $rowspan_array[$old_day->format('%Y%m%d')][$eventMappingKey] = $entries - 1;
                                     $endOfDay->addSeconds(86400);
                                     $old_day->copy($endOfDay);
                                     $startOfDay->addSeconds(86400);
                                     $j->addSeconds(86400);
                                     $j->setHour($startOfDay->getHour());
                                     $j->setMinute($startOfDay->getMinute());
                                     $j->subtractSeconds($gridLength * 60);
                                     for ($k = 0; $k < count($view_array[$startOfDay->format('%Y%m%d')]); $k++) {
                                         if (empty($view_array[$startOfDay->format('%Y%m%d')][$startOfDay->format('%H%M')][$k])) {
                                             break;
                                         }
                                     }
                                     $entries = 0;
                                     $eventArray[$startOfDay->format('%Y%m%d') . '_' . $eventMappingKey] =& $event;
                                 }
                                 $j->addSeconds($gridLength * 60);
                                 $entries++;
                             }
                             $rowspan_array[$old_day->format('%Y%m%d')][$eventMappingKey] = $entries - 1;
                         }
                     }
                 }
             }
         }
     }
     if ($this->conf['view.']['week.']['dynamic'] == 1) {
         $dayStart = '2359';
         $dayEnd = '0000';
         $firstStart = true;
         $firstEnd = true;
         $dynamicEnd = intval($end_week_time->format('%Y%m%d'));
         for ($dynamicStart = intval($start_week_time->format('%Y%m%d')); $dynamicStart < $dynamicEnd; $dynamicStart++) {
             if (is_array($view_array[$dynamicStart])) {
                 $timeKeys = array_keys($view_array[$dynamicStart]);
                 $formatedLast = array_pop($timeKeys);
                 while (intval($formatedLast) < 0 && !empty($timeKeys)) {
                     $formatedLast = array_pop($timeKeys);
                 }
                 $formatedFirst = null;
                 if (count($timeKeys) > 0) {
                     do {
                         $formatedFirst = array_shift($timeKeys);
                     } while (intval($formatedFirst) < 0 && !empty($timeKeys));
                 } else {
                     $formatedFirst = $formatedLast;
                 }
                 if (intval($formatedFirst) > 0 && (intval($formatedFirst) < intval($dayStart) || $firstStart)) {
                     $dayStart = sprintf("%04d", $formatedFirst);
                     $firstStart = false;
                 }
                 if (intval($formatedLast) > intval($dayEnd) || $firstEnd) {
                     $dayEnd = sprintf("%04d", $formatedLast + $gridLength);
                     $firstEnd = false;
                 }
             }
         }
         $dayStart = substr($dayStart, 0, 2) . '00';
     }
     $startdate = new \TYPO3\CMS\Cal\Model\CalDate($start_week_time->format('%Y%m%d') . '000000');
     $enddate = new \TYPO3\CMS\Cal\Model\CalDate();
     $enddate->copy($end_week_time);
     for ($i = $startdate; $enddate->after($i); $i->addSeconds(86400)) {
         if (!empty($view_array[$i->format('%Y%m%d')])) {
             $max = array();
             foreach (array_keys($view_array[$i->format('%Y%m%d')]) as $array_time) {
                 $c = count($view_array[$i->format('%Y%m%d')][$array_time]);
                 array_push($max, $c);
             }
             $nbrGridCols[$i->format('%Y%m%d')] = max($max);
         } else {
             $nbrGridCols[$i->format('%Y%m%d')] = 1;
         }
     }
     $t_array = array();
     $pos_array = array();
     preg_match('/([0-9]{2})([0-9]{2})/', $dayStart, $dTimeStart);
     preg_match('/([0-9]{2})([0-9]{2})/', $dayEnd, $dTimeEnd);
     $nd = new \TYPO3\CMS\Cal\Model\CalDate();
     foreach (array_keys($view_array) as $week_key) {
         $week_day =& $view_array[$week_key];
         preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $week_key, $dDate);
         $d_start = new \TYPO3\CMS\Cal\Model\CalDate($dDate[1] . $dDate[2] . $dDate[3] . ' ' . $dTimeStart[1] . ':' . sprintf("%02d", $dTimeStart[2]) . ':00');
         $d_start->setTZbyId('UTC');
         $d_end = new \TYPO3\CMS\Cal\Model\CalDate($dDate[1] . $dDate[2] . $dDate[3] . ' ' . $dTimeEnd[1] . ':' . sprintf("%02d", $dTimeEnd[2]) . ':00');
         $d_end->setTZbyId('UTC');
         $d_start->subtractSeconds($d_start->getMinute() % $gridLength * 60);
         $d_end->addSeconds(($gridLength - $d_end->getMinute() % $gridLength) * 60);
         for ($i->copy($d_start); !$i->after($d_end); $i->addSeconds($gridLength * 60)) {
             $timeKey = $i->format('%H%M');
             if (is_array($view_array[$week_key][$timeKey]) && count($view_array[$week_key][$timeKey]) > 0) {
                 foreach (array_keys($view_array[$week_key][$timeKey]) as $eventKey) {
                     $event =& $eventArray[$view_array[$week_key][$timeKey][$eventKey]];
                     $eventStart = $event->getStart();
                     $startFormatted = $eventStart->format('%Y%m%d%H%M');
                     $eventType = $event->getType();
                     $eventUid = $event->getUid();
                     if (is_array($pos_array[$week_key]) && array_key_exists($eventType . $eventUid . '_' . $startFormatted, $pos_array[$week_key])) {
                         $nd->copy($event->getEnd());
                         $nd->addSeconds(($gridLength - $nd->getMinute() % $gridLength) * 60);
                         if ($nd->before($i)) {
                             $t_array[$week_key][$timeKey][$pos_array[$week_key][$eventType . $eventUid . '_' . $startFormatted]] = array('ended' => $week_key . '_' . $eventType . '_' . $eventUid . '_' . $startFormatted);
                         } else {
                             $t_array[$week_key][$timeKey][$pos_array[$week_key][$eventType . $eventUid . '_' . $startFormatted]] = array('started' => $week_key . '_' . $eventType . '_' . $eventUid . '_' . $startFormatted);
                         }
                     } else {
                         for ($j = 0; $j < $nbrGridCols[$week_key] ? $nbrGridCols[$week_key] : 1; $j++) {
                             if (!isset($t_array[$week_key][$timeKey][$j]) || count($t_array[$week_key][$timeKey][$j]) == 0) {
                                 $pos_array[$week_key][$event->getType() . $event->getUid() . '_' . $startFormatted] = $j;
                                 $t_array[$week_key][$timeKey][$j] = array('begin' => $week_key . '_' . $eventType . '_' . $eventUid . '_' . $startFormatted);
                                 break;
                             }
                         }
                     }
                 }
             } else {
                 $t_array[$week_key][$timeKey] = '';
             }
         }
     }
     $thisdate = new \TYPO3\CMS\Cal\Model\CalDate();
     $thisdate->copy($week_start_day);
     for ($i = 0; $i < 7; $i++) {
         $weekarray[$i] = $thisdate->format('%Y%m%d');
         $thisdate->addSeconds(86400);
     }
     $sims = array('###GETDATE###' => $getdate, '###DISPLAY_DATE###' => $display_date, '###LEGEND_PREV_DAY###' => $legend_prev_day_link, '###LEGEND_NEXT_DAY###' => $legend_next_day_link, '###SIDEBAR_DATE###' => '');
     // Replaces the allday events
     $alldays = $this->cObj->getSubpart($weekTemplate, '###ALLDAYSOFWEEK##');
     foreach ($weekarray as $get_date) {
         $replace = '';
         if (is_array($view_array[$get_date]['-1'])) {
             foreach ($view_array[$get_date]['-1'] as $id => $allday) {
                 $replace .= $eventArray[$allday]->renderEventForAllDay();
             }
         }
         $weekreplace .= \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($alldays, array('###COLSPAN###' => 'colspan="' . ($nbrGridCols[$get_date] ? $nbrGridCols[$get_date] : 1) . '"', '###ALLDAY###' => $replace));
     }
     $rems = array();
     $rems['###ALLDAYSOFWEEK###'] = $weekreplace;
     // Replaces the daysofweek
     $loop_dof = $this->cObj->getSubpart($weekTemplate, '###DAYSOFWEEK###');
     $start_day = new \TYPO3\CMS\Cal\Model\CalDate();
     $start_day->copy($week_start_day);
     $isAllowedToCreateEvent = $this->rightsObj->isAllowedToCreateEvent();
     for ($i = 0; $i < 7; $i++) {
         $day_num = $start_day->format('%w');
         $daylink = $start_day->format('%Y%m%d');
         $weekday = $start_day->format($this->conf['view.']['week.']['dateFormatWeekList']);
         if ($daylink == $getdate) {
             $row1 = 'rowToday';
             $row2 = 'rowOn';
             $row3 = 'rowToday';
         } else {
             $row1 = 'rowOff';
             $row2 = 'rowOn';
             $row3 = 'rowOff';
         }
         $dayLinkViewTarget =& $this->conf['view.']['dayLinkTarget'];
         if (($this->rightsObj->isViewEnabled($dayLinkViewTarget) || $this->conf['view.'][$dayLinkViewTarget . '.'][$dayLinkViewTarget . 'ViewPid']) && ($view_array[$daylink] || $isAllowedToCreateEvent)) {
             $this->initLocalCObject();
             $this->local_cObj->setCurrentVal($weekday);
             if (!empty($this->conf['view.'][$dayLinkViewTarget . '.'][$dayLinkViewTarget . 'ViewPid'])) {
                 $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $daylink, 'view' => $this->conf['view.']['dayLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $this->conf['view.'][$dayLinkViewTarget . '.'][$dayLinkViewTarget . 'ViewPid']);
             } else {
                 $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $daylink, 'view' => $this->conf['view.']['dayLinkTarget'], $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway']);
             }
             $this->local_cObj->data['view'] = $dayLinkViewTarget;
             $link = $this->local_cObj->cObjGetSingle($this->conf['view.'][$dayLinkViewTarget . '.'][$dayLinkViewTarget . 'ViewLink'], $this->conf['view.'][$dayLinkViewTarget . '.'][$dayLinkViewTarget . 'ViewLink.']);
             $link = $this->cObj->stdWrap($link, $this->conf['view.']['week.']['weekday_stdWrap.']);
         } else {
             $link = $this->cObj->stdWrap($weekday, $this->conf['view.']['week.']['weekday_stdWrap.']);
         }
         $start_day->addSeconds(86400);
         $colspan = 'colspan="' . ($nbrGridCols[$daylink] ? $nbrGridCols[$daylink] : 1) . '"';
         $search = array('###LINK###', '###DAYLINK###', '###ROW1###', '###ROW2###', '###ROW3###', '###COLSPAN###', '###TIME###');
         $replace = array($link, $daylink, $row1, $row2, $row3, $colspan, $start_day->format('%Y %m %d %H %M %s'));
         $loop_tmp = str_replace($search, $replace, $loop_dof);
         $weekday_loop .= $loop_tmp;
     }
     $rems['###DAYSOFWEEK###'] = $weekday_loop;
     // Build the body
     $border = 0;
     $thisdate = $start_week_time;
     $dTimeStart[2] -= $dTimeStart[2] % $gridLength;
     $dTimeEnd[2] -= $dTimeEnd[2] % $gridLength;
     preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $week_key, $dDate);
     $loops = ($dTimeEnd[1] * 60 + $dTimeEnd[2] - ($dTimeStart[1] * 60 + $dTimeStart[2])) / $gridLength;
     $weekdisplay = '';
     $createOffset = intval($this->conf['rights.']['create.']['event.']['timeOffset']) * 60;
     $cal_time_obj = new \TYPO3\CMS\Cal\Model\CalDate();
     $cal_time_obj->copy($week_start_day);
     $cal_time_obj->setHour(intval($dTimeStart[1]));
     $cal_time_obj->setMinute(intval($dTimeStart[2]));
     $start = 0;
     for ($i = $start; $i < $loops; $i++) {
         $time = $cal_time_obj->format('%H%M');
         for ($j = 0; $j < 7; $j++) {
             $day = $cal_time_obj->format('%Y%m%d');
             if ($j == 0) {
                 $key = $cal_time_obj->format('%I:%M');
                 if (preg_match('/([0-9]{1,2}):00/', $key)) {
                     $weekdisplay .= sprintf($this->conf['view.']['week.']['weekDisplayFullHour'], 60 / $gridLength, $cal_time_obj->format($this->conf['view.']['week.']['timeFormatWeek']), $gridLength);
                 } else {
                     $weekdisplay .= sprintf($this->conf['view.']['week.']['weekDisplayInbetween'], $gridLength);
                 }
             }
             $something = $t_array[$day][$time];
             $class = $this->conf['view.']['week.']['classWeekborder'];
             if ($day == $todayFormatted) {
                 $class .= ' ' . $this->conf['view.']['week.']['classTodayWeekborder'];
             }
             if (is_array($something) && $something != "" && count($something) > 0) {
                 for ($k = 0; $k < count($something); $k++) {
                     if (!empty($something[$k])) {
                         $keys = array_keys($something[$k]);
                         switch ($keys[0]) {
                             case 'begin':
                                 $event =& $eventArray[$something[$k][$keys[0]]];
                                 $rest = $event->getEnd()->getMinute() % ($gridLength * 60);
                                 $plus = 0;
                                 if ($rest > 0) {
                                     $plus = 1;
                                 }
                                 $weekdisplay .= sprintf($this->conf['view.']['week.']['weekEventPre'], $rowspan_array[$day][$event->getType() . '_' . $event->getUid() . '_' . $event->getStart()->format('%Y%m%d%H%M')]);
                                 $weekdisplay .= $event->renderEventForWeek();
                                 $weekdisplay .= $this->conf['view.']['week.']['weekEventPost'];
                                 // End event drawing
                                 break;
                         }
                     }
                 }
                 if (count($something) < ($nbrGridCols[$day] ? $nbrGridCols[$day] : 1)) {
                     $remember = 0;
                     for ($l = 0; $l < ($nbrGridCols[$day] ? $nbrGridCols[$day] : 1); $l++) {
                         if (!$something[$l]) {
                             $remember++;
                         } else {
                             if ($remember > 0) {
                                 $weekdisplay .= $this->getCreateEventLink('week', $this->conf['view.']['week.']['normalCell'], $cal_time_obj, $createOffset, $isAllowedToCreateEvent, $remember, $class, $time);
                                 $remember = 0;
                             }
                         }
                     }
                     if ($remember > 0) {
                         $weekdisplay .= $this->getCreateEventLink('week', $this->conf['view.']['week.']['normalCell'], $cal_time_obj, $createOffset, $isAllowedToCreateEvent, $remember, $class, $time);
                         $remember = 0;
                     }
                 }
             } else {
                 $weekdisplay .= $this->getCreateEventLink('week', $this->conf['view.']['week.']['normalCell'], $cal_time_obj, $createOffset, $isAllowedToCreateEvent, $nbrGridCols[$day] ? $nbrGridCols[$day] : 1, $class, $time);
             }
             if ($j == 6) {
                 $weekdisplay .= $this->conf['view.']['week.']['weekFinishRow'];
             }
             $cal_time_obj->addSeconds(86400);
         }
         $cal_time_obj->setYear($week_start_day->getYear());
         $cal_time_obj->setMonth($week_start_day->getMonth());
         $cal_time_obj->setDay($week_start_day->getDay());
         $cal_time_obj->addSeconds($gridLength * 60);
     }
     $weekTemplate = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($weekTemplate, $sims, array(), array());
     $rems['###LOOPEVENTS###'] = $weekdisplay;
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), array('###WEEK_TEMPLATE###' => $weekTemplate), array());
     return $this->finish($page, $rems);
 }
Exemple #20
0
 function getIdsFromTable($list, $pidList, $includePublic, $includeData = false, $onlyPublic = false)
 {
     $this->calendarIds = array();
     $collectedIds = array();
     // Logged in? Show public & private calendar
     // calendar ids specified? show these calendar only - if allowed - else show public calendar
     $limitationList = '';
     if ($list != '') {
         // $this->conf['calendar']
         $limitationList = $list;
     }
     // Lets see if the user is logged in
     if ($this->rightsObj->isLoggedIn() && !$onlyPublic) {
         $userId = $this->rightsObj->getUserId();
         $groupIds = implode(',', $this->rightsObj->getUserGroups());
     }
     $ids = array();
     if ($userId === '') {
         // && !$includePublic
         return $ids;
     }
     if ($includeData) {
         $select = 'tx_cal_calendar.*';
     } else {
         $select = 'tx_cal_calendar.uid';
     }
     $orderBy = \TYPO3\CMS\Cal\Utility\Functions::getOrderBy('tx_cal_calendar');
     $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_cal_calendar_user_group_mm.uid_local', 'tx_cal_calendar_user_group_mm LEFT JOIN tx_cal_calendar ON tx_cal_calendar.uid=tx_cal_calendar_user_group_mm.uid_local', '1=1 ' . $this->cObj->enableFields('tx_cal_calendar'), '', $orderBy);
     if ($result) {
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
             $ids[] = $row['uid_local'];
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($result);
     }
     $ids = array_unique($ids);
     if ($includePublic) {
         if (!empty($ids)) {
             $where = 'uid NOT IN (' . implode(',', $ids) . ') ' . $this->cObj->enableFields('tx_cal_calendar');
         } else {
             $where = '0=0 ' . $this->cObj->enableFields('tx_cal_calendar');
         }
         if ($pidList != '') {
             $where .= ' AND pid IN (' . $pidList . ')';
         }
         if ($includeData) {
             $select = '*';
         } else {
             $select = 'uid';
         }
         $table = 'tx_cal_calendar';
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, '', $orderBy);
         if ($result) {
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                 if (!in_array($row['uid'], $collectedIds)) {
                     if ($includeData) {
                         $this->calendarIds[] = $row;
                     } else {
                         $this->calendarIds[] = $row['uid'];
                     }
                     $collectedIds[] = $row['uid'];
                 }
             }
             $GLOBALS['TYPO3_DB']->sql_free_result($result);
         }
     }
     if (!$onlyPublic) {
         if (!empty($ids)) {
             $where = 'uid NOT IN (' . implode(',', $ids) . ')';
         } else {
             $where = '';
         }
         $table = 'tx_cal_calendar';
         if ($includeData) {
             $select = '*';
         } else {
             $select = 'uid';
         }
         if ($userId) {
             $where = '((tx_cal_calendar_user_group_mm.uid_foreign IN (' . $userId . ') AND tx_cal_calendar_user_group_mm.tablenames="fe_users" AND tx_cal_calendar_user_group_mm.uid_local=tx_cal_calendar.uid)';
             $where .= 'OR (tx_cal_calendar_user_group_mm.uid_foreign IN (' . $groupIds . ') AND tx_cal_calendar_user_group_mm.tablenames="fe_groups"))';
             $table .= ' LEFT JOIN tx_cal_calendar_user_group_mm ON tx_cal_calendar_user_group_mm.uid_local=tx_cal_calendar.uid';
         }
         if ($pidList != '') {
             $where .= strlen($where) ? ' AND pid IN (' . $pidList . ')' : ' pid IN (' . $pidList . ')';
         }
         if ($where == '') {
             $where .= ' 0=0 ' . $this->cObj->enableFields('tx_cal_calendar');
         } else {
             $where .= $this->cObj->enableFields('tx_cal_calendar');
         }
         if ($limitationList != '') {
             $where .= ' AND uid IN (' . $limitationList . ')';
         }
         $groupBy = 'tx_cal_calendar.uid';
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy, $orderBy);
         if ($result) {
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                 if (!in_array($row['uid'], $collectedIds)) {
                     if ($includeData) {
                         $this->calendarIds[] = $row;
                     } else {
                         $this->calendarIds[] = $row['uid'];
                     }
                     $collectedIds[] = $row['uid'];
                 }
             }
             $GLOBALS['TYPO3_DB']->sql_free_result($result);
         }
     }
     if ($limitationList != '' && !empty($this->calendarIds)) {
         $limitationArray = explode(',', $limitationList);
         $this->calendarIds = array_intersect($this->calendarIds, $limitationArray);
     }
     return $this->calendarIds;
 }
Exemple #21
0
 public function getWeekdayString($timestamp)
 {
     if (!is_object($this->cs_convert)) {
         $this->cs_convert = new \TYPO3\CMS\Core\Charset\CharsetConverter();
     }
     $conf =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'conf');
     return $this->cs_convert->substr(\TYPO3\CMS\Cal\Utility\Functions::getCharset(), strftime($this->weekDayFormat, $timestamp), 0, $this->weekDayLength);
 }
Exemple #22
0
 function getExdateMarker(&$template, &$sims, &$rems, &$wrapped, $view)
 {
     $sims['###EXDATE###'] = '';
     $exceptionDates = array();
     $daySeconds = $this->getStart()->getHour() * 3600 + $this->getStart()->getMinute() * 60;
     $offset = $daySeconds - \TYPO3\CMS\Cal\Utility\Functions::strtotimeOffset($this->getStart()->getTime());
     $exceptionEventStart = new \TYPO3\CMS\Cal\Model\CalDate();
     foreach ($this->getExceptionEvents() as $exceptionEvent) {
         // if ($exceptionEvent->getFreq() == 'none') {
         $exceptionEventStart->copy($exceptionEvent->getStart());
         $exceptionEventStart->addSeconds($offset);
         $exceptionDates[] = 'EXDATE:' . $exceptionEventStart->format('%Y%m%dT%H%M%SZ');
         // }
     }
     if (count($exceptionDates)) {
         $sims['###EXDATE###'] = implode(chr(10), $exceptionDates);
     }
 }
Exemple #23
0
 function sendEmail($email, $htmlTemplate, $plainTemplate)
 {
     $this->controller->finish($htmlTemplate);
     $this->controller->finish($plainTemplate);
     $plainTemplate = str_replace('&nbsp;', ' ', strip_tags($plainTemplate));
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 4005010) {
         $this->mailer->theParts['html']['content'] = $htmlTemplate;
         $this->mailer->theParts['html']['path'] = '';
         $this->mailer->extractMediaLinks();
         $this->mailer->extractHyperLinks();
         $this->mailer->fetchHTMLMedia();
         $this->mailer->substMediaNamesInHTML(0);
         // 0 = relative
         $this->mailer->substHREFsInHTML();
         $this->mailer->setHTML($this->mailer->encodeMsg($this->mailer->theParts['html']['content']));
         $this->mailer->substHREFsInHTML();
         $this->mailer->setPlain(strip_tags($plainTemplate));
         $this->mailer->setHeaders();
         $this->mailer->setContent();
         $this->mailer->setRecipient($email);
         $this->mailer->sendtheMail();
     } else {
         $this->mailer->setTo(array($email));
         $this->mailer->setBody(strip_tags($plainTemplate), 'text/plain');
         $this->mailer->addPart(\TYPO3\CMS\Cal\Utility\Functions::fixURI($htmlTemplate), 'text/html');
         $this->mailer->send();
     }
 }
Exemple #24
0
 function updateAttendees($eventUid)
 {
     $select = 'tx_cal_event.*';
     $table = 'tx_cal_event';
     $where = 'uid=' . $eventUid;
     $eventRow = array();
     $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy);
     if ($result) {
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
             $eventRow = $row;
             break;
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($result);
     }
     $eventObject = $this->createEvent($eventRow, false);
     $modelObj =& tx_cal_registry::Registry('basic', 'modelcontroller');
     $attendeeRecordsArray = $modelObj->findEventAttendees($eventObject->getUid());
     if (!empty($attendeeRecordsArray['tx_cal_attendee'])) {
         $attendeeRecords = $attendeeRecordsArray['tx_cal_attendee'];
         // update related event record in attendee calendar
         $updatedCalendar = array(0);
         // attendees have changed, we need to go through every one of them :(
         foreach ($attendeeRecords as $attendee) {
             // Check if attendee is a fe-user and has a private calendar defined
             $select = 'tx_cal_calendar.uid, tx_cal_calendar.pid, tx_cal_event.uid AS event_id';
             $table = 'fe_users, tx_cal_calendar, tx_cal_event';
             $where = 'fe_users.uid = ' . $attendee->getFeUserId() . ' AND tx_cal_calendar.uid NOT IN (' . $eventObject->getCalendarUid() . ') AND fe_users.tx_cal_calendar=tx_cal_calendar.uid AND tx_cal_calendar.uid = tx_cal_event.calendar_id AND tx_cal_event.ref_event_id = ' . $eventObject->getUid() . ' AND fe_users.disable=0 AND fe_users.deleted=0 AND tx_cal_calendar.hidden=0 AND tx_cal_calendar.deleted=0';
             $groupBy = 'tx_cal_calendar.uid';
             $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy);
             if ($result) {
                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                     // found private calendar of attendee
                     $eventService =& \TYPO3\CMS\Cal\Utility\Functions::getEventService();
                     $eventData = $eventRow;
                     $uid = $eventData['uid'];
                     $this->cleanEventData($eventData);
                     $eventData['pid'] = $row['pid'];
                     $crdate = time();
                     $eventData['crdate'] = $crdate;
                     $eventData['tstamp'] = $crdate;
                     $eventData['calendar_id'] = $row['uid'];
                     $eventData['ref_event_id'] = $eventObject->getUid();
                     $eventData['attendee_ids'] = implode(',', array_keys($attendeeRecords));
                     $eventService->conf['rights.']['edit.']['event.']['fields.']['attendee.']['public'] = 1;
                     $eventService->_updateEvent($row['event_id'], $eventData, $eventObject);
                     $updatedCalendar[] = $row['uid'];
                 }
                 $GLOBALS['TYPO3_DB']->sql_free_result($result);
             }
         }
         $updatedCalendar[] = $eventObject->getCalendarUid();
         foreach ($attendeeRecords as $attendee) {
             // Check if attendee is a fe-user and has a private calendar defined
             $select = 'tx_cal_calendar.uid, tx_cal_calendar.pid';
             $table = 'fe_users, tx_cal_calendar';
             $where = 'tx_cal_calendar.uid NOT IN (' . implode(',', $updatedCalendar) . ') AND fe_users.uid = ' . $attendee->getFeUserId() . ' AND fe_users.tx_cal_calendar=tx_cal_calendar.uid AND fe_users.disable=0 AND fe_users.deleted=0 AND tx_cal_calendar.hidden=0 AND tx_cal_calendar.deleted=0';
             $groupBy = 'tx_cal_calendar.uid';
             $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy);
             if ($result) {
                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                     // found private calendar of attendee
                     $eventService =& \TYPO3\CMS\Cal\Utility\Functions::getEventService();
                     $eventData = $eventRow;
                     $this->cleanEventData($eventData);
                     $eventData['pid'] = $row['pid'];
                     $crdate = time();
                     $eventData['crdate'] = $crdate;
                     $eventData['tstamp'] = $crdate;
                     $eventData['calendar_id'] = $row['uid'];
                     $eventData['ref_event_id'] = $eventObject->getUid();
                     $eventData['attendee_ids'] = implode(',', array_keys($attendeeRecords));
                     $eventService->conf['rights.']['create.']['event.']['fields.']['attendee.']['public'] = 1;
                     $eventService->_saveEvent($eventData, $eventObject);
                 }
                 $GLOBALS['TYPO3_DB']->sql_free_result($result);
             }
         }
     } else {
         // Lets delete events with a ref_event_id to this event, b/c there are no attendees anymore
         // But first we have to find the events
         $select = 'tx_cal_event.uid';
         $table = 'tx_cal_event';
         $where = 'ref_event_id=' . $eventObject->getUid();
         $rememberUids = array(0);
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
         if ($result) {
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                 $rememberUids[] = $row['uid'];
             }
             $GLOBALS['TYPO3_DB']->sql_free_result($result);
         }
         // Now lets delete the mm relations to the attendees
         $where = 'uid IN (' . implode(',', $rememberUids) . ')';
         $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_attendee', $where);
         // Now delete the events
         $where = 'ref_event_id=' . $eventObject->getUid();
         $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_event', $where);
     }
 }
 /**
  * Generates the sql query and builds organizer objects out of the result rows
  * 
  * @param string $pidList
  *        	to search in
  * @param string $additionalWhere
  *        	where clause
  * @return array containing the organizer objects
  */
 function getOrganizerFromTable($pidList = '', $additionalWhere = '')
 {
     $organizers = array();
     $orderBy = \TYPO3\CMS\Cal\Utility\Functions::getOrderBy($this->tableId);
     if ($pidList != '') {
         $additionalWhere .= ' AND ' . $this->tableId . '.pid IN (' . $pidList . ')';
     }
     $additionalWhere .= $this->getAdditionalWhereForLocalizationAndVersioning($this->tableId);
     $select = '*';
     $table = $this->tableId;
     $where = 'tx_cal_controller_isorganizer = 1 AND l18n_parent = 0 ' . $additionalWhere . $this->cObj->enableFields($this->tableId);
     $groupBy = '';
     $orderBy = \TYPO3\CMS\Cal\Utility\Functions::getOrderBy($this->tableId);
     $limit = '';
     $hookObjectsArr = \TYPO3\CMS\Cal\Utility\Functions::getHookObjectsArray('tx_cal_organizer_address_service', 'organizerServiceClass', 'service');
     foreach ($hookObjectsArr as $hookObj) {
         if (method_exists($hookObj, 'preGetOrganizerFromTableExec')) {
             $hookObj->preGetLocationFromTableExec($this, $select, $table, $where, $groupBy, $orderBy, $limit);
         }
     }
     $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy, $orderBy, $limit);
     if ($result) {
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
             $organizers[] = new \TYPO3\CMS\Cal\Model\OrganizerAddress($row, $pidList);
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($result);
     }
     return $organizers;
 }
Exemple #26
0
 function renderWithFluid($object = null)
 {
     $templateFile = GeneralUtility::getFileAbsFileName($this->conf['view.'][$this->conf['view'] . '.'][$this->conf['view'] . 'TemplateFluid']);
     /** @var $view \TYPO3\CMS\Fluid\View\StandaloneView */
     $view = new \TYPO3\CMS\Fluid\View\StandaloneView();
     $view->setTemplatePathAndFilename($templateFile);
     $view->assign($this->conf['view'] . 'View', $this);
     if (is_object($object)) {
         $view->assign($this->conf['view'], $object);
     }
     $view->assign('settings', \TYPO3\CMS\Cal\Utility\Functions::getTsSetupAsPlainArray($this->conf));
     return $view->render();
 }
Exemple #27
0
 public function getRssFromEvent($eventDate, &$event, $template)
 {
     $eventTemplate = $this->cObj->getSubpart($template, '###EVENT###');
     $rems = array();
     $sims = array();
     $wrapped = array();
     $event->getMarker($eventTemplate, $sims, $rems, $wrapped);
     $rssUrl = $this->config['siteUrl'] . $event->getLinkToEvent('', 'event', $eventDate, true);
     // replace square brackets [] in links with their URLcodes and replace the &-sign with its ASCII code
     $sims['###LINK###'] = preg_replace(array('/\\[/', '/\\]/', '/&/'), array('%5B', '%5D', '&#38;'), $rssUrl);
     $sims['###TITLE###'] = str_replace('&', '&amp;', $sims['###TITLE###']);
     // date should be ok
     $sims['###CREATE_DATE###'] = date('D, d M Y H:i:s O', $event->row['crdate']);
     if ($this->conf['view.']['rss.']['xmlFormat'] == 'atom03' || $this->conf['view.']['rss.']['xmlFormat'] == 'atom1') {
         $sims['###CREATE_DATE###'] = $this->getW3cDate($event->row['crdate']);
     }
     return \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($eventTemplate, $sims, $rems, array());
 }
Exemple #28
0
 /**
  * Returns a specific event with a given serviceKey and UID.
  *
  * @param
  *        	string	The serviceKey to be searched in.
  * @param
  *        	integer	The UID to look up.
  * @return event event object matching the serviceKey and UID.
  */
 function create($serviceName, $type, $subtype)
 {
     /* Gets the model for the provided service key */
     $service = $this->getServiceObjByKey($serviceName, $subtype, $type);
     if (!is_object($service)) {
         return \TYPO3\CMS\Cal\Utility\Functions::createErrorMessage('Missing or wrong parameter. The object you are looking for could not be found.', 'Please verify your URL parameters: tx_cal_controller[type].');
     }
     /* Look up an event with a specific ID inside the model */
     $event = $service->createEvent(null, false);
     return $event;
 }
Exemple #29
0
 function getPageBrowser($template)
 {
     $pb = '';
     // render PageBrowser
     if ($this->conf['view.']['list.']['pageBrowser.']['usePageBrowser']) {
         $this->controller->pointerName = $this->pointerName;
         // Hook: getPageBrowser
         $hookObjectsArr = \TYPO3\CMS\Cal\Utility\Functions::getHookObjectsArray('tx_cal_listview', 'getPageBrowser', 'view');
         if (count($hookObjectsArr)) {
             foreach ($hookObjectsArr as $hookObj) {
                 if (method_exists($hookObj, 'renderPageBrowser')) {
                     $hookObj->renderPageBrowser($this, $pb, $this->count, $this->recordsPerPage, $template);
                 }
             }
             if ($pb != '') {
                 return $pb;
             }
         }
         // use the piPageBrowser
         if ($this->conf['view.']['list.']['pageBrowser.']['useType'] == 'piPageBrowser') {
             $browserConfig =& $this->conf['view.']['list.']['pageBrowser.']['piPageBrowser.'];
             $this->controller->internal['res_count'] = $this->count;
             $this->controller->internal['results_at_a_time'] = $this->recordsPerPage;
             if ($maxPages = intval($this->conf['view.']['list.']['pageBrowser.']['pagesCount'])) {
                 $this->controller->internal['maxPages'] = $maxPages;
             }
             $this->controller->internal['pagefloat'] = $browserConfig['pagefloat'];
             $this->controller->internal['showFirstLast'] = $browserConfig['showFirstLast'];
             $this->controller->internal['showRange'] = $browserConfig['showRange'];
             $this->controller->internal['dontLinkActivePage'] = $browserConfig['dontLinkActivePage'];
             $wrapArrFields = explode(',', 'disabledLinkWrap,inactiveLinkWrap,activeLinkWrap,browseLinksWrap,showResultsWrap,showResultsNumbersWrap,browseBoxWrap');
             $wrapArr = array();
             foreach ($wrapArrFields as $key) {
                 if ($browserConfig[$key]) {
                     $wrapArr[$key] = $browserConfig[$key];
                 }
             }
             if ($wrapArr['showResultsNumbersWrap'] && strpos($this->controller->LOCAL_LANG[$this->controller->LLkey]['pi_list_browseresults_displays'], '%s')) {
                 // if the advanced pagebrowser is enabled and the "pi_list_browseresults_displays" label contains %s it will be replaced with the content of the label "pi_list_browseresults_displays_advanced"
                 $this->controller->LOCAL_LANG[$this->controller->LLkey]['pi_list_browseresults_displays'] = $this->controller->LOCAL_LANG[$this->controller->LLkey]['pi_list_browseresults_displays_advanced'];
             }
             if (!$browserConfig['showPBrowserText']) {
                 $this->controller->LOCAL_LANG[$this->controller->LLkey]['pi_list_browseresults_page'] = '';
             }
             $this->controller->pi_alwaysPrev = $browserConfig['alwaysPrev'];
             // if there is a GETvar in the URL that is not in this list, caching will be disabled for the pagebrowser links
             $this->controller->pi_isOnlyFields = $this->pointerName . ',view,model,category,type,getdate,uid';
             // pi_lowerThan limits the amount of cached pageversions for the list view. Caching will be disabled if one of the vars in $this->pi_isOnlyFields has a value greater than $this->pi_lowerThan
             // $this->pi_lowerThan = ceil($this->internal['res_count']/$this->internal['results_at_a_time']);
             $pi_isOnlyFieldsArr = explode(',', $this->controller->pi_isOnlyFields);
             $highestVal = 0;
             foreach ($pi_isOnlyFieldsArr as $k => $v) {
                 $val = $this->controller->piVars[$v];
                 if (is_array($this->controller->piVars[$v])) {
                     $val = $this->controller->piVars[$v][0];
                 }
                 if ($val > $highestVal) {
                     $highestVal = $val;
                 }
             }
             $this->controller->pi_lowerThan = $highestVal + 1;
             $pb = $this->controller->pi_list_browseresults($browserConfig['showResultCount'], $browserConfig['tableParams'], $wrapArr, $this->pointerName, $browserConfig['hscText']);
         } else {
             // use default page browser of cal
             $browserConfig = $this->conf['view.']['list.']['pageBrowser.']['default.'];
             $this->offset = intval($this->controller->piVars[$this->pointerName]);
             $pagesTotal = intval($this->recordsPerPage) == 0 ? 1 : ceil($this->count / $this->recordsPerPage);
             $nextPage = $this->offset + 1;
             $previousPage = $this->offset - 1;
             $pagesCount = $this->conf['view.']['list.']['pageBrowser.']['pagesCount'] - 1;
             $min = 1;
             $max = $pagesTotal;
             if ($pagesTotal > $pagesCount + 1 && $pagesCount > 0) {
                 $pstart = $this->offset - ceil(($pagesCount - 2) / 2);
                 if ($pstart < 1) {
                     $pstart = 1;
                 }
                 $pend = $pstart + $pagesCount;
                 if ($pend > $pagesTotal - 1) {
                     $pend = $pagesTotal - 1;
                 }
                 $spacer = $this->local_cObj->cObjGetSingle($browserConfig['spacer'], $browserConfig['spacer.']);
             } else {
                 $pstart = $min;
                 $pend = $pagesTotal;
             }
             $pbMarker['###PAGEOF###'] = sprintf($this->controller->pi_getLL('l_page_of'), $this->offset + 1, $pagesTotal);
             // Extra Single Marker
             $pbMarker['###PAGE###'] = $this->offset + 1;
             $pbMarker['###PAGETOTAL###'] = $pagesTotal;
             // next+previous
             $this->initLocalCObject();
             $pbMarker['###NEXT###'] = '';
             if ($nextPage + 1 <= $pagesTotal) {
                 $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array($this->pointerName => $nextPage), $this->conf['cache']);
                 $pbMarker['###NEXT###'] = $this->local_cObj->cObjGetSingle($browserConfig['nextLink'], $browserConfig['nextLink.']);
             }
             $pbMarker['###PREVIOUS###'] = '';
             if ($previousPage >= 0) {
                 $previousPage = $previousPage == 0 ? NULL : $previousPage;
                 $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array($this->pointerName => $previousPage), $this->conf['cache']);
                 $pbMarker['###PREVIOUS###'] = $this->local_cObj->cObjGetSingle($browserConfig['prevLink'], $browserConfig['prevLink.']);
             }
             for ($i = $min; $i <= $max; $i++) {
                 if ($this->offset + 1 == $i) {
                     $pbMarker['###PAGES###'] .= $this->cObj->stdWrap($i, $browserConfig['actPage_stdWrap.']);
                 } else {
                     if ($i == 1 || $i == $max || $i > 1 && $i >= $pstart && $i <= $pend && $i < $max) {
                         $this->local_cObj->setCurrentVal($i);
                         $pageNum = $i - 1;
                         $pageNum = $pageNum == 0 ? NULL : $pageNum;
                         $this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array($this->pointerName => $pageNum), $this->conf['cache']);
                         $pbMarker['###PAGES###'] .= $this->local_cObj->cObjGetSingle($browserConfig['pageLink'], $browserConfig['pageLink.']);
                     } elseif ($i == 2 && $i < $pstart || $i == $pend + 1 && $i < $max) {
                         unset($this->local_cObj->data['link_parameter']);
                         $pbMarker['###PAGES###'] .= $spacer;
                     }
                 }
             }
             $pb = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($template, $pbMarker, array(), array());
         }
     }
     return $pb;
 }
Exemple #30
0
 function getUntilMarker(&$template, &$sims, &$rems)
 {
     $sims['###UNTIL###'] = '';
     if ($this->isAllowed('recurring')) {
         $untilDate = $this->object->getUntil();
         if (is_object($untilDate)) {
             $untilDateFormatted = '';
             $sims['###UNTIL_VALUE###'] = '';
             if ($untilDate->getYear() > 0) {
                 $split = $this->conf['dateConfig.']['splitSymbol'];
                 $untilDateFormatted = $untilDate->format(\TYPO3\CMS\Cal\Utility\Functions::getFormatStringFromConf($this->conf));
                 $dateFormatArray = explode($this->conf['dateConfig.']['splitSymbol'], $untilDateFormatted);
                 $sims['###UNTIL_VALUE###'] = htmlspecialchars($dateFormatArray[$this->conf['dateConfig.']['yearPosition']] . $dateFormatArray[$this->conf['dateConfig.']['monthPosition']] . $dateFormatArray[$this->conf['dateConfig.']['dayPosition']]);
             }
             $sims['###UNTIL###'] = $this->applyStdWrap($untilDateFormatted, 'until_stdWrap');
         }
     }
 }