ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 296 of file class.ilECSCourseMemberAssignment.php.

297 {
298 global $ilDB;
299
300 $query = 'DELETE FROM ecs_course_assignments ' .
301 'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
302 $ilDB->manipulate($query);
303 return true;
304 }
$query
global $ilDB

References $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 60 of file class.ilECSCourseMemberAssignment.php.

61 {
62 global $ilDB;
63
64 $query = 'DELETE FROM ecs_course_assignments ' .
65 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
66 $ilDB->manipulate($query);
67 return true;
68 }

References $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 76 of file class.ilECSCourseMemberAssignment.php.

77 {
78 global $ilDB;
79
80 $query = 'DELETE FROM ecs_course_assignments ' .
81 'WHERE sid = ' . $ilDB->quote($a_server_id, 'integer');
82 $ilDB->manipulate($query);
83 return true;
84 }

References $ilDB, and $query.

◆ getCmsId()

ilECSCourseMemberAssignment::getCmsId ( )

Definition at line 188 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 198 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 150 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 178 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 208 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 168 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 228 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 218 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 126 of file class.ilECSCourseMemberAssignment.php.

127 {
128 global $ilDB;
129
130 $cms_sub_id_query = '';
131 if (is_null($a_cms_sub_id)) {
132 $cms_sub_id_query = 'AND cms_sub_id IS NULL ';
133 } else {
134 $cms_sub_id_query = 'AND cms_sub_id = ' . $ilDB->quote($a_cms_sub_id, 'integer') . ' ';
135 }
136
137 $query = 'SELECT id FROM ecs_course_assignments ' .
138 'WHERE cms_id = ' . $ilDB->quote($a_cms_id, 'integer') . ' ' .
139 $cms_sub_id_query .
140 'AND obj_id = ' . $ilDB->quote($a_obj_id, 'integer') . ' ' .
141 'AND usr_id = ' . $ilDB->quote($a_usr_id, 'text');
142 $res = $ilDB->query($query);
143 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
144 return new ilECSCourseMemberAssignment($row->id);
145 }
146 return null;
147 }
Storage of ecs course assignments.
foreach($_POST as $key=> $value) $res

References $ilDB, $query, $res, $row, 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 $ilDB;
43
44 $query = 'SELECT id FROM ecs_course_assignments ' .
45 'WHERE usr_id = ' . $ilDB->quote($a_usr_id, 'text');
46 $res = $ilDB->query($query);
47
48 $obj_ids = array();
49
50 $assignments = array();
51 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
52 $assignments[] = new self($row->id);
53 }
54 return $assignments;
55 }

References $ilDB, $query, $res, $row, 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 93 of file class.ilECSCourseMemberAssignment.php.

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

References $ilDB, $query, $res, $row, 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 312 of file class.ilECSCourseMemberAssignment.php.

313 {
314 global $ilDB;
315
316 if (!$this->getId()) {
317 return false;
318 }
319
320 $query = 'SELECT * FROM ecs_course_assignments ' .
321 'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
322 $res = $ilDB->query($query);
323 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
324 $this->setServer($row->sid);
325 $this->setMid($row->mid);
326 $this->setCmsId($row->cms_id);
327 $this->setCmsSubId($row->cms_sub_id);
328 $this->setObjId($row->obj_id);
329 $this->setUid($row->usr_id);
330 $this->setStatus($row->status);
331 }
332 }

References $ilDB, $query, $res, $row, 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 237 of file class.ilECSCourseMemberAssignment.php.

238 {
239 global $ilDB;
240
241 $this->id = $ilDB->nextId('ecs_course_assignments');
242
243
244 $assignment = self::lookupAssignment(
245 $this->getCmsId(),
246 $this->getCmsSubId(),
247 $this->getObjId(),
248 $this->getUid()
249 );
250 if ($assignment instanceof ilECSCourseMemberAssignment) {
251 $assignment->update();
252 return true;
253 }
254
255 $query = 'INSERT INTO ecs_course_assignments ' .
256 '(id,sid,mid,cms_id,cms_sub_id,obj_id,usr_id,status) ' .
257 'VALUES( ' .
258 $ilDB->quote($this->getId(), 'integer') . ', ' .
259 $ilDB->quote($this->getServer(), 'integer') . ', ' .
260 $ilDB->quote($this->getMid(), 'integer') . ', ' .
261 $ilDB->quote($this->getCmsId(), 'integer') . ', ' .
262 $ilDB->quote($this->getCmsSubId(), 'integer') . ', ' .
263 $ilDB->quote($this->getObjId(), 'integer') . ', ' .
264 $ilDB->quote($this->getUid(), 'text') . ', ' .
265 $ilDB->quote($this->getStatus(), 'integer') . ' ' .
266 ')';
267 $ilDB->manipulate($query);
268 }
static lookupAssignment($a_cms_id, $a_cms_sub_id, $a_obj_id, $a_usr_id)
Lookup assignment of user @global type $ilDB.

References $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 183 of file class.ilECSCourseMemberAssignment.php.

184 {
185 $this->cms_id = $a_id;
186 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCmsSubId()

ilECSCourseMemberAssignment::setCmsSubId (   $a_id)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setMid()

ilECSCourseMemberAssignment::setMid (   $a_mid)

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

174 {
175 $this->mid = $a_mid;
176 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setObjId()

ilECSCourseMemberAssignment::setObjId (   $a_id)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setServer()

ilECSCourseMemberAssignment::setServer (   $a_server)

Set server.

Parameters
intserver_id

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

160 {
161 $this->server = $a_server;
162 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStatus()

ilECSCourseMemberAssignment::setStatus (   $a_status)

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

224 {
225 $this->status = $a_status;
226 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUid()

ilECSCourseMemberAssignment::setUid (   $a_id)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilECSCourseMemberAssignment::update ( )

Update assignemt @global type $ilDB.

Returns
boolean

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

276 {
277 global $ilDB;
278
279 $query = 'UPDATE ecs_course_assignments ' .
280 'SET ' .
281 'sid = ' . $ilDB->quote($this->getServer(), 'integer') . ', ' .
282 'mid = ' . $ilDB->quote($this->getMid(), 'integer') . ', ' .
283 'cms_id = ' . $ilDB->quote($this->getCmsId(), 'integer') . ', ' .
284 'cms_sub_id = ' . $ilDB->quote($this->getCmsSubId(), 'integer') . ', ' .
285 'obj_id = ' . $ilDB->quote($this->getObjId(), 'integer') . ', ' .
286 'usr_id = ' . $ilDB->quote($this->getUid(), 'text') . ', ' .
287 'status = ' . $ilDB->quote($this->getStatus(), 'integer') . ' ' .
288 'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
289 $ilDB->manipulate($query);
290 return true;
291 }

References $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: