本文整理汇总了PHP中w2p_Utilities_Date::getYear方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date::getYear方法的具体用法?PHP w2p_Utilities_Date::getYear怎么用?PHP w2p_Utilities_Date::getYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Utilities_Date
的用法示例。
在下文中一共展示了w2p_Utilities_Date::getYear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
global $tab, $locale_char_set, $date;
$AppUI->savePlace();
$company_id = $AppUI->processIntState('CalIdxCompany', $_REQUEST, 'company_id', $AppUI->user_company);
$event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', ''), 'EVENTFILTER', 'my');
$tab = $AppUI->processIntState('CalDayViewTab', $_GET, 'tab', isset($tab) ? $tab : 0);
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
// get the passed timestamp (today if none)
$ctoday = new w2p_Utilities_Date();
$today = $ctoday->format(FMT_TIMESTAMP_DATE);
$date = w2PgetParam($_GET, 'date', $today);
// establish the focus 'date'
$this_day = new w2p_Utilities_Date($date);
$dd = $this_day->getDay();
$mm = $this_day->getMonth();
$yy = $this_day->getYear();
// get current week
$this_week = Date_calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY);
// prepare time period for 'events'
$first_time = clone $this_day;
$first_time->setTime(0, 0, 0);
$last_time = clone $this_day;
$last_time->setTime(23, 59, 59);
$prev_day = new w2p_Utilities_Date(Date_calc::prevDay($dd, $mm, $yy, FMT_TIMESTAMP_DATE));
$next_day = new w2p_Utilities_Date(Date_calc::nextDay($dd, $mm, $yy, FMT_TIMESTAMP_DATE));
// get the list of visible companies
$company = new CCompany();
global $companies;
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$companies = arrayMerge(array('0' => $AppUI->_('All')), $companies);
// setup the title block
示例2: array
if (isset($_REQUEST['company_id'])) {
$AppUI->setState('CalIdxCompany', (int) w2PgetParam($_REQUEST, 'company_id', 0));
}
$company_id = $AppUI->getState('CalIdxCompany') !== null ? $AppUI->getState('CalIdxCompany') : $AppUI->user_company;
// Using simplified set/get semantics. Doesn't need as much code in the module.
$event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', 'my'), 'EVENTFILTER', 'my');
// get the passed timestamp (today if none)
$date = w2PgetParam($_GET, 'date', null);
$today = new w2p_Utilities_Date();
$today->convertTZ($AppUI->getPref('TIMEZONE'));
$today = $today->format(FMT_TIMESTAMP_DATE);
// establish the focus 'date'
$this_week = new w2p_Utilities_Date($date);
$dd = $this_week->getDay();
$mm = $this_week->getMonth();
$yy = $this_week->getYear();
// prepare time period for 'events'
$first_time = new w2p_Utilities_Date(Date_Calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY));
$first_time->setTime(0, 0, 0);
$last_time = new w2p_Utilities_Date(Date_Calc::endOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY));
$last_time->setTime(23, 59, 59);
$prev_week = new w2p_Utilities_Date(Date_Calc::beginOfPrevWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY));
$next_week = new w2p_Utilities_Date(Date_Calc::beginOfNextWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY));
$links = array();
// assemble the links for the tasks
$links = getTaskLinks($first_time, $last_time, $links, 50, $company_id);
// assemble the links for the events
$links += getEventLinks($first_time, $last_time, $links, 50);
$hooks = new w2p_System_HookHandler($AppUI);
$hooks->links = $links;
$links = $hooks->calendar_links();
示例3: testGetYearBeforeEpoch
/**
* Tests getYear with a year before the epoch
*/
public function testGetYearBeforeEpoch()
{
$date = new w2p_Utilities_Date('1950-11-06 11:00:00');
$this->assertEquals(1950, $date->getYear());
}
示例4: getHolidayTitle
public static function getHolidayTitle($date = 0, $userid = 0)
{
global $AppUI;
self::loadHolidaysSettings();
if (!$date) {
$date = new w2p_Utilities_Date();
}
if (self::$holiday_manual) {
$q = new w2p_Database_Query();
// Check if we have a whitelist item for this date
$q->addTable("holiday");
$q->addQuery("holiday_description");
$where = "( date(holiday_start_date) <= '";
$where .= $date->format('%Y-%m-%d');
$where .= "' AND date(holiday_end_date) >= '";
$where .= $date->format('%Y-%m-%d');
if ($userid > 0) {
$where .= "' AND (";
$where .= "(holiday_user=0 AND holiday_type=" . HOLIDAY_TYPE_COMPANY_HOLIDAY . ")";
$where .= " OR ";
$where .= "(holiday_user=" . $userid . " AND holiday_type=" . HOLIDAY_TYPE_USER_HOLIDAY . ")";
$where .= ")";
} else {
$where .= "' AND holiday_type=" . HOLIDAY_TYPE_COMPANY_HOLIDAY;
}
$where .= " ) OR ( ";
$where .= " DATE_FORMAT(holiday_start_date, '%m-%d') <= '";
$where .= $date->format('%m-%d');
$where .= "' AND DATE_FORMAT(holiday_end_date, '%m-%d') >= '";
$where .= $date->format('%m-%d');
$where .= "' AND holiday_annual=1";
$where .= " AND holiday_type=" . HOLIDAY_TYPE_COMPANY_HOLIDAY . " )";
$q->addWhere($where);
$holiday_description = $q->loadResult();
if ($holiday_description !== false) {
return $holiday_description;
}
}
if (self::$holiday_auto && self::$holiday_driver >= 0) {
// Still here? Ok, lets poll the automatic system
if (self::$holiday_driver_instance->getYear() != $date->getYear()) {
self::$holiday_driver_instance->setYear($date->getYear());
self::$holiday_driver_instance->setLocale($AppUI->user_locale);
}
if (!Date_Holidays::isError(self::$holiday_driver_instance)) {
$holidays = self::$holiday_driver_instance->getHolidayForDate($date, null, true);
if (!is_null($holidays)) {
$titles = array();
foreach ($holidays as $holiday) {
if (is_null(self::$holiday_filter_instance) || self::$holiday_filter_instance->accept($holiday->getInternalName())) {
$title = $holiday->getTitle();
if (!in_array($title, $titles)) {
$titles[] = gettype($title) == 'object' ? $title->getMessage() : $title;
}
}
}
return implode("/", $titles);
}
}
}
return "";
}
示例5: array
$AppUI->setState('HolidaySelectedUser', $user_id);
} else {
$user_id = $AppUI->getState('HolidaySelectedUser') ? $AppUI->getState('HolidaySelectedUser') : $AppUI->user_id;
}
$is_my_holidays = $user_id == $AppUI->user_id;
// establish the focus 'date'
$date = w2PgetParam($_GET, 'date', null);
if (!$date) {
$date = new w2p_Utilities_Date();
} else {
$date = new w2p_Utilities_Date($date);
}
$date->setDay(1);
$date->setMonth(1);
$date->setTime(0, 0, 0);
$year = $date->getYear();
$prev_year = $date->format(FMT_TIMESTAMP_DATE);
$prev_year = (int) ($prev_year - 10000);
$next_year = $date->format(FMT_TIMESTAMP_DATE);
$next_year = (int) ($next_year + 10000);
$start = $date->duplicate();
$end = $date->duplicate();
$end->setMonth(12);
$end->setDay(31);
$end->setTime(23, 59, 59);
$holidays = array();
$holidaysList = HolidayFunctions::getDefaultCalendarHolidaysForDatespan($start, $end);
foreach ($holidaysList as $holiday) {
$id = 0;
$type = $holiday['type'];
$description = $holiday['description'] ? $holiday['description'] : "";