Exemplo n.º 1
0
 public function PageLoad()
 {
     $resourceAttributes = $this->attributeService->GetByCategory(CustomAttributeCategory::RESOURCE);
     $filterValues = $this->page->GetFilterValues();
     $results = $this->resourceRepository->GetList($this->page->GetPageNumber(), $this->page->GetPageSize(), null, null, $filterValues->AsFilter($resourceAttributes));
     $resources = $results->Results();
     $this->page->BindResources($resources);
     $this->page->BindPageInfo($results->PageInfo());
     $schedules = $this->scheduleRepository->GetAll();
     $scheduleList = array();
     /* @var $schedule Schedule */
     foreach ($schedules as $schedule) {
         $scheduleList[$schedule->GetId()] = $schedule->GetName();
     }
     $this->page->BindSchedules($scheduleList);
     $this->page->AllSchedules($schedules);
     $resourceTypes = $this->resourceRepository->GetResourceTypes();
     $resourceTypeList = array();
     /* @var $resourceType ResourceType */
     foreach ($resourceTypes as $resourceType) {
         $resourceTypeList[$resourceType->Id()] = $resourceType;
     }
     $this->page->BindResourceTypes($resourceTypeList);
     $statusReasons = $this->resourceRepository->GetStatusReasons();
     $statusReasonList = array();
     foreach ($statusReasons as $reason) {
         $statusReasonList[$reason->Id()] = $reason;
     }
     $this->page->BindResourceStatusReasons($statusReasonList);
     $groups = $this->groupRepository->GetGroupsByRole(RoleLevel::RESOURCE_ADMIN);
     $this->page->BindAdminGroups($groups);
     $resourceIds = array();
     foreach ($resources as $resource) {
         $resourceIds[] = $resource->GetId();
     }
     $attributeList = $this->attributeService->GetAttributes(CustomAttributeCategory::RESOURCE, $resourceIds);
     $this->page->BindAttributeList($attributeList);
     $this->InitializeFilter($filterValues, $resourceAttributes);
 }