Esempio n. 1
0
 public function ShowUserAttributes()
 {
     // User attributes on Dashboard, Added by Burak C.
     $userId = ServiceLocator::GetServer()->GetUserSession()->UserId;
     $userRepository = new UserRepository();
     $this->user = $userRepository->LoadById($userId);
     $attributeService = new AttributeService(new AttributeRepository());
     $attributes = $attributeService->GetByCategory(CustomAttributeCategory::USER);
     $reservationViewRepository = new ReservationViewRepository();
     $startDate = Date::Now();
     $endDate = $startDate->AddDays(30);
     $reservations = $reservationViewRepository->GetReservationList($startDate, $endDate, $userId, ReservationUserLevel::INVITEE);
     $this->_page->Set("invitations", $reservations);
     $this->_page->Set("user", $this->user);
     $this->_page->Set("attributes", $attributes);
 }
 public function testReturnsAllBlackoutInstancesWithinDateRange()
 {
     $dateRange = new TestDateRange();
     $start = Date::Now();
     $end = Date::Now();
     $instanceId = 12;
     $seriesId = 222;
     $resourceId = 333;
     $userid = 444;
     $scheduleId = 555;
     $resourceName = 'resource 123';
     $firstName = 'f';
     $lastName = 'l';
     $title = 'title';
     $description = 'description';
     $repeatType = RepeatType::Daily;
     $repeat = new RepeatDaily(1, $end->AddDays(2));
     $repeatOptions = $repeat->ConfigurationString();
     $rows[] = $this->GetBlackoutRow($instanceId, $start, $end, $resourceId, $userid, $scheduleId, $title, $description, $firstName, $lastName, $resourceName, $seriesId, $repeatType, $repeatOptions);
     $rows[] = $this->GetBlackoutRow("1", Date::Now(), Date::Now());
     $this->db->SetRows($rows);
     $getBlackoutsCommand = new GetBlackoutListCommand($dateRange->GetBegin(), $dateRange->GetEnd(), ReservationViewRepository::ALL_SCHEDULES);
     $blackouts = $this->repository->GetBlackoutsWithin($dateRange);
     $b = new BlackoutItemView($instanceId, $start->ToUtc(), $end->ToUtc(), $resourceId, $userid, $scheduleId, $title, $description, $firstName, $lastName, $resourceName, $seriesId, $repeatOptions, $repeatType);
     $this->assertEquals($getBlackoutsCommand, $this->db->_LastCommand);
     $this->assertEquals(2, count($blackouts));
     $this->assertEquals($b, $blackouts[0]);
 }