ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilECSCourseMemberAssignment Class Reference

Storage of ecs course assignments. More...

+ Collaboration diagram for ilECSCourseMemberAssignment:

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 getId ()
 
 setServer ($a_server)
 Set server. More...
 
 getServer ()
 Get server. More...
 
 setMid ($a_mid)
 
 getMid ()
 
 setCmsId ($a_id)
 
 getCmsId ()
 
 setCmsSubId ($a_id)
 
 getCmsSubId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setUid ($a_id)
 
 getUid ()
 
 setStatus ($a_status)
 
 getStatus ()
 
 save ()
 Save new entry @global type $ilDB. More...
 
 update ()
 Update assignemt @global type $ilDB. More...
 
 delete ()
 Delete entry. More...
 

Static Public Member Functions

static lookupMissingAssignmentsOfUser ($a_usr_id)
 Lookup missing assignments; @global type $ilDB. More...
 
static deleteByObjId ($a_obj_id)
 Delete by obj_id. More...
 
static deleteByServerId ($a_server_id)
 Delete by server id @global type $ilDB. More...
 
static lookupUserIds ($a_cms_id, $a_cms_sub_id, $a_obj_id)
 Lookup user ids @global type $ilDB. More...
 
static lookupAssignment ($a_cms_id, $a_cms_sub_id, $a_obj_id, $a_usr_id)
 Lookup assignment of user @global type $ilDB. More...
 

Data Fields

const STATUS_ASSIGNED = 0
 
const STATUS_LOCAL_DELETED = 1
 

Protected Member Functions

 read ()
 Read from db. More...
 

Private Attributes

 $id
 
 $server
 
 $mid
 
 $cms_id
 
 $cms_sub_id = 0
 
 $obj_id
 
 $uid
 
 $status = 0
 

Detailed Description

Storage of ecs course assignments.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 9 of file class.ilECSCourseMemberAssignment.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSCourseMemberAssignment::__construct (   $a_id = 0)

Constructor.

Definition at line 27 of file class.ilECSCourseMemberAssignment.php.

28 {
29 $this->id = $a_id;
30
31 $this->read();
32 }

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilECSCourseMemberAssignment::delete ( )

Delete entry.

Definition at line 310 of file class.ilECSCourseMemberAssignment.php.

311 {
312 global $DIC;
313
314 $ilDB = $DIC['ilDB'];
315
316 $query = 'DELETE FROM ecs_course_assignments ' .
317 'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
318 $ilDB->manipulate($query);
319 return true;
320 }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, $query, and getId().

+ Here is the call graph for this function:

◆ deleteByObjId()

static ilECSCourseMemberAssignment::deleteByObjId (   $a_obj_id)
static

Delete by obj_id.

Definition at line 62 of file class.ilECSCourseMemberAssignment.php.

63 {
64 global $DIC;
65
66 $ilDB = $DIC['ilDB'];
67
68 $query = 'DELETE FROM ecs_course_assignments ' .
69 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
70 $ilDB->manipulate($query);
71 return true;
72 }

References $DIC, $ilDB, and $query.

◆ deleteByServerId()

static ilECSCourseMemberAssignment::deleteByServerId (   $a_server_id)
static

Delete by server id @global type $ilDB.

Parameters
type$a_server_id
Returns
boolean

Definition at line 80 of file class.ilECSCourseMemberAssignment.php.

81 {
82 global $DIC;
83
84 $ilDB = $DIC['ilDB'];
85
86 $query = 'DELETE FROM ecs_course_assignments ' .
87 'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer');
88 $ilDB->manipulate($query);
89 return true;
90 }

References $DIC, $ilDB, and $query.

◆ getCmsId()

ilECSCourseMemberAssignment::getCmsId ( )

Definition at line 198 of file class.ilECSCourseMemberAssignment.php.

References $cms_id.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getCmsSubId()

ilECSCourseMemberAssignment::getCmsSubId ( )

Definition at line 208 of file class.ilECSCourseMemberAssignment.php.

References $cms_sub_id.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getId()

ilECSCourseMemberAssignment::getId ( )

Definition at line 160 of file class.ilECSCourseMemberAssignment.php.

References $id.

Referenced by delete(), read(), save(), and update().

+ Here is the caller graph for this function:

◆ getMid()

ilECSCourseMemberAssignment::getMid ( )

Definition at line 188 of file class.ilECSCourseMemberAssignment.php.

References $mid.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getObjId()

ilECSCourseMemberAssignment::getObjId ( )

Definition at line 218 of file class.ilECSCourseMemberAssignment.php.

References $obj_id.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getServer()

ilECSCourseMemberAssignment::getServer ( )

Get server.

Returns
int

Definition at line 178 of file class.ilECSCourseMemberAssignment.php.

References $server.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getStatus()

ilECSCourseMemberAssignment::getStatus ( )

Definition at line 238 of file class.ilECSCourseMemberAssignment.php.

References $status.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getUid()

ilECSCourseMemberAssignment::getUid ( )

Definition at line 228 of file class.ilECSCourseMemberAssignment.php.

References $uid.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ lookupAssignment()

static ilECSCourseMemberAssignment::lookupAssignment (   $a_cms_id,
  $a_cms_sub_id,
  $a_obj_id,
  $a_usr_id 
)
static

Lookup assignment of user @global type $ilDB.

Parameters
type$a_cms_id
type$a_obj_id
type$a_usr_id
Returns
\ilECSCourseMemberAssignment|null

Definition at line 134 of file class.ilECSCourseMemberAssignment.php.

135 {
136 global $DIC;
137
138 $ilDB = $DIC['ilDB'];
139
140 $cms_sub_id_query = '';
141 if (is_null($a_cms_sub_id)) {
142 $cms_sub_id_query = 'AND cms_sub_id IS NULL ';
143 } else {
144 $cms_sub_id_query = 'AND cms_sub_id = ' . $ilDB->quote($a_cms_sub_id, 'integer') . ' ';
145 }
146
147 $query = 'SELECT id FROM ecs_course_assignments ' .
148 'WHERE cms_id = ' . $ilDB->quote($a_cms_id, 'integer') . ' ' .
149 $cms_sub_id_query .
150 'AND obj_id = ' . $ilDB->quote($a_obj_id, 'integer') . ' ' .
151 'AND usr_id = ' . $ilDB->quote($a_usr_id, 'text');
152 $res = $ilDB->query($query);
153 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
154 return new ilECSCourseMemberAssignment($row->id);
155 }
156 return null;
157 }
Storage of ecs course assignments.
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus(), and save().

+ Here is the caller graph for this function:

◆ lookupMissingAssignmentsOfUser()

static ilECSCourseMemberAssignment::lookupMissingAssignmentsOfUser (   $a_usr_id)
static

Lookup missing assignments; @global type $ilDB.

Parameters
stringaccount
Returns
ilECSCourseMemberAssignment[]

Definition at line 40 of file class.ilECSCourseMemberAssignment.php.

41 {
42 global $DIC;
43
44 $ilDB = $DIC['ilDB'];
45
46 $query = 'SELECT id FROM ecs_course_assignments ' .
47 'WHERE usr_id = ' . $ilDB->quote($a_usr_id, 'text');
48 $res = $ilDB->query($query);
49
50 $obj_ids = array();
51
52 $assignments = array();
53 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
54 $assignments[] = new self($row->id);
55 }
56 return $assignments;
57 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSAppEventListener\handleMembership().

+ Here is the caller graph for this function:

◆ lookupUserIds()

static ilECSCourseMemberAssignment::lookupUserIds (   $a_cms_id,
  $a_cms_sub_id,
  $a_obj_id 
)
static

Lookup user ids @global type $ilDB.

Parameters
type$a_cms_id
type$a_obj_id
Returns
type

Definition at line 99 of file class.ilECSCourseMemberAssignment.php.

100 {
101 global $DIC;
102
103 $ilDB = $DIC['ilDB'];
104
105 $cms_sub_id_query = '';
106
107 if (is_null($a_cms_sub_id)) {
108 $cms_sub_id_query = 'AND cms_sub_id IS NULL ';
109 } else {
110 $cms_sub_id_query = 'AND cms_sub_id = ' . $ilDB->quote($a_cms_sub_id, 'integer') . ' ';
111 }
112
113 $query = 'SELECT usr_id FROM ecs_course_assignments ' .
114 'WHERE cms_id = ' . $ilDB->quote($a_cms_id, 'integer') . ' ' .
115 $cms_sub_id_query .
116 'AND obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
117 $res = $ilDB->query($query);
118
119 $usr_ids = array();
120 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
121 $usr_ids[] = $row->usr_id;
122 }
123 return $usr_ids;
124 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus().

+ Here is the caller graph for this function:

◆ read()

ilECSCourseMemberAssignment::read ( )
protected

Read from db.

Returns
bool

Definition at line 328 of file class.ilECSCourseMemberAssignment.php.

329 {
330 global $DIC;
331
332 $ilDB = $DIC['ilDB'];
333
334 if (!$this->getId()) {
335 return false;
336 }
337
338 $query = 'SELECT * FROM ecs_course_assignments ' .
339 'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
340 $res = $ilDB->query($query);
341 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
342 $this->setServer($row->sid);
343 $this->setMid($row->mid);
344 $this->setCmsId($row->cms_id);
345 $this->setCmsSubId($row->cms_sub_id);
346 $this->setObjId($row->obj_id);
347 $this->setUid($row->usr_id);
348 $this->setStatus($row->status);
349 }
350 }

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, getId(), setCmsId(), setCmsSubId(), setMid(), setObjId(), setServer(), setStatus(), and setUid().

Referenced by __construct().

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

◆ save()

ilECSCourseMemberAssignment::save ( )

Save new entry @global type $ilDB.

Definition at line 247 of file class.ilECSCourseMemberAssignment.php.

248 {
249 global $DIC;
250
251 $ilDB = $DIC['ilDB'];
252
253 $this->id = $ilDB->nextId('ecs_course_assignments');
254
255
256 $assignment = self::lookupAssignment(
257 $this->getCmsId(),
258 $this->getCmsSubId(),
259 $this->getObjId(),
260 $this->getUid()
261 );
262 if ($assignment instanceof ilECSCourseMemberAssignment) {
263 $assignment->update();
264 return true;
265 }
266
267 $query = 'INSERT INTO ecs_course_assignments ' .
268 '(id,sid,mid,cms_id,cms_sub_id,obj_id,usr_id,status) ' .
269 'VALUES( ' .
270 $ilDB->quote($this->getId(), 'integer') . ', ' .
271 $ilDB->quote($this->getServer(), 'integer') . ', ' .
272 $ilDB->quote($this->getMid(), 'integer') . ', ' .
273 $ilDB->quote($this->getCmsId(), 'integer') . ', ' .
274 $ilDB->quote($this->getCmsSubId(), 'integer') . ', ' .
275 $ilDB->quote($this->getObjId(), 'integer') . ', ' .
276 $ilDB->quote($this->getUid(), 'text') . ', ' .
277 $ilDB->quote($this->getStatus(), 'integer') . ' ' .
278 ')';
279 $ilDB->manipulate($query);
280 }
static lookupAssignment($a_cms_id, $a_cms_sub_id, $a_obj_id, $a_usr_id)
Lookup assignment of user @global type $ilDB.

References $DIC, $ilDB, $query, getCmsId(), getCmsSubId(), getId(), getMid(), getObjId(), getServer(), getStatus(), getUid(), and lookupAssignment().

+ Here is the call graph for this function:

◆ setCmsId()

ilECSCourseMemberAssignment::setCmsId (   $a_id)

Definition at line 193 of file class.ilECSCourseMemberAssignment.php.

194 {
195 $this->cms_id = $a_id;
196 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCmsSubId()

ilECSCourseMemberAssignment::setCmsSubId (   $a_id)

Definition at line 203 of file class.ilECSCourseMemberAssignment.php.

204 {
205 $this->cms_sub_id = $a_id;
206 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMid()

ilECSCourseMemberAssignment::setMid (   $a_mid)

Definition at line 183 of file class.ilECSCourseMemberAssignment.php.

184 {
185 $this->mid = $a_mid;
186 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setObjId()

ilECSCourseMemberAssignment::setObjId (   $a_id)

Definition at line 213 of file class.ilECSCourseMemberAssignment.php.

214 {
215 $this->obj_id = $a_id;
216 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setServer()

ilECSCourseMemberAssignment::setServer (   $a_server)

Set server.

Parameters
intserver_id

Definition at line 169 of file class.ilECSCourseMemberAssignment.php.

170 {
171 $this->server = $a_server;
172 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStatus()

ilECSCourseMemberAssignment::setStatus (   $a_status)

Definition at line 233 of file class.ilECSCourseMemberAssignment.php.

234 {
235 $this->status = $a_status;
236 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUid()

ilECSCourseMemberAssignment::setUid (   $a_id)

Definition at line 223 of file class.ilECSCourseMemberAssignment.php.

224 {
225 $this->uid = $a_id;
226 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilECSCourseMemberAssignment::update ( )

Update assignemt @global type $ilDB.

Returns
boolean

Definition at line 287 of file class.ilECSCourseMemberAssignment.php.

288 {
289 global $DIC;
290
291 $ilDB = $DIC['ilDB'];
292
293 $query = 'UPDATE ecs_course_assignments ' .
294 'SET ' .
295 'sid = ' . $ilDB->quote($this->getServer(), 'integer') . ', ' .
296 'mid = ' . $ilDB->quote($this->getMid(), 'integer') . ', ' .
297 'cms_id = ' . $ilDB->quote($this->getCmsId(), 'integer') . ', ' .
298 'cms_sub_id = ' . $ilDB->quote($this->getCmsSubId(), 'integer') . ', ' .
299 'obj_id = ' . $ilDB->quote($this->getObjId(), 'integer') . ', ' .
300 'usr_id = ' . $ilDB->quote($this->getUid(), 'text') . ', ' .
301 'status = ' . $ilDB->quote($this->getStatus(), 'integer') . ' ' .
302 'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
303 $ilDB->manipulate($query);
304 return true;
305 }

References $DIC, $ilDB, $query, getCmsId(), getCmsSubId(), getId(), getMid(), getObjId(), getServer(), getStatus(), and getUid().

+ Here is the call graph for this function:

Field Documentation

◆ $cms_id

ilECSCourseMemberAssignment::$cms_id
private

Definition at line 17 of file class.ilECSCourseMemberAssignment.php.

Referenced by getCmsId().

◆ $cms_sub_id

ilECSCourseMemberAssignment::$cms_sub_id = 0
private

Definition at line 18 of file class.ilECSCourseMemberAssignment.php.

Referenced by getCmsSubId().

◆ $id

ilECSCourseMemberAssignment::$id
private

Definition at line 14 of file class.ilECSCourseMemberAssignment.php.

Referenced by getId().

◆ $mid

ilECSCourseMemberAssignment::$mid
private

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

Referenced by getMid().

◆ $obj_id

ilECSCourseMemberAssignment::$obj_id
private

Definition at line 19 of file class.ilECSCourseMemberAssignment.php.

Referenced by getObjId().

◆ $server

ilECSCourseMemberAssignment::$server
private

Definition at line 15 of file class.ilECSCourseMemberAssignment.php.

Referenced by getServer().

◆ $status

ilECSCourseMemberAssignment::$status = 0
private

Definition at line 21 of file class.ilECSCourseMemberAssignment.php.

Referenced by getStatus().

◆ $uid

ilECSCourseMemberAssignment::$uid
private

Definition at line 20 of file class.ilECSCourseMemberAssignment.php.

Referenced by getUid().

◆ STATUS_ASSIGNED

const ilECSCourseMemberAssignment::STATUS_ASSIGNED = 0

Definition at line 11 of file class.ilECSCourseMemberAssignment.php.

◆ STATUS_LOCAL_DELETED

const ilECSCourseMemberAssignment::STATUS_LOCAL_DELETED = 1

Definition at line 12 of file class.ilECSCourseMemberAssignment.php.


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