ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilOrgUnitUserAssignmentQueries.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
29 
30  public static function getInstance(): self
31  {
32  if (!isset(self::$instance)) {
33  global $DIC;
34  self::$instance = new self($DIC["ilDB"]);
35  }
36 
37  return self::$instance;
38  }
39 
43  public function getPositionsOfUserId(int $user_id): array
44  {
45  return $this->getPositionsByUser($user_id);
46  }
47 
52  public function getAssignmentOrFail(int $user_id, int $position_id, int $orgu_id): ilOrgUnitUserAssignment
53  {
54  $assignment = $this->find($user_id, $position_id, $orgu_id);
55  if (!$assignment) {
56  throw new ilException('UserAssignment not found');
57  }
58  return $assignment;
59  }
60 
64  public function getAssignmentsOfUserId(int $user_id): array
65  {
66  return $this->getByUsers([$user_id]);
67  }
68 
72  public function getAssignmentsOfUserIds(array $user_ids): array
73  {
74  return $this->getByUsers($user_ids);
75  }
76 
80  public function getAssignmentsOfUserIdAndPosition(int $user_id, int $position_id): array
81  {
82  return $this->getByUserAndPosition($user_id, $position_id);
83  }
84 
88  public function getUserIdsOfOrgUnit(int $orgu_id): array
89  {
90  return $this->getUsersByOrgUnits([$orgu_id]);
91  }
92 
96  public function getUserIdsOfOrgUnits(array $orgu_ids): array
97  {
98  return $this->getUsersByOrgUnits($orgu_ids);
99  }
100 
104  public function getUserIdsOfOrgUnitsOfUsersPosition(int $position_id, int $user_id, bool $recursive = false): array
105  {
106  return $this->getUsersByUserAndPosition($user_id, $position_id, $recursive);
107  }
108 
112  public function getUserIdsOfOrgUnitsInPosition(array $orgu_ids, int $position_id): array
113  {
114  return $this->getUsersByOrgUnitsAndPosition($orgu_ids, $position_id);
115  }
116 
120  public function getUserIdsOfUsersOrgUnitsInPosition(int $user_id, int $users_position_id, int $position_id, bool $recursive = false): array
121  {
122  return $this->getFilteredUsersByUserAndPosition($user_id, $position_id, $users_position_id, $recursive);
123  }
124 
128  public function getOrgUnitIdsofUser(int $user_id): array
129  {
130  return $this->getOrgUnitsByUser($user_id);
131  }
132 
136  public function getOrgUnitIdsOfUsersPosition(int $position_id, int $user_id, bool $recursive = false): array
137  {
138  return $this->getOrgUnitsByUserAndPosition($user_id, $position_id, $recursive);
139  }
140 
144  public function getUserIdsOfPosition(int $position_id): array
145  {
146  return $this->getUsersByPosition($position_id);
147  }
148 
152  public function getUserAssignmentsOfPosition(int $position_id): array
153  {
154  return $this->getByPosition($position_id);
155  }
156 
160  public function deleteAllAssignmentsOfUser(int $user_id): void
161  {
162  $this->deleteByUser($user_id);
163  }
164 }
getUsersByPosition(int $position_id)
Get all users with a certain position.
getPositionsByUser(int $user_id)
Get all positions a user is assigned to.
static ilOrgUnitUserAssignmentQueries $instance
getFilteredUsersByUserAndPosition(int $user_id, int $position_id, int $position_filter_id, bool $recursive=false)
Get all users with position $position_filter_id from those org-units, where the user has position $po...
getUsersByOrgUnits(array $orgu_ids)
Get all users for a given set of org-units.
getByUserAndPosition(int $user_id, int $position_id)
Get assignments for a user in a dedicated position.
getAssignmentsOfUserIdAndPosition(int $user_id, int $position_id)
getOrgUnitsByUser(int $user_id)
Get all org-units a user is assigned to.
deleteByUser(int $user_id)
Delete all assignments for a user_id Returns false if no assignments were found.
getUsersByUserAndPosition(int $user_id, int $position_id, bool $recursive=false)
Get all users from org-units where the user has a certain position i.e.
getOrgUnitIdsOfUsersPosition(int $position_id, int $user_id, bool $recursive=false)
getAssignmentOrFail(int $user_id, int $position_id, int $orgu_id)
global $DIC
Definition: shib_login.php:22
find(int $user_id, int $position_id, int $orgu_id)
Find assignment for user, position and org-unit Does not create new assigment, returns null if no ass...
getUserIdsOfOrgUnitsInPosition(array $orgu_ids, int $position_id)
getUserIdsOfOrgUnitsOfUsersPosition(int $position_id, int $user_id, bool $recursive=false)
getByPosition(int $position_id)
Get all assignments for a position.
getOrgUnitsByUserAndPosition(int $user_id, int $position_id, bool $recursive=false)
Get all org-units where a user has a dedicated position.
getUsersByOrgUnitsAndPosition(array $orgu_ids, int $position_id)
Get all users in a specific position for a given set of org-units.
getUserIdsOfUsersOrgUnitsInPosition(int $user_id, int $users_position_id, int $position_id, bool $recursive=false)
getByUsers(array $user_ids)
Get assignments for one or more users.