Exemplo n.º 1
0
 public static function StoreSessionProjects($caller, $lists)
 {
     $sessionProjects = self::GetSessionProjects($caller->user());
     //Init $sessionProjects if unset
     if (!isset($sessionProjects)) {
         $sessionProjects = array();
     }
     foreach ($lists[\Library\Enums\SessionKeys::UserProjects] as $project) {
         $sessionProjects[\Library\Enums\SessionKeys::ProjectKey . $project->project_id()] = self::MakeSessionProject($project);
         if ($caller->user()->getAttribute(\Library\Enums\SessionKeys::UserRole == 2)) {
             PmHelper::AddAProjectIdToList($caller->user(), $project->project_id());
         }
     }
     self::SetSessionProjects($caller->user(), $sessionProjects);
     foreach ($sessionProjects as $sessionProject) {
         $project_id = intval($sessionProject[\Library\Enums\SessionKeys::ProjectObject]->project_id());
         $facility = CommonHelper::FindObjectByIntValue($project_id, "project_id", $lists[\Library\Enums\SessionKeys::UserProjectFacilityList]);
         $sessionProject[\Library\Enums\SessionKeys::FacilityObject] = $facility;
         $client = CommonHelper::FindObjectByIntValue($project_id, "project_id", $lists[\Library\Enums\SessionKeys::UserProjectClientList]);
         $sessionProject[\Library\Enums\SessionKeys::ClientObject] = $client;
         $sessionProjectUpdated = self::FillProjectSessionWithDataList($caller, $sessionProject);
         $sessionProjects[\Library\Enums\SessionKeys::ProjectKey . $project_id] = $sessionProjectUpdated;
     }
     self::SetSessionProjects($caller->user(), $sessionProjects);
     return $sessionProjects;
 }
Exemplo n.º 2
0
 public static function GetAService(\Library\User $user, $service_id)
 {
     $match = NULL;
     $pm = PmHelper::GetCurrentSessionPm($user);
     $services = $pm[\Library\Enums\SessionKeys::PmServices];
     if ($services !== NULL) {
         $match = CommonHelper::FindObjectByIntValue($service_id, "service_id", $services);
     }
     return $match;
 }