ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 type $ilDB. More...
 
 update ()
 Update assignemt type $ilDB. More...
 
 delete ()
 Delete entry. More...
 

Static Public Member Functions

static lookupMissingAssignmentsOfUser ($a_usr_id)
 Lookup missing assignments; type $ilDB. More...
 
static deleteByObjId ($a_obj_id)
 Delete by obj_id. More...
 
static deleteByServerId ($a_server_id)
 Delete by server id type $ilDB. More...
 
static lookupUserIds ($a_cms_id, $a_cms_sub_id, $a_obj_id)
 Lookup user ids type $ilDB. More...
 
static lookupAssignment ($a_cms_id, $a_cms_sub_id, $a_obj_id, $a_usr_id)
 Lookup assignment of user 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.

References read().

28  {
29  $this->id = $a_id;
30 
31  $this->read();
32  }
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilECSCourseMemberAssignment::delete ( )

Delete entry.

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

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

307  {
308  global $ilDB;
309 
310  $query = 'DELETE FROM ecs_course_assignments '.
311  'WHERE id = '.$ilDB->quote($this->getId(),'integer');
312  $ilDB->manipulate($query);
313  return true;
314  }
global $ilDB
+ Here is the call graph for this function:

◆ deleteByObjId()

static ilECSCourseMemberAssignment::deleteByObjId (   $a_obj_id)
static

Delete by obj_id.

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

References $ilDB, and $query.

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

◆ deleteByServerId()

static ilECSCourseMemberAssignment::deleteByServerId (   $a_server_id)
static

Delete by server id type $ilDB.

Parameters
type$a_server_id
Returns
boolean

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

References $ilDB, and $query.

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

◆ getCmsId()

ilECSCourseMemberAssignment::getCmsId ( )

Definition at line 197 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 207 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 159 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 187 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 217 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 177 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 237 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 227 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 type $ilDB.

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

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

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

Referenced by ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus().

132  {
133  global $ilDB;
134 
135  $cms_sub_id_query = '';
136  if(is_null($a_cms_sub_id))
137  {
138  $cms_sub_id_query = 'AND cms_sub_id IS NULL ';
139  }
140  else
141  {
142  $cms_sub_id_query = 'AND cms_sub_id = '.$ilDB->quote($a_cms_sub_id,'integer').' ';
143  }
144 
145  $query = 'SELECT id FROM ecs_course_assignments '.
146  'WHERE cms_id = '.$ilDB->quote($a_cms_id,'integer').' '.
147  $cms_sub_id_query.
148  'AND obj_id = '.$ilDB->quote($a_obj_id,'integer').' '.
149  'AND usr_id = '.$ilDB->quote($a_usr_id,'text');
150  $res = $ilDB->query($query);
151  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
152  {
153  return new ilECSCourseMemberAssignment($row->id);
154  }
155  return null;
156  }
Storage of ecs course assignments.
global $ilDB
+ Here is the caller graph for this function:

◆ lookupMissingAssignmentsOfUser()

static ilECSCourseMemberAssignment::lookupMissingAssignmentsOfUser (   $a_usr_id)
static

Lookup missing assignments; type $ilDB.

Parameters
stringaccount
Returns
ilECSCourseMemberAssignment[]

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSAppEventListener\handleMembership().

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  {
53  $assignments[] = new self($row->id);
54  }
55  return $assignments;
56  }
Create styles array
The data for the language used.
global $ilDB
+ 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 type $ilDB.

Parameters
type$a_cms_id
type$a_obj_id
Returns
type

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus().

95  {
96  global $ilDB;
97 
98  $cms_sub_id_query = '';
99 
100  if(is_null($a_cms_sub_id))
101  {
102  $cms_sub_id_query = 'AND cms_sub_id IS NULL ';
103  }
104  else
105  {
106  $cms_sub_id_query = 'AND cms_sub_id = '.$ilDB->quote($a_cms_sub_id,'integer').' ';
107  }
108 
109  $query = 'SELECT usr_id FROM ecs_course_assignments '.
110  'WHERE cms_id = '.$ilDB->quote($a_cms_id,'integer').' '.
111  $cms_sub_id_query.
112  'AND obj_id = '.$ilDB->quote($a_obj_id,'integer');
113  $res = $ilDB->query($query);
114 
115  $usr_ids = array();
116  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
117  {
118  $usr_ids[] = $row->usr_id;
119  }
120  return $usr_ids;
121  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilECSCourseMemberAssignment::read ( )
protected

Read from db.

Returns
bool

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

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

Referenced by __construct().

323  {
324  global $ilDB;
325 
326  if(!$this->getId())
327  {
328  return false;
329  }
330 
331  $query = 'SELECT * FROM ecs_course_assignments '.
332  'WHERE id = '.$ilDB->quote($this->getId(),'integer');
333  $res = $ilDB->query($query);
334  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
335  {
336  $this->setServer($row->sid);
337  $this->setMid($row->mid);
338  $this->setCmsId($row->cms_id);
339  $this->setCmsSubId($row->cms_sub_id);
340  $this->setObjId($row->obj_id);
341  $this->setUid($row->usr_id);
342  $this->setStatus($row->status);
343  }
344  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilECSCourseMemberAssignment::save ( )

Save new entry type $ilDB.

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

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

247  {
248  global $ilDB;
249 
250  $this->id = $ilDB->nextId('ecs_course_assignments');
251 
252 
253  $assignment = self::lookupAssignment(
254  $this->getCmsId(),
255  $this->getCmsSubId(),
256  $this->getObjId(),
257  $this->getUid()
258  );
259  if($assignment instanceof ilECSCourseMemberAssignment)
260  {
261  $assignment->update();
262  return TRUE;
263  }
264 
265  $query = 'INSERT INTO ecs_course_assignments '.
266  '(id,sid,mid,cms_id,cms_sub_id,obj_id,usr_id,status) '.
267  'VALUES( '.
268  $ilDB->quote($this->getId(),'integer').', '.
269  $ilDB->quote($this->getServer(),'integer').', '.
270  $ilDB->quote($this->getMid(),'integer').', '.
271  $ilDB->quote($this->getCmsId(),'integer').', '.
272  $ilDB->quote($this->getCmsSubId(),'integer').', '.
273  $ilDB->quote($this->getObjId(),'integer').', '.
274  $ilDB->quote($this->getUid(),'text').', '.
275  $ilDB->quote($this->getStatus(),'integer').' '.
276  ')';
277  $ilDB->manipulate($query);
278  }
Storage of ecs course assignments.
global $ilDB
+ Here is the call graph for this function:

◆ setCmsId()

ilECSCourseMemberAssignment::setCmsId (   $a_id)

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

Referenced by read().

193  {
194  $this->cms_id = $a_id;
195  }
+ Here is the caller graph for this function:

◆ setCmsSubId()

ilECSCourseMemberAssignment::setCmsSubId (   $a_id)

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

Referenced by read().

203  {
204  $this->cms_sub_id = $a_id;
205  }
+ Here is the caller graph for this function:

◆ setMid()

ilECSCourseMemberAssignment::setMid (   $a_mid)

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

Referenced by read().

183  {
184  $this->mid = $a_mid;
185  }
+ Here is the caller graph for this function:

◆ setObjId()

ilECSCourseMemberAssignment::setObjId (   $a_id)

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

Referenced by read().

213  {
214  $this->obj_id = $a_id;
215  }
+ Here is the caller graph for this function:

◆ setServer()

ilECSCourseMemberAssignment::setServer (   $a_server)

Set server.

Parameters
intserver_id

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

Referenced by read().

169  {
170  $this->server = $a_server;
171  }
+ Here is the caller graph for this function:

◆ setStatus()

ilECSCourseMemberAssignment::setStatus (   $a_status)

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

Referenced by read().

233  {
234  $this->status = $a_status;
235  }
+ Here is the caller graph for this function:

◆ setUid()

ilECSCourseMemberAssignment::setUid (   $a_id)

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

Referenced by read().

223  {
224  $this->uid = $a_id;
225  }
+ Here is the caller graph for this function:

◆ update()

ilECSCourseMemberAssignment::update ( )

Update assignemt type $ilDB.

Returns
boolean

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

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

286  {
287  global $ilDB;
288 
289  $query = 'UPDATE ecs_course_assignments '.
290  'SET '.
291  'sid = '.$ilDB->quote($this->getServer(),'integer').', '.
292  'mid = '.$ilDB->quote($this->getMid(),'integer').', '.
293  'cms_id = '.$ilDB->quote($this->getCmsId(),'integer').', '.
294  'cms_sub_id = '.$ilDB->quote($this->getCmsSubId(),'integer').', '.
295  'obj_id = '.$ilDB->quote($this->getObjId(),'integer').', '.
296  'usr_id = '.$ilDB->quote($this->getUid(),'text').', '.
297  'status = '.$ilDB->quote($this->getStatus(),'integer').' '.
298  'WHERE id = '.$ilDB->quote($this->getId(),'integer');
299  $ilDB->manipulate($query);
300  return true;
301  }
global $ilDB
+ 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: