Пример #1
0
 function list_months($this_year, $dateFormat_month)
 {
     if ($this->conf['view.']['other.']['listMonth_referenceToday'] == 1) {
         $this_year = strftime('%Y');
     }
     $viewTarget = $this->conf['view.']['monthLinkTarget'];
     $day_array2 = array();
     preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $this->conf['getdate'], $day_array2);
     $this_month = $day_array2[2];
     if ($this->conf['view.']['other.']['listMonth_onlyShowCurrentYear']) {
         $month = 1;
         $monthSize = 12;
         $monthOffset = $monthSize - $this_month;
     } else {
         $monthSize = intval($this->conf['view.']['other.']['listMonth_totalMonthCount']);
         $monthSize = $monthSize ? $monthSize : 12;
         // ensure valid data
         $monthOffset = intval($this->conf['view.']['other.']['listMonth_previousMonthCount']);
         $monthOffset = $monthOffset < $monthSize ? $monthOffset : intval($monthSize / 2);
         $month = $this_month - $monthOffset;
         // calc start month
         if ($month < 1) {
             // the year needs to be switched
             $this_year = $this_year - intval(abs($month) / 12) - 1;
             // calc the year
             $month = 12 + $month % 12;
         }
     }
     $month_time = \TYPO3\CMS\Cal\Controller\Calendar::calculateStartDayTime();
     $month_time->setDay(1);
     $month_time->setMonth($month);
     $month_time->setYear($this_year);
     for ($i = 0; $i < $monthSize; $i++) {
         $monthdate = $month_time->format('%Y%m%d');
         $month_month = $month_time->getMonth();
         $select_month = $month_time->format($dateFormat_month);
         if (!empty($this->conf['view.'][$viewTarget . '.'][$viewTarget . 'ViewPid'])) {
             $link = $this->controller->pi_linkTP_keepPIvars_url(array('getdate' => $monthdate, 'view' => $viewTarget, $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $this->conf['view.'][$viewTarget . '.'][$viewTarget . 'ViewPid']);
         } else {
             $link = $this->controller->pi_linkTP_keepPIvars_url(array('getdate' => $monthdate, 'view' => $viewTarget, $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway']);
         }
         $link = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $link;
         if ($month_month == $this_month) {
             $tmp = $this->cObj->stdWrap($link, $this->conf['view.']['other.']['listMonthSelected_stdWrap.']);
             $return .= str_replace('###MONTH###', $select_month, $tmp);
         } else {
             $tmp = $this->cObj->stdWrap($link, $this->conf['view.']['other.']['listMonth_stdWrap.']);
             $return .= str_replace('###MONTH###', $select_month, $tmp);
         }
         $month_time->addSeconds(86400 * 32);
         $month_time = \TYPO3\CMS\Cal\Controller\Calendar::calculateStartMonthTime($month_time);
     }
     return $return;
 }
Пример #2
0
 /**
  * 
  * @return string
  */
 public function searchEvent()
 {
     $type = $this->conf['type'];
     $pidList = $this->conf['pidList'];
     $hookObjectsArr = $this->getHookObjectsArray('drawSearchClass');
     $start_day = $this->piVars['start_day'];
     $end_day = $this->piVars['end_day'];
     $searchword = preg_replace('/["\']/', '', strip_tags($this->piVars['query']));
     $this->piVars['query'] = $searchword;
     if (!$start_day) {
         $start_day = $this->getListViewTime($this->conf['view.']['search.']['defaultValues.']['start_day']);
         $start_day = \TYPO3\CMS\Cal\Controller\Calendar::calculateStartDayTime($start_day);
     } else {
         $start_day = new \TYPO3\CMS\Cal\Model\CalDate(\TYPO3\CMS\Cal\Utility\Functions::getYmdFromDateString($this->conf, $start_day) . '000000');
         $start_day->setHour(0);
         $start_day->setMinute(0);
         $start_day->setSecond(0);
         $start_day->setTZbyId('UTC');
     }
     if (!$end_day) {
         $end_day = $this->getListViewTime($this->conf['view.']['search.']['defaultValues.']['end_day']);
         $end_day = \TYPO3\CMS\Cal\Controller\Calendar::calculateEndDayTime($end_day);
     } else {
         $end_day = new \TYPO3\CMS\Cal\Model\CalDate(\TYPO3\CMS\Cal\Utility\Functions::getYmdFromDateString($this->conf, $end_day) . '000000');
         $end_day->setHour(23);
         $end_day->setMinute(59);
         $end_day->setSecond(59);
         $end_day->setTZbyId('UTC');
     }
     if ($this->piVars['single_date']) {
         $start_day = new \TYPO3\CMS\Cal\Model\CalDate(\TYPO3\CMS\Cal\Utility\Functions::getYmdFromDateString($this->conf, $this->piVars['single_date']));
         $start_day->setHour(0);
         $start_day->setMinute(0);
         $start_day->setSecond(0);
         $start_day->setTZbyId('UTC');
         $end_day = new \TYPO3\CMS\Cal\Model\CalDate();
         $end_day->copy($start_day);
         $end_day->addSeconds(86399);
     }
     $minStarttime = new \TYPO3\CMS\Cal\Model\CalDate($this->conf['view.']['search.']['startRange'] . '000000');
     $maxEndtime = new \TYPO3\CMS\Cal\Model\CalDate($this->conf['view.']['search.']['endRange'] . '000000');
     if ($start_day->before($minStarttime)) {
         $start_day->copy($minStarttime);
     }
     if ($start_day->after($maxEndtime)) {
         $start_day->copy($maxEndtime);
     }
     if ($end_day->before($minStarttime)) {
         $end_day->copy($minStarttime);
     }
     if ($end_day->after($maxEndtime)) {
         $end_day->copy($maxEndtime);
     }
     if ($end_day->before($start_day)) {
         $end_day->copy($start_day);
     }
     $locationIds = strip_tags(Controller::convertLinkVarArrayToList($this->piVars['location_ids']));
     $organizerIds = strip_tags(Controller::convertLinkVarArrayToList($this->piVars['organizer_ids']));
     $this->getDateTimeObject->copy($start_day);
     $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
     $list = array();
     if ($this->piVars['submit'] || !$this->conf['view.']['search.']['startSearchAfterSubmit']) {
         $list = $modelObj->searchEvents($type, $pidList, $start_day, $end_day, $searchword, $locationIds, $organizerIds);
     }
     // Hook: preSearchEventRendering
     foreach ($hookObjectsArr as $hookObj) {
         if (method_exists($hookObj, 'preSearchEventRendering')) {
             $hookObj->preSearchEventRendering($list, $this);
         }
     }
     if ($this->conf['view.']['enableAjax']) {
         $ajaxStringArray = array();
         foreach ($list as $event) {
             $ajaxStringArray[] = '{' . $this->getEventAjaxString($event) . '}';
         }
         return '[' . implode(',', $ajaxStringArray) . ']';
     }
     $viewObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'viewcontroller');
     $drawnList = $viewObj->drawSearchEventResult($list, $start_day, $end_day, $searchword, $locationIds, $organizerIds);
     // Hook: postSearchEventRendering
     foreach ($hookObjectsArr as $hookObj) {
         if (method_exists($hookObj, 'postSearchEventRendering')) {
             $hookObj->postSearchEventRendering($drawnList, $list, $this);
         }
     }
     return $drawnList;
 }
Пример #3
0
 function findTodosForDay(&$dateObject, $type = '', $pidList = '', $eventType = '4')
 {
     $starttime = \TYPO3\CMS\Cal\Controller\Calendar::calculateStartDayTime($dateObject);
     $endtime = \TYPO3\CMS\Cal\Controller\Calendar::calculateEndDayTime($dateObject);
     return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
 }
Пример #4
0
 /**
  * 
  * @param string $dateObject
  * @return \TYPO3\CMS\Cal\Model\CalDate
  */
 public static function calculateEndMonthTime($dateObject = '')
 {
     $timeObj = Calendar::calculateStartDayTime($dateObject);
     $timeObj = new \TYPO3\CMS\Cal\Model\CalDate(Calc::endOfNextMonth($timeObj->getDay(), $timeObj->getMonth(), $timeObj->getYear()));
     $timeObj->setDay(1);
     $timeObj->subtractSeconds(1);
     $timeObj->setTZbyId('UTC');
     return $timeObj;
 }