function _parseString($value) { $value = strtolower($value); switch ($value) { case 'last': array_push($this->stack, array('range' => 'last')); break; case 'next': array_push($this->stack, array('range' => 'next')); break; case 'now': array_push($this->stack, array('abs' => $this->timeObj->getTime())); break; case 'today': array_push($this->stack, array('today' => $this->timeObj->getTime())); break; case 'current': array_push($this->stack, array('today' => $this->timeObj->getTime())); break; case 'tomorrow': array_push($this->stack, array('tomorrow' => $this->timeObj->getTime())); break; case 'yesterday': array_push($this->stack, array('yesterday' => $this->timeObj->getTime())); break; case 'yearstart': array_push($this->stack, array('date' => \TYPO3\CMS\Cal\Controller\Calendar::calculateStartYearTime($this->timeObj))); break; case 'monthstart': array_push($this->stack, array('date' => \TYPO3\CMS\Cal\Controller\Calendar::calculateStartMonthTime($this->timeObj))); break; case 'weekstart': array_push($this->stack, array('date' => \TYPO3\CMS\Cal\Controller\Calendar::calculateStartWeekTime($this->timeObj))); break; case 'weekend': array_push($this->stack, array('date' => \TYPO3\CMS\Cal\Controller\Calendar::calculateEndWeekTime($this->timeObj))); break; case 'monthend': array_push($this->stack, array('date' => \TYPO3\CMS\Cal\Controller\Calendar::calculateEndMonthTime($this->timeObj))); break; case 'yearend': array_push($this->stack, array('date' => \TYPO3\CMS\Cal\Controller\Calendar::calculateEndYearTime($this->timeObj))); break; case 'quarterstart': $timeObj = $this->timeObj; $startMonth = '01'; switch ($timeObj->getQuarterOfYear()) { case 2: $startMonth = '04'; break; case 3: $startMonth = '07'; break; case 4: $startMonth = '10'; break; } $timeObj->setDay(1); $timeObj->setMonth($startMonth); $timeObj->setHour(0); $timeObj->setMinute(0); $timeObj->setSecond(0); array_push($this->stack, array('date' => $timeObj)); break; case 'quarterend': $timeObj = $this->timeObj; $endDay = '31'; $endMonth = '03'; switch ($timeObj->getQuarterOfYear()) { case 2: $endDay = '30'; $endMonth = '06'; break; case 3: $endDay = '30'; $endMonth = '09'; break; case 4: $endDay = '31'; $endMonth = '12'; break; } $timeObj->setDay($endDay); $timeObj->setMonth($endMonth); $timeObj->setHour(23); $timeObj->setMinute(59); $timeObj->setSecond(59); array_push($this->stack, array('date' => $timeObj)); break; case 'day': case 'days': array_push($this->stack, array('value' => 86400)); break; case 'week': case 'weeks': array_push($this->stack, array('value' => 604800)); break; case 'h': case 'hour': case 'hours': $value = array_pop(array_pop($this->stack)); array_push($this->stack, array('range' => $value)); array_push($this->stack, array('value' => 'hour')); break; case 'm': case 'minute': case 'minutes': $value = array_pop(array_pop($this->stack)); array_push($this->stack, array('range' => $value)); array_push($this->stack, array('value' => 'minute')); break; case 'month': case 'months': array_push($this->stack, array('value' => 'month')); break; case 'year': case 'years': array_push($this->stack, array('value' => 'year')); break; case 'mon': case 'monday': array_push($this->stack, array('weekday' => 1)); break; case 'tue': case 'tuesday': array_push($this->stack, array('weekday' => 2)); break; case 'wed': case 'wednesday': array_push($this->stack, array('weekday' => 3)); break; case 'thu': case 'thursday': array_push($this->stack, array('weekday' => 4)); break; case 'fri': case 'friday': array_push($this->stack, array('weekday' => 5)); break; case 'sat': case 'saturday': array_push($this->stack, array('weekday' => 6)); break; case 'sun': case 'sunday': array_push($this->stack, array('weekday' => 0)); break; case 'jan': case 'january': array_push($this->stack, array('month' => 1)); break; case 'feb': case 'february': array_push($this->stack, array('month' => 2)); break; case 'mar': case 'march': array_push($this->stack, array('month' => 3)); break; case 'apr': case 'april': array_push($this->stack, array('month' => 4)); break; case 'may': array_push($this->stack, array('month' => 5)); break; case 'jun': case 'june': array_push($this->stack, array('month' => 6)); break; case 'jul': case 'july': array_push($this->stack, array('month' => 7)); break; case 'aug': case 'august': array_push($this->stack, array('month' => 8)); break; case 'sep': case 'september': array_push($this->stack, array('month' => 9)); break; case 'oct': case 'october': array_push($this->stack, array('month' => 10)); break; case 'nov': case 'november': array_push($this->stack, array('month' => 11)); break; case 'dec': case 'december': array_push($this->stack, array('month' => 12)); break; default: break; } }
function findTodosForMonth(&$dateObject, $type = '', $pidList = '', $eventType = '4') { $starttime = \TYPO3\CMS\Cal\Controller\Calendar::calculateStartMonthTime($dateObject); $endtime = \TYPO3\CMS\Cal\Controller\Calendar::calculateEndMonthTime($dateObject); return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType); }
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; }
/** * * @param string $dateObject * @return \TYPO3\CMS\Cal\Model\CalDate */ public static function calculateStartYearTime($dateObject = '') { $timeObj = Calendar::calculateStartMonthTime($dateObject); $timeObj->setMonth(1); return $timeObj; }