本文整理汇总了PHP中OX_OperationInterval::convertDaySpanToOperationIntervalID方法的典型用法代码示例。如果您正苦于以下问题:PHP OX_OperationInterval::convertDaySpanToOperationIntervalID方法的具体用法?PHP OX_OperationInterval::convertDaySpanToOperationIntervalID怎么用?PHP OX_OperationInterval::convertDaySpanToOperationIntervalID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OX_OperationInterval
的用法示例。
在下文中一共展示了OX_OperationInterval::convertDaySpanToOperationIntervalID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkDates
/**
* Check start/end dates - note that check is the reverse of normal check:
* if the operation interval is <= 60, must be start/end of an hour, to
* make sure we update all the operation intervals in the hour, and if
* the operation interval > 60, must be the start/end of an operation
* interval, to make sure we update all the hours in the operation interval.
*
* @static
* @param Date $oStartDate
* @param Date $oEndDate
* @return boolean
*/
function checkDates($oStartDate, $oEndDate)
{
$aConf = $GLOBALS['_MAX']['CONF'];
$operationInterval = $aConf['maintenance']['operation_interval'];
if ($operationInterval <= 60) {
// Must ensure that only one hour is being summarised
if (!OX_OperationInterval::checkDatesInSameHour($oStartDate, $oEndDate)) {
return false;
}
// Now check that the start and end dates are match the start and
// end of the hour
$oHourStart = new Date();
$oHourStart->setYear($oStartDate->getYear());
$oHourStart->setMonth($oStartDate->getMonth());
$oHourStart->setDay($oStartDate->getDay());
$oHourStart->setHour($oStartDate->getHour());
$oHourStart->setMinute('00');
$oHourStart->setSecond('00');
$oHourEnd = new Date();
$oHourEnd->setYear($oEndDate->getYear());
$oHourEnd->setMonth($oEndDate->getMonth());
$oHourEnd->setDay($oEndDate->getDay());
$oHourEnd->setHour($oEndDate->getHour());
$oHourEnd->setMinute('59');
$oHourEnd->setSecond('59');
if (!$oStartDate->equals($oHourStart)) {
return false;
}
if (!$oEndDate->equals($oHourEnd)) {
return false;
}
} else {
// Must ensure that only one operation interval is being summarised
$operationIntervalID = OX_OperationInterval::convertDaySpanToOperationIntervalID($oStartDate, $oEndDate, $operationInterval);
if (is_bool($operationIntervalID) && !$operationIntervalID) {
return false;
}
// Now check that the start and end dates match the start and end
// of the operation interval
list($oOperationIntervalStart, $oOperationIntervalEnd) = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oStartDate, $operationInterval);
if (!$oStartDate->equals($oOperationIntervalStart)) {
return false;
}
if (!$oEndDate->equals($oOperationIntervalEnd)) {
return false;
}
}
return true;
}