ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository Class Reference
+ Collaboration diagram for OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository:

Public Member Functions

 getEmplSuperiorList ($arr_empl_user_ids)
 
 getAssignmentOrFail ($user_id, $position_id, $orgu_id)
 
 filterUserIdsDueToAuthorities ($user_id, array $user_ids)
 
 getAssignmentsOfUserId ($user_id)
 
 getUserIdsOfOrgUnit ($orgunit_ref_id)
 
 getUserIdsOfOrgUnits (array $orgunit_ref_id)
 
 getUserIdsOfOrgUnitsOfUsersPosition ($position_id, $user_id, $recursive=false)
 
 getUserIdsOfOrgUnitsInPosition (array $orgu_ids, $position_id)
 
 getUserIdsOfUsersOrgUnitsInPosition ($user_id, $users_position_id, $position_id, $recursive=false)
 
 getOrgUnitIdsOfUsersPosition ($position_id, $user_id, $recursive=false)
 
 getUserIdsOfPosition ($position_id)
 
 getUserAssignmentsOfPosition ($position_id)
 
 deleteAllAssignmentsOfUser ($user_id)
 

Static Public Member Functions

static getInstance ()
 

Static Protected Attributes

static $instance
 

Detailed Description

Definition at line 10 of file class.ilOrgUnitUserAssignmentRepository.php.

Member Function Documentation

◆ deleteAllAssignmentsOfUser()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::deleteAllAssignmentsOfUser (   $user_id)
Parameters
int$user_id
Returns
void

Definition at line 312 of file class.ilOrgUnitUserAssignmentRepository.php.

References $DIC.

313  {
314  global $DIC;
315  $q = "DELETE FROM il_orgu_ua WHERE user_id = " . $DIC->database()->quote($user_id, "integer");
316  $DIC->database()->manipulate($q);
317  }
global $DIC
Definition: goto.php:24

◆ filterUserIdsDueToAuthorities()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::filterUserIdsDueToAuthorities (   $user_id,
array  $user_ids 
)

Definition at line 165 of file class.ilOrgUnitUserAssignmentRepository.php.

166  {
167  }

◆ getAssignmentOrFail()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getAssignmentOrFail (   $user_id,
  $position_id,
  $orgu_id 
)
Parameters
int$user_id
int$position_id
int$orgu_idOrg-Units Ref-ID
Returns
Exceptions

Definition at line 150 of file class.ilOrgUnitUserAssignmentRepository.php.

References ActiveRecord\where().

151  {
153  'user_id' => $user_id,
154  'position_id' => $position_id,
155  'orgu_id' => $orgu_id,
156  ])->first();
157  if (!$ua) {
158  throw new ilException('UserAssignement not found');
159  }
160 
161  return $ua;
162  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getAssignmentsOfUserId()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getAssignmentsOfUserId (   $user_id)
Parameters
$user_id
Returns
ilOrgUnitUserAssignment[]

Definition at line 175 of file class.ilOrgUnitUserAssignmentRepository.php.

References ActiveRecord\where().

Referenced by OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository\getEmplSuperiorList().

176  {
177  return ilOrgUnitUserAssignment::where(['user_id' => $user_id])->get();
178  }
static where($where, $operator=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEmplSuperiorList()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getEmplSuperiorList (   $arr_empl_user_ids)
Parameters
$arr_empl_user_ids
Returns
array [user_id as an employee][][ user_id as a superior]

Definition at line 93 of file class.ilOrgUnitUserAssignmentRepository.php.

References $data, $DIC, ilOrgUnitPosition\CORE_POSITION_EMPLOYEE, ilOrgUnitPosition\CORE_POSITION_SUPERIOR, and OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository\getAssignmentsOfUserId().

93  : array
94  {
95  global $DIC;
96 
97  $sql = "SELECT
98  orgu_ua.orgu_id AS orgu_id,
99  orgu_ua.user_id AS empl,
100  orgu_ua2.user_id as sup
101  FROM
102  il_orgu_ua as orgu_ua,
103  il_orgu_ua as orgu_ua2
104  WHERE
105  orgu_ua.orgu_id = orgu_ua2.orgu_id
106  and orgu_ua.user_id <> orgu_ua2.user_id
107  and orgu_ua.position_id = " . ilOrgUnitPosition::CORE_POSITION_EMPLOYEE . "
108  and orgu_ua2.position_id = " . ilOrgUnitPosition::CORE_POSITION_SUPERIOR . "
109  AND " . $DIC->database()->in('orgu_ua.user_id', $arr_empl_user_ids, false, 'integer');
110 
111  $st = $DIC->database()->query($sql);
112 
113  $empl_id__sup_ids = [];
114  while ($data = $DIC->database()->fetchAssoc($st)) {
115  $empl_id__sup_ids[$data['empl']][] = $data['sup'];
116  }
117  $this->arr_empl_user_ids = $empl_id__sup_ids;
118 
119  return $empl_id__sup_ids;
120  }
$data
Definition: storeScorm.php:23
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ getInstance()

static OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getInstance ( )
static
Returns
ilOrgUnitUserAssignmentRepository

Definition at line 22 of file class.ilOrgUnitUserAssignmentRepository.php.

References ActiveRecord\where().

23  {
24  if (!isset(self::$instance)) {
25  self::$instance = new self();
26  }
27 
28  return self::$instance;
29  }
+ Here is the call graph for this function:

◆ getOrgUnitIdsOfUsersPosition()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getOrgUnitIdsOfUsersPosition (   $position_id,
  $user_id,
  $recursive = false 
)
Parameters
$position_id
$user_id
bool$recursive
Returns
int[]

Definition at line 260 of file class.ilOrgUnitUserAssignmentRepository.php.

References ilObjOrgUnitTree\_getInstance(), and ActiveRecord\where().

Referenced by OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository\getUserIdsOfOrgUnitsOfUsersPosition(), and OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository\getUserIdsOfUsersOrgUnitsInPosition().

261  {
262  $orgu_ids = ilOrgUnitUserAssignment::where([
263  'position_id' => $position_id,
264  'user_id' => $user_id,
265  ])->getArray(null, 'orgu_id');
266 
267  if (!$recursive) {
268  return $orgu_ids;
269  }
270 
271  $recursive_orgu_ids = [];
273  foreach ($orgu_ids as $orgu_id) {
274  $recursive_orgu_ids = $recursive_orgu_ids + $tree->getAllChildren($orgu_id);
275  }
276 
277  return $recursive_orgu_ids;
278  }
static where($where, $operator=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserAssignmentsOfPosition()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getUserAssignmentsOfPosition (   $position_id)
Parameters
$position_id
Returns
ilOrgUnitUserAssignment[]

Definition at line 299 of file class.ilOrgUnitUserAssignmentRepository.php.

References ActiveRecord\where().

300  {
302  'position_id' => $position_id,
303  ])->get();
304  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getUserIdsOfOrgUnit()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getUserIdsOfOrgUnit (   $orgunit_ref_id)
Parameters
$orgunit_ref_id
Returns
ilOrgUnitUserAssignment[]

Definition at line 186 of file class.ilOrgUnitUserAssignmentRepository.php.

References ActiveRecord\where().

187  {
188  return ilOrgUnitUserAssignment::where(['orgu_id' => $orgunit_ref_id])->getArray(null, 'user_id');
189  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getUserIdsOfOrgUnits()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getUserIdsOfOrgUnits ( array  $orgunit_ref_id)
Parameters
$orgunit_ref_id
Returns
ilOrgUnitUserAssignment[]

Definition at line 197 of file class.ilOrgUnitUserAssignmentRepository.php.

References ActiveRecord\where().

198  {
199  return ilOrgUnitUserAssignment::where(['orgu_id' => $orgunit_ref_id])->getArray(null, 'user_id');
200  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getUserIdsOfOrgUnitsInPosition()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getUserIdsOfOrgUnitsInPosition ( array  $orgu_ids,
  $position_id 
)
Parameters
array$orgu_ids
$position_id
Returns
int[]

Definition at line 225 of file class.ilOrgUnitUserAssignmentRepository.php.

References ActiveRecord\where().

226  {
228  'orgu_id' => $orgu_ids,
229  'position_id' => $position_id,
230  ])->getArray(null, 'user_id');
231  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getUserIdsOfOrgUnitsOfUsersPosition()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getUserIdsOfOrgUnitsOfUsersPosition (   $position_id,
  $user_id,
  $recursive = false 
)
Parameters
$position_id
$user_id
bool$recursive
Returns
[]

Definition at line 212 of file class.ilOrgUnitUserAssignmentRepository.php.

References OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository\getOrgUnitIdsOfUsersPosition(), and ActiveRecord\where().

213  {
214  return ilOrgUnitUserAssignment::where(['orgu_id' => $this->getOrgUnitIdsOfUsersPosition($position_id, $user_id, $recursive)])
215  ->getArray(null, 'user_id');
216  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getUserIdsOfPosition()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getUserIdsOfPosition (   $position_id)
Parameters
$position_id
Returns
int[]

Definition at line 286 of file class.ilOrgUnitUserAssignmentRepository.php.

References ActiveRecord\where().

287  {
289  'position_id' => $position_id,
290  ])->getArray(null, 'user_id');
291  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getUserIdsOfUsersOrgUnitsInPosition()

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::getUserIdsOfUsersOrgUnitsInPosition (   $user_id,
  $users_position_id,
  $position_id,
  $recursive = false 
)
Parameters
$user_id
$users_position_id
$position_id
bool$recursive
Returns
int[]

Definition at line 243 of file class.ilOrgUnitUserAssignmentRepository.php.

References OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository\getOrgUnitIdsOfUsersPosition(), and ActiveRecord\where().

244  {
246  'orgu_id' => $this->getOrgUnitIdsOfUsersPosition($users_position_id, $user_id, $recursive),
247  'position_id' => $position_id,
248  ])->getArray(null, 'user_id');
249  }
static where($where, $operator=null)
+ Here is the call graph for this function:

Field Documentation

◆ $instance

OrgUnit\Positions\UserAssignment\ilOrgUnitUserAssignmentRepository::$instance
staticprotected

Definition at line 16 of file class.ilOrgUnitUserAssignmentRepository.php.


The documentation for this class was generated from the following file: