本文整理汇总了PHP中DateRange::GetEnd方法的典型用法代码示例。如果您正苦于以下问题:PHP DateRange::GetEnd方法的具体用法?PHP DateRange::GetEnd怎么用?PHP DateRange::GetEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateRange
的用法示例。
在下文中一共展示了DateRange::GetEnd方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetReservations
public function GetReservations(DateRange $dateRangeUtc, $scheduleId, $targetTimezone)
{
$reservationListing = $this->_coordinatorFactory->CreateReservationListing($targetTimezone);
$reservations = $this->_repository->GetReservationList($dateRangeUtc->GetBegin(), $dateRangeUtc->GetEnd(), null, null, $scheduleId, null);
Log::Debug("Found %s reservations for schedule %s between %s and %s", count($reservations), $scheduleId, $dateRangeUtc->GetBegin(), $dateRangeUtc->GetEnd());
foreach ($reservations as $reservation) {
$reservationListing->Add($reservation);
}
$blackouts = $this->_repository->GetBlackoutsWithin($dateRangeUtc, $scheduleId);
Log::Debug("Found %s blackouts for schedule %s between %s and %s", count($blackouts), $scheduleId, $dateRangeUtc->GetBegin(), $dateRangeUtc->GetEnd());
foreach ($blackouts as $blackout) {
$reservationListing->AddBlackout($blackout);
}
return $reservationListing;
}
示例2: EndDate
/**
* @return Date
*/
public function EndDate()
{
return $this->date->GetEnd();
}
示例3: GetBlackoutsWithin
public function GetBlackoutsWithin(DateRange $dateRange, $scheduleId = ReservationViewRepository::ALL_SCHEDULES)
{
$getBlackoutsCommand = new GetBlackoutListCommand($dateRange->GetBegin(), $dateRange->GetEnd(), $scheduleId);
$result = ServiceLocator::GetDatabase()->Query($getBlackoutsCommand);
$blackouts = array();
while ($row = $result->GetRow()) {
$blackouts[] = BlackoutItemView::Populate($row);
}
$result->Free();
return $blackouts;
}
示例4: SetReservationDate
public function SetReservationDate(DateRange $reservationDate)
{
$this->startDate = $reservationDate->GetBegin();
$this->endDate = $reservationDate->GetEnd();
}
示例5: testConflictsIfResourceReservationExistsAtSameTime
public function testConflictsIfResourceReservationExistsAtSameTime()
{
$resourceId = 1;
$currentId = 19;
$currentDate = new DateRange(Date::Now()->AddDays(10), Date::Now()->AddDays(15));
$current = new TestReservation('ref', $currentDate);
$current->SetReservationId($currentId);
$series = new ExistingReservationSeries();
$series->WithPrimaryResource(new FakeBookableResource($resourceId));
$series->WithResource(new FakeBookableResource($resourceId + 1));
$series->WithCurrentInstance($current);
$reservations = array(new TestReservationItemView($currentId + 1, $currentDate->GetBegin(), $currentDate->GetEnd(), $resourceId));
$this->strategy->expects($this->once())->method('GetItemsBetween')->with($this->anything(), $this->anything())->will($this->returnValue($reservations));
$rule = new ExistingResourceAvailabilityRule($this->strategy, $this->timezone);
$ruleResult = $rule->Validate($series);
$this->assertFalse($ruleResult->IsValid());
}
示例6: Equals
/**
* @param DateRange $otherRange
* @return bool
*/
public function Equals(DateRange $otherRange)
{
return $this->_begin->Equals($otherRange->GetBegin()) && $this->_end->Equals($otherRange->GetEnd());
}
示例7: Update
public function Update($blackoutInstanceId, DateRange $blackoutDate, $resourceIds, $title, IReservationConflictResolution $reservationConflictResolution, IRepeatOptions $repeatOptions, $scope)
{
if (!$blackoutDate->GetEnd()->GreaterThan($blackoutDate->GetBegin())) {
return new BlackoutDateTimeValidationResult();
}
$userId = ServiceLocator::GetServer()->GetUserSession()->UserId;
$blackoutSeries = $this->LoadBlackout($blackoutInstanceId, $userId);
if ($blackoutSeries == null) {
return new BlackoutSecurityValidationResult();
}
$blackoutSeries->Update($userId, $scope, $title, $blackoutDate, $repeatOptions, $resourceIds);
$conflictingBlackouts = $this->GetConflictingBlackouts($blackoutSeries);
$conflictingReservations = array();
if (empty($conflictingBlackouts)) {
$conflictingReservations = $this->GetConflictingReservations($blackoutSeries, $reservationConflictResolution);
}
$blackoutValidationResult = new BlackoutValidationResult($conflictingBlackouts, $conflictingReservations);
if ($blackoutValidationResult->CanBeSaved()) {
$this->blackoutRepository->Update($blackoutSeries);
}
return $blackoutValidationResult;
}
示例8: Split
/**
* @param DateRange $dateRange
* @return array|DateRange[]
*/
public function Split(DateRange $dateRange)
{
$ranges = array();
$start = $dateRange->GetBegin();
$end = $dateRange->GetEnd();
if (!$this->SameYear($start, $end)) {
$current = $start;
while (!$this->SameYear($current, $end)) {
$next = $this->GetFirstOfYear($current, 1);
$ranges[] = new DateRange($current, $next);
$current = $next;
if ($this->SameYear($current, $end)) {
$ranges[] = new DateRange($current, $end);
}
}
} else {
$ranges[] = $dateRange;
}
return $ranges;
}
示例9: WithInstance
/**
* @param int $instanceId
* @param string $referenceNum
* @param DateRange $duration
* @return ReservationInstanceRow
*/
public function WithInstance($instanceId, $referenceNum, $duration)
{
$this->rows[] = array(ColumnNames::SERIES_ID => $this->seriesId, ColumnNames::RESERVATION_INSTANCE_ID => $instanceId, ColumnNames::REFERENCE_NUMBER => $referenceNum, ColumnNames::RESERVATION_START => $duration->GetBegin()->ToDatabase(), ColumnNames::RESERVATION_END => $duration->GetEnd()->ToDatabase());
return $this;
}
示例10: GetDates
public function GetDates(DateRange $startingRange)
{
$dates = array();
$begin = $startingRange->GetBegin();
$end = $startingRange->GetEnd();
$nextStartYear = $begin->Year();
$nextEndYear = $end->Year();
$timezone = $begin->Timezone();
$startDate = $begin;
while ($startDate->DateCompare($this->_terminationDate) <= 0) {
$nextStartYear = $nextStartYear + $this->_interval;
$nextEndYear = $nextEndYear + $this->_interval;
$startDate = Date::Create($nextStartYear, $begin->Month(), $begin->Day(), $begin->Hour(), $begin->Minute(), $begin->Second(), $timezone);
$endDate = Date::Create($nextEndYear, $end->Month(), $end->Day(), $end->Hour(), $end->Minute(), $end->Second(), $timezone);
if ($startDate->DateCompare($this->_terminationDate) <= 0) {
$dates[] = new DateRange($startDate->ToUtc(), $endDate->ToUtc());
}
}
return $dates;
}
示例11: Add
/**
* @param AccessoryReservation $accessoryReservation
* @return void
*/
public function Add(AccessoryReservation $accessoryReservation)
{
if ($accessoryReservation->GetStartDate()->Equals($this->duration->GetEnd()) || $accessoryReservation->GetEndDate()->Equals($this->duration->GetBegin())) {
return;
}
if (array_key_exists($accessoryReservation->GetReferenceNumber(), $this->addedReservations)) {
return;
}
$this->addedReservations[$accessoryReservation->GetReferenceNumber()] = true;
$accessoryId = $accessoryReservation->GetAccessoryId();
if (array_key_exists($accessoryId, $this->quantities)) {
$this->quantities[$accessoryId] += $accessoryReservation->QuantityReserved();
}
}
示例12: BindDisplayDates
/**
* @see ISchedulePageBuilder::BindDisplayDates()
*/
public function BindDisplayDates(ISchedulePage $page, DateRange $dateRange, UserSession $userSession, ISchedule $schedule)
{
$scheduleLength = $schedule->GetDaysVisible();
if ($page->GetShowFullWeek()) {
$scheduleLength = 7;
}
// we don't want to display the last date in the range (it will be midnight of the last day)
$adjustedDateRange = new DateRange($dateRange->GetBegin()->ToTimezone($userSession->Timezone), $dateRange->GetEnd()->ToTimezone($userSession->Timezone)->AddDays(-1));
$page->SetDisplayDates($adjustedDateRange);
$startDate = $adjustedDateRange->GetBegin();
$startDay = $schedule->GetWeekdayStart();
if ($startDay == Schedule::Today) {
$adjustment = $scheduleLength;
$prevAdjustment = $scheduleLength;
} else {
$adjustment = max($scheduleLength, 7);
$prevAdjustment = 7 * floor($adjustment / 7);
// ie, if 10, we only want to go back 7 days so there is overlap
}
$page->SetPreviousNextDates($startDate->AddDays(-$prevAdjustment), $startDate->AddDays($adjustment));
$page->ShowFullWeekToggle($scheduleLength < 7);
}