コード例 #1
0
 public function testLoadsResourceById()
 {
     $id = 1;
     $fr = new FakeResourceAccess();
     $rows = $fr->GetRows();
     $this->db->SetRow(0, $rows);
     $car = new CustomAttributeValueRow();
     $car->With(1, 'value')->With(2, 'value2');
     $this->db->SetRow(1, $car->Rows());
     $loadResourceCommand = new GetResourceByIdCommand($id);
     $attributes = new GetAttributeValuesCommand(1, CustomAttributeCategory::RESOURCE);
     $resource = $this->repository->LoadById($id);
     $this->assertTrue($this->db->ContainsCommand($loadResourceCommand));
     $this->assertTrue($this->db->ContainsCommand($attributes));
     $this->assertNotNull($resource);
     $this->assertEquals('value', $resource->GetAttributeValue(1));
     $this->assertEquals('value2', $resource->GetAttributeValue(2));
 }
コード例 #2
0
 /**
  * @param SchedulePeriod $begin
  * @param SchedulePeriod $end
  * @param Date $displayDate
  * @param int $periodSpan
  * @param ReservationItemView $reservation
  */
 public function __construct(SchedulePeriod $begin, SchedulePeriod $end, Date $displayDate, $periodSpan, ReservationItemView $reservation)
 {
     $this->_reservation = $reservation;
     $this->_begin = $begin->BeginDate();
     $this->_displayDate = $displayDate;
     $this->_end = $end->EndDate();
     $this->_periodSpan = $periodSpan;
     $this->_participantNumber = count($reservation->ParticipantIds);
     $this->_participantNames = $reservation->ParticipantNames;
     $this->_inviteeNames = $reservation->InviteeNames;
     $this->_beginSlotId = $begin->Id();
     $this->_endSlotId = $end->Id();
     $resourceId = $this->_reservation->GetResourceId();
     $resourceRepo = new ResourceRepository();
     $resource = $resourceRepo->LoadById($resourceId);
     $this->_maxparticipants = $resource->GetMaxParticipants();
     $this->_beginPeriod = $begin;
     $this->_endPeriod = $end;
 }
コード例 #3
0
 public function PageLoad()
 {
     $resourceId = $this->page->GetResourceId();
     $resource = $this->resourceRepository->LoadById($resourceId);
     $this->page->BindResource($resource);
     $attributeList = $this->attributeService->GetAttributes(CustomAttributeCategory::RESOURCE, $resourceId);
     $this->page->BindAttributes($attributeList->GetAttributes($resourceId));
     if ($resource->HasResourceType()) {
         $resourceType = $this->resourceRepository->LoadResourceType($resource->GetResourceTypeId());
         $attributeList = $this->attributeService->GetAttributes(CustomAttributeCategory::RESOURCE_TYPE, $resource->GetResourceTypeId());
         $this->page->BindResourceType($resourceType, $attributeList->GetAttributes($resource->GetResourceTypeId()));
     }
 }