24 if (!isset(self::$instance)) {
25 self::$instance =
new self();
28 return self::$instance;
39 public function findOrCreateAssignment($user_id, $position_id, $orgu_id)
45 'user_id' => $user_id,
46 'position_id' => $position_id,
47 'orgu_id' => $orgu_id,
49 if (!$user_assignment) {
54 $user_assignment->setPositionId($position_id);
55 $user_assignment->setUserId($user_id);
56 $user_assignment->setOrguId($orgu_id);
57 $user_assignment->create();
60 return $user_assignment;
71 public function findAllUserAssingmentsByUserIds($arr_user_ids) : array
75 $user_assignment_list_by_user = [];
76 foreach ($user_assignment_list as $user_assignment) {
80 $user_assignment_list_by_user[$user_assignment->getUserId()][] = $user_assignment;
83 return $user_assignment_list_by_user;
98 orgu_ua.orgu_id AS orgu_id, 99 orgu_ua.user_id AS empl, 100 orgu_ua2.user_id as sup 102 il_orgu_ua as orgu_ua, 103 il_orgu_ua as orgu_ua2 105 orgu_ua.orgu_id = orgu_ua2.orgu_id 106 and orgu_ua.user_id <> orgu_ua2.user_id 109 AND " . $DIC->database()->in(
'orgu_ua.user_id', $arr_empl_user_ids,
false,
'integer');
111 $st = $DIC->database()->query($sql);
113 $empl_id__sup_ids = [];
114 while (
$data = $DIC->database()->fetchAssoc($st)) {
115 $empl_id__sup_ids[
$data[
'empl']][] = $data[
'sup'];
117 $this->arr_empl_user_ids = $empl_id__sup_ids;
119 return $empl_id__sup_ids;
128 public function getPositionsOfUserId($user_id)
135 $positions[] = ilOrgUnitPosition::find($assignment->getPositionId());
153 'user_id' => $user_id,
154 'position_id' => $position_id,
155 'orgu_id' => $orgu_id,
158 throw new ilException(
'UserAssignement not found');
215 ->getArray(null,
'user_id');
228 'orgu_id' => $orgu_ids,
229 'position_id' => $position_id,
230 ])->getArray(null,
'user_id');
247 'position_id' => $position_id,
248 ])->getArray(null,
'user_id');
263 'position_id' => $position_id,
264 'user_id' => $user_id,
265 ])->getArray(null,
'orgu_id');
271 $recursive_orgu_ids = [];
273 foreach ($orgu_ids as $orgu_id) {
274 $recursive_orgu_ids = $recursive_orgu_ids + $tree->getAllChildren($orgu_id);
277 return $recursive_orgu_ids;
289 'position_id' => $position_id,
290 ])->getArray(null,
'user_id');
302 'position_id' => $position_id,
315 $q =
"DELETE FROM il_orgu_ua WHERE user_id = " . $DIC->database()->quote($user_id,
"integer");
316 $DIC->database()->manipulate($q);
getUserIdsOfOrgUnitsOfUsersPosition($position_id, $user_id, $recursive=false)
getEmplSuperiorList($arr_empl_user_ids)
getUserIdsOfOrgUnit($orgunit_ref_id)
getOrgUnitIdsOfUsersPosition($position_id, $user_id, $recursive=false)
const CORE_POSITION_EMPLOYEE
getUserIdsOfOrgUnitsInPosition(array $orgu_ids, $position_id)
getUserIdsOfUsersOrgUnitsInPosition($user_id, $users_position_id, $position_id, $recursive=false)
getUserAssignmentsOfPosition($position_id)
getAssignmentOrFail($user_id, $position_id, $orgu_id)
static where($where, $operator=null)
getUserIdsOfOrgUnits(array $orgunit_ref_id)
getAssignmentsOfUserId($user_id)
getUserIdsOfPosition($position_id)
const CORE_POSITION_SUPERIOR
filterUserIdsDueToAuthorities($user_id, array $user_ids)
deleteAllAssignmentsOfUser($user_id)