ILIAS  release_8 Revision v8.24
ilOrgUnitUserAssignmentQueries Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilOrgUnitUserAssignmentQueries:

Public Member Functions

 getPositionsOfUserId (int $user_id)
 
 getAssignmentOrFail (int $user_id, int $position_id, int $orgu_id)
 
 getAssignmentsOfUserId (int $user_id)
 
 getAssignmentsOfUserIdAndPosition (int $user_id, int $position_id)
 
 getUserIdsOfOrgUnit (int $orgunit_ref_id)
 
 getUserIdsOfOrgUnits (array $orgunit_ref_id)
 
 getUserIdsOfOrgUnitsOfUsersPosition (int $position_id, int $user_id, bool $recursive=false)
 
 getUserIdsOfOrgUnitsInPosition (array $orgu_ids, int $position_id)
 
 getUserIdsOfUsersOrgUnitsInPosition (int $user_id, int $users_position_id, int $position_id, bool $recursive=false)
 
 getOrgUnitIdsOfUsersPosition (int $position_id, int $user_id, bool $recursive=false)
 
 getUserIdsOfPosition (int $position_id)
 
 getUserAssignmentsOfPosition (int $position_id)
 
 deleteAllAssignmentsOfUser (int $user_id)
 

Static Public Member Functions

static getInstance ()
 

Static Protected Attributes

static ilOrgUnitUserAssignmentQueries $instance
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilOrgUnitUserAssignmentQueries

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 23 of file class.ilOrgUnitUserAssignmentQueries.php.

Member Function Documentation

◆ deleteAllAssignmentsOfUser()

ilOrgUnitUserAssignmentQueries::deleteAllAssignmentsOfUser ( int  $user_id)
Parameters
int$user_id
Returns
void

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

197 : void
198 {
199 global $DIC;
200 $q = "DELETE FROM il_orgu_ua WHERE user_id = " . $DIC->database()->quote($user_id, "integer");
201 $DIC->database()->manipulate($q);
202 }
global $DIC
Definition: feed.php:28

References $DIC.

◆ getAssignmentOrFail()

ilOrgUnitUserAssignmentQueries::getAssignmentOrFail ( int  $user_id,
int  $position_id,
int  $orgu_id 
)
Exceptions
ilException

Definition at line 52 of file class.ilOrgUnitUserAssignmentQueries.php.

53 {
55 'user_id' => $user_id,
56 'position_id' => $position_id,
57 'orgu_id' => $orgu_id,
58 ])->first();
59 if (!$ua) {
60 throw new ilException('UserAssignement not found');
61 }
62
63 assert($ua instanceof ilOrgUnitUserAssignment);
64 return $ua;
65 }
static where($where, $operator=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilOrgUnitUserAssignment.

References ActiveRecord\where().

+ Here is the call graph for this function:

◆ getAssignmentsOfUserId()

ilOrgUnitUserAssignmentQueries::getAssignmentsOfUserId ( int  $user_id)
Returns
ilOrgUnitUserAssignment[]

Definition at line 70 of file class.ilOrgUnitUserAssignmentQueries.php.

70 : array
71 {
72 return ilOrgUnitUserAssignment::where(['user_id' => $user_id])->get();
73 }

References ActiveRecord\where().

Referenced by getPositionsOfUserId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignmentsOfUserIdAndPosition()

ilOrgUnitUserAssignmentQueries::getAssignmentsOfUserIdAndPosition ( int  $user_id,
int  $position_id 
)
Returns
ilOrgUnitUserAssignment[]

Definition at line 78 of file class.ilOrgUnitUserAssignmentQueries.php.

78 : array
79 {
81 [
82 'user_id' => $user_id,
83 'position_id' => $position_id
84 ]
85 )->get();
86 }

References ActiveRecord\where().

+ Here is the call graph for this function:

◆ getInstance()

◆ getOrgUnitIdsOfUsersPosition()

ilOrgUnitUserAssignmentQueries::getOrgUnitIdsOfUsersPosition ( int  $position_id,
int  $user_id,
bool  $recursive = false 
)
Returns
int[]

Definition at line 153 of file class.ilOrgUnitUserAssignmentQueries.php.

153 : array
154 {
156 'position_id' => $position_id,
157 'user_id' => $user_id,
158 ])->getArray(null, 'orgu_id');
159
160 if (!$recursive) {
161 return $orgu_ids;
162 }
163
164 $recursive_orgu_ids = [];
166 foreach ($orgu_ids as $orgu_id) {
167 $recursive_orgu_ids = $recursive_orgu_ids + $tree->getAllChildren($orgu_id);
168 }
169
170 return $recursive_orgu_ids;
171 }

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

Referenced by getUserIdsOfOrgUnitsOfUsersPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPositionsOfUserId()

ilOrgUnitUserAssignmentQueries::getPositionsOfUserId ( int  $user_id)
Returns
ilOrgUnitPosition[]

Definition at line 39 of file class.ilOrgUnitUserAssignmentQueries.php.

39 : array
40 {
41 $positions = [];
42 foreach ($this->getAssignmentsOfUserId($user_id) as $assignment) {
43 $positions[] = ilOrgUnitPosition::find($assignment->getPositionId());
44 }
45
46 return $positions;
47 }

References getAssignmentsOfUserId().

+ Here is the call graph for this function:

◆ getUserAssignmentsOfPosition()

ilOrgUnitUserAssignmentQueries::getUserAssignmentsOfPosition ( int  $position_id)
Returns
ilOrgUnitUserAssignment[]

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

186 : array
187 {
189 'position_id' => $position_id,
190 ])->get();
191 }

References ActiveRecord\where().

+ Here is the call graph for this function:

◆ getUserIdsOfOrgUnit()

ilOrgUnitUserAssignmentQueries::getUserIdsOfOrgUnit ( int  $orgunit_ref_id)
Parameters
$orgunit_ref_id
Returns
ilOrgUnitUserAssignment[]

Definition at line 92 of file class.ilOrgUnitUserAssignmentQueries.php.

92 : array
93 {
94 return ilOrgUnitUserAssignment::where(['orgu_id' => $orgunit_ref_id])
95 ->getArray(null, 'user_id');
96 }

References ActiveRecord\where().

+ Here is the call graph for this function:

◆ getUserIdsOfOrgUnits()

ilOrgUnitUserAssignmentQueries::getUserIdsOfOrgUnits ( array  $orgunit_ref_id)
Parameters
int[]$orgunit_ref_id
Returns
ilOrgUnitUserAssignment[]

Definition at line 102 of file class.ilOrgUnitUserAssignmentQueries.php.

102 : array
103 {
104 return ilOrgUnitUserAssignment::where(['orgu_id' => $orgunit_ref_id])
105 ->getArray(null, 'user_id');
106 }

References ActiveRecord\where().

+ Here is the call graph for this function:

◆ getUserIdsOfOrgUnitsInPosition()

ilOrgUnitUserAssignmentQueries::getUserIdsOfOrgUnitsInPosition ( array  $orgu_ids,
int  $position_id 
)
Parameters
int[]$orgu_ids
Returns
int[]

Definition at line 126 of file class.ilOrgUnitUserAssignmentQueries.php.

126 : array
127 {
129 'orgu_id' => $orgu_ids,
130 'position_id' => $position_id,
131 ])->getArray(null, 'user_id');
132 }

References ActiveRecord\where().

+ Here is the call graph for this function:

◆ getUserIdsOfOrgUnitsOfUsersPosition()

ilOrgUnitUserAssignmentQueries::getUserIdsOfOrgUnitsOfUsersPosition ( int  $position_id,
int  $user_id,
bool  $recursive = false 
)
Returns
ilOrgUnitUserAssignment[]

Definition at line 111 of file class.ilOrgUnitUserAssignmentQueries.php.

111 : array
112 {
114 $position_id,
115 $user_id,
116 $recursive
117 )
118 ])
119 ->getArray(null, 'user_id');
120 }
getOrgUnitIdsOfUsersPosition(int $position_id, int $user_id, bool $recursive=false)

References getOrgUnitIdsOfUsersPosition(), and ActiveRecord\where().

+ Here is the call graph for this function:

◆ getUserIdsOfPosition()

ilOrgUnitUserAssignmentQueries::getUserIdsOfPosition ( int  $position_id)
Returns
int[]

Definition at line 176 of file class.ilOrgUnitUserAssignmentQueries.php.

176 : array
177 {
179 'position_id' => $position_id,
180 ])->getArray(null, 'user_id');
181 }

References ActiveRecord\where().

+ Here is the call graph for this function:

◆ getUserIdsOfUsersOrgUnitsInPosition()

ilOrgUnitUserAssignmentQueries::getUserIdsOfUsersOrgUnitsInPosition ( int  $user_id,
int  $users_position_id,
int  $position_id,
bool  $recursive = false 
)
Parameters
int[]$users_position_id
Returns
int[]

Definition at line 138 of file class.ilOrgUnitUserAssignmentQueries.php.

143 : array {
145 'orgu_id' => $this->getOrgUnitIdsOfUsersPosition($users_position_id, $user_id, $recursive),
146 'position_id' => $position_id,
147 ])->getArray(null, 'user_id');
148 }

Field Documentation

◆ $instance

ilOrgUnitUserAssignmentQueries ilOrgUnitUserAssignmentQueries::$instance
staticprotected

Definition at line 25 of file class.ilOrgUnitUserAssignmentQueries.php.

Referenced by getInstance().


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