Пример #1
0
 /**
  * @return string
  */
 public function Body()
 {
     $this->Set('StartDate', $this->reminder->StartDate()->ToTimezone($this->reminder->Timezone()));
     $this->Set('EndDate', $this->reminder->EndDate()->ToTimezone($this->reminder->Timezone()));
     $this->Set('ResourceName', $this->reminder->ResourceName());
     $this->Set('Title', $this->reminder->Title());
     $this->Set('Description', $this->reminder->Description());
     $this->Set('ReservationUrl', sprintf("%s?%s=%s", Pages::RESERVATION, QueryStringKeys::REFERENCE_NUMBER, $this->reminder->ReferenceNumber()));
     $this->Set('ICalUrl', sprintf("export/%s?%s=%s", Pages::CALENDAR_EXPORT, QueryStringKeys::REFERENCE_NUMBER, $this->reminder->ReferenceNumber()));
     return $this->FetchTemplate($this->GetTemplateName());
 }
Пример #2
0
 public function testGetsAllReservationsWithReminderDateOfThisMinute()
 {
     $seriesId = 123;
     $instanceId = 456;
     $referenceNumber = 'refnum1';
     $startDate = Date::Now()->AddDays(1)->ToDatabase();
     $endDate = Date::Now()->AddDays(2)->ToDatabase();
     $title = 'reservation title';
     $description = 'reservation description';
     $resourceName = 'resource name';
     $emailAddress = '*****@*****.**';
     $fname = 'first';
     $lname = 'last';
     $timezone = 'America/Chicago';
     $reminder_minutes = 100;
     $now = Date::Now();
     $language = 'en_us';
     $row1 = new ReminderNoticeRow($seriesId, $instanceId, $referenceNumber, $startDate, $endDate, $title, $description, $resourceName, $emailAddress, $fname, $lname, $timezone, $reminder_minutes, $language);
     $row2 = new ReminderNoticeRow();
     $rows = array_merge($row1->Rows(), $row2->Rows());
     $this->db->SetRows($rows);
     $reminderNotices = $this->repository->GetReminderNotices($now, ReservationReminderType::Start);
     $expectedCommand = new GetReminderNoticesCommand($now->ToTheMinute(), ReservationReminderType::Start);
     $this->assertEquals(2, count($reminderNotices));
     $this->assertEquals($expectedCommand, $this->db->_LastCommand);
     $expectedReminderNotice = ReminderNotice::FromRow($rows[0]);
     $this->assertEquals($expectedReminderNotice, $reminderNotices[0]);
 }
Пример #3
0
 /**
  * @param Date $now
  * @param ReservationReminderType $reminderType
  * @return ReminderNotice[]|array
  */
 public function GetReminderNotices(Date $now, $reminderType)
 {
     $reader = ServiceLocator::GetDatabase()->Query(new GetReminderNoticesCommand($now->ToTheMinute(), $reminderType));
     $notices = array();
     while ($row = $reader->GetRow()) {
         $notices[] = ReminderNotice::FromRow($row);
     }
     $reader->Free();
     return $notices;
 }