本文整理匯總了PHP中CMbDT::getEasterDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP CMbDT::getEasterDate方法的具體用法?PHP CMbDT::getEasterDate怎麽用?PHP CMbDT::getEasterDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CMbDT
的用法示例。
在下文中一共展示了CMbDT::getEasterDate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCpHolidays
/**
* Get the holidays by region
*
* @param string $date date to check
*
* @param null|CGroups $group group, null = current
*
* @return array
*/
static function getCpHolidays($date, $group = null)
{
$subdivisionHoliday = array();
$pays = CAppUI::conf("ref_pays");
//no group, load current
if (!$group) {
$group = CGroups::loadCurrent();
}
//no CP, abord
if (!$group->cp) {
return $subdivisionHoliday;
}
$year = CMbDT::transform("+0 DAY", $date, "%Y");
$paques = CMbDT::getEasterDate($date);
switch ($pays) {
// France
case '1':
return $subdivisionHoliday;
break;
// Switzerland
// Switzerland
case '2':
$firstSundaySeptember = CMbDT::transform("next sunday", $year . "-09-00", "%Y-%m-%d");
$thirdSundaySeptember = CMbDT::transform("+2 WEEK", $firstSundaySeptember, "%Y-%m-%d");
$canton = substr($group->cp, 0, 2);
switch ($canton) {
// Vaud
case '10':
$subdivisionHoliday["{$year}-01-02"] = "Saint-Berchtold";
$subdivisionHoliday[CMbDT::transform("last friday", $paques, "%Y-%m-%d")] = "vendredi saint";
$subdivisionHoliday[CMbDT::transform("+1 DAY", $paques, "%Y-%m-%d")] = "lundi de paques";
$subdivisionHoliday[CMbDT::transform("+39 DAY", $paques, "%Y-%m-%d")] = "Ascension";
$subdivisionHoliday[CMbDT::transform("+50 DAY", $paques, "%Y-%m-%d")] = "lundi de pantecote";
$subdivisionHoliday[CMbDT::transform("+1 DAY", $thirdSundaySeptember, "%Y-%m-%d")] = "Lundi du Jeûne fédéral";
break;
// Genève
// Genève
case '12':
$subdivisionHoliday[CMbDT::transform("next thursday", $firstSundaySeptember, "%Y-%m-%d")] = "Jeûne Genevois";
$subdivisionHoliday[CMbDT::transform("last friday", $paques, "%Y-%m-%d")] = "vendredi saint";
$subdivisionHoliday[CMbDT::transform("+1 DAY", $paques, "%Y-%m-%d")] = "lundi de paques";
$subdivisionHoliday[CMbDT::transform("+39 DAY", $paques, "%Y-%m-%d")] = "Ascension";
$subdivisionHoliday[CMbDT::transform("+50 DAY", $paques, "%Y-%m-%d")] = "lundi de pantecote";
$subdivisionHoliday["{$year}-12-31"] = "fete du travail";
break;
default:
return $subdivisionHoliday;
break;
}
break;
default:
return $subdivisionHoliday;
break;
}
return $subdivisionHoliday;
}