示例#1
0
 /**
  * @param int $scheduleId
  * @param ISchedulePage $page
  * @return ScheduleResourceFilter
  */
 public function GetResourceFilter($scheduleId, ISchedulePage $page)
 {
     $filter = new ScheduleResourceFilter();
     if ($page->FilterSubmitted()) {
         $filter = new ScheduleResourceFilter($scheduleId, $page->GetResourceTypeId(), $page->GetMaxParticipants(), $this->AsAttributeValues($page->GetResourceAttributes()), $this->AsAttributeValues($page->GetResourceTypeAttributes()));
     } else {
         $cookie = ServiceLocator::GetServer()->GetCookie('resource_filter' . $scheduleId);
         if (!empty($cookie)) {
             $val = json_decode($cookie);
             $filter = ScheduleResourceFilter::FromCookie($val);
         }
     }
     $filter->ScheduleId = $scheduleId;
     $filter->ResourceId = $this->GetResourceId($scheduleId, $page);
     $filter->GroupId = $this->GetGroupId($scheduleId, $page);
     return $filter;
 }