本文整理汇总了PHP中Concrete\Core\Permission\Duration::getActiveRange方法的典型用法代码示例。如果您正苦于以下问题:PHP Duration::getActiveRange方法的具体用法?PHP Duration::getActiveRange怎么用?PHP Duration::getActiveRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Permission\Duration
的用法示例。
在下文中一共展示了Duration::getActiveRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGenerateMonthlyMonthly
public function testGenerateMonthlyMonthly()
{
$repetition = new Duration();
$repetition->setRepeatPeriod($repetition::REPEAT_MONTHLY);
$repetition->setRepeatMonthBy($repetition::MONTHLY_REPEAT_MONTHLY);
$repetition->setRepeatEveryNum(3);
$repetition->setStartDate('1/14/2015 1:00:00');
$repetition->setEndDate('1/14/2015 3:00:00');
$now = strtotime('2/13/2014');
$end = strtotime('+5 years', $now);
$occurrences = $repetition->activeRangesBetween($now, $end);
$all_active = true;
foreach ($occurrences as $occurrence) {
$window = $repetition->getActiveRange($occurrence[0]);
if (!$window) {
$all_active = false;
break;
}
if ($window[0] != $occurrence[0] || $window[1] != $occurrence[1]) {
$all_active = false;
break;
}
}
$this->assertTrue($all_active, 'EventOccurrenceFactory generated inactive occurrences.');
}