本文整理匯總了PHP中date::then方法的典型用法代碼示例。如果您正苦於以下問題:PHP date::then方法的具體用法?PHP date::then怎麽用?PHP date::then使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類date
的用法示例。
在下文中一共展示了date::then方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _build_datebox_sql
private static function _build_datebox_sql($today, $today_arr, $then, $then_arr, $mark)
{
$t =& $GLOBALS["t"];
$fields = explode(",", $GLOBALS["current_view"]["ENABLE_CALENDAR"]);
if (count($fields) == 1) {
self::$today = $today;
self::$then = $then;
$sql = "(" . $fields[0] . " between " . $today . " and " . $then . ")";
} else {
if (count($fields) == 2) {
$sql = "((" . $fields[1] . " between " . $today . " and " . $then . ") or (" . $fields[0] . " between " . $today . " and " . $then . "))";
} else {
// 0-start,1-end,2-recurrence,3-until,4-allday,5-repeatinterval,6-repeatexclusions,7-repeatstart,8-repeatend
$start = $fields[0];
$end = $fields[1];
$rec = $fields[2];
$until = $fields[3];
$rstart = $fields[7];
$rend = $fields[8];
$wtoday = $today_arr["wday"];
$wthen = $then_arr["wday"];
$mtoday = $today_arr["mday"];
$mthen = $then_arr["mday"];
$ytoday = $today_arr["yday"];
$ythen = $then_arr["yday"];
$sql = "(({$end} between {$today} and {$then}) or ({$then} between {$start} and {$end})";
$sql .= " or ({$start} < {$then} and ({$until}=0 or {$until} > {$today}) and ";
$sql .= "({$rec}='days'";
if ($mark == "day") {
$sql .= " or ({$rec}='weeks' and (({$rend} between {$wtoday} and {$wthen}) or ({$rend}>={$rstart} and {$wthen} between {$rstart} and {$rend}) or ({$rend}<{$rstart} and {$wthen} not between {$rend}+1 and {$rstart}-1)) )";
} else {
$sql .= " or {$rec}='weeks'";
}
if ($mark == "day" or $mark == "week") {
$sql .= " or ({$rec}='months' and (({$rend} between {$mtoday} and {$mthen}) or ({$rend}>={$rstart} and {$mthen} between {$rstart} and {$rend}) or ({$rend}<{$rstart} and {$mthen} not between {$rend}+1 and {$rstart}-1)) )";
} else {
$sql .= " or {$rec}='months'";
}
if ($mark == "day" or $mark == "week" or $mark == "month" or $mark == "gantt") {
$sql .= " or ({$rec}='years' and (({$rend} between {$ytoday} and {$ythen}) or ({$rend}>={$rstart} and {$ythen} between {$rstart} and {$rend}) or ({$rend}<{$rstart} and {$ythen} not between {$rend}+1 and {$rstart}-1)) )";
} else {
$sql .= " or {$rec}='years'";
}
$sql .= ")))";
}
}
$t["sqlwhere"][] = $sql;
$t["sqlwhere_default"][] = $sql;
}