ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilOrgUnitUserAssignment.php
Go to the documentation of this file.
1<?php
2
4
12{
13
17 public static function returnDbTableName()
18 {
19 return 'il_orgu_ua';
20 }
21
22
33 protected $id = 0;
41 protected $user_id = 0;
49 protected $position_id = 0;
57 protected $orgu_id = 0;
58
59
68 {
69 $inst = self::where(array(
70 'user_id' => $user_id,
71 'position_id' => $position_id,
72 'orgu_id' => $orgu_id
73 ))->first();
74 if (!$inst) {
75 $inst = new self();
76 $inst->setPositionId($position_id);
77 $inst->setUserId($user_id);
78 $inst->setOrguId($orgu_id);
79 $inst->create();
80 }
81
82 return $inst;
83 }
84
85 protected function raiseEvent(string $event)
86 {
87 global $DIC;
91 if(!$DIC->offsetExists('ilAppEventHandler')) {
92 return;
93 }
94 $ilAppEventHandler = $DIC['ilAppEventHandler'];
95 $ilAppEventHandler->raise('Modules/OrgUnit', $event, array(
96 'obj_id' => $this->getOrguId(),
97 'usr_id' => $this->getUserId(),
98 'position_id' => $this->getPositionId()
99 ));
100 }
101
102 public function create()
103 {
104 $this->raiseEvent('assignUserToPosition');
105 parent::create();
106 }
107
108 public function delete()
109 {
110 $this->raiseEvent('deassignUserFromPosition');
111 parent::delete();
112 }
113
114
118 public function getId()
119 {
120 return $this->id;
121 }
122
123
127 public function setId($id)
128 {
129 $this->id = $id;
130 }
131
132
136 public function getUserId()
137 {
138 return $this->user_id;
139 }
140
141
145 public function setUserId($user_id)
146 {
147 $this->user_id = $user_id;
148 }
149
150
154 public function getPositionId()
155 {
156 return $this->position_id;
157 }
158
159
164 {
165 $this->position_id = $position_id;
166 }
167
168
172 public function getOrguId()
173 {
174 return $this->orgu_id;
175 }
176
177
181 public function setOrguId($orgu_id)
182 {
183 $this->orgu_id = $orgu_id;
184 }
185}
Class ActiveRecord.
static where($where, $operator=null)
An exception for terminatinating execution or to throw for unit testing.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:18
Class ilOrgUnitUserAssignment.
static findOrCreateAssignment($user_id, $position_id, $orgu_id)
$DIC
Definition: xapitoken.php:46