ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 283 of file class.ilECSCourseMemberAssignment.php.

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

284  {
285  global $ilDB;
286 
287  $query = 'DELETE FROM ecs_course_assignments '.
288  'WHERE id = '.$ilDB->quote($this->getId(),'integer');
289  $ilDB->manipulate($query);
290  return true;
291  }
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 59 of file class.ilECSCourseMemberAssignment.php.

References $ilDB, and $query.

60  {
61  global $ilDB;
62 
63  $query = 'DELETE FROM ecs_course_assignments '.
64  'WHERE obj_id = '.$ilDB->quote($a_obj_id, 'integer');
65  $ilDB->manipulate($query);
66  return true;
67  }
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 75 of file class.ilECSCourseMemberAssignment.php.

References $ilDB, and $query.

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

◆ getCmsId()

ilECSCourseMemberAssignment::getCmsId ( )

Definition at line 174 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 184 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 136 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 164 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 194 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 154 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 214 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 204 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 118 of file class.ilECSCourseMemberAssignment.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus().

119  {
120  global $ilDB;
121 
122  $query = 'SELECT id FROM ecs_course_assignments '.
123  'WHERE cms_id = '.$ilDB->quote($a_cms_id,'integer').' '.
124  'AND cms_sub_id = '.$ilDB->quote($a_cms_sub_id,'integer').' '.
125  'AND obj_id = '.$ilDB->quote($a_obj_id,'integer').' '.
126  'AND usr_id = '.$ilDB->quote($a_usr_id,'text');
127  $res = $ilDB->query($query);
128  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
129  {
130  return new ilECSCourseMemberAssignment($row->id);
131  }
132  return null;
133  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
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
type$a_usr_id
Returns
type

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilECSAppEventListener\handleMembership().

41  {
42  global $ilDB;
43 
44  $query = 'SELECT obj_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  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
50  {
51  $obj_ids[] = $row->obj_id;
52  }
53  return $obj_ids;
54  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
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 92 of file class.ilECSCourseMemberAssignment.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus().

93  {
94  global $ilDB;
95 
96  $query = 'SELECT usr_id FROM ecs_course_assignments '.
97  'WHERE cms_id = '.$ilDB->quote($a_cms_id,'integer').' '.
98  'AND cms_sub_id = '.$ilDB->quote($a_cms_sub_id).' '.
99  'AND obj_id = '.$ilDB->quote($a_obj_id,'integer');
100  $res = $ilDB->query($query);
101 
102  $usr_ids = array();
103  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
104  {
105  $usr_ids[] = $row->usr_id;
106  }
107  return $usr_ids;
108  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilECSCourseMemberAssignment::read ( )
protected

Read from db.

Returns
bool

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

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

Referenced by __construct().

300  {
301  global $ilDB;
302 
303  if(!$this->getId())
304  {
305  return false;
306  }
307 
308  $query = 'SELECT * FROM ecs_course_assignments '.
309  'WHERE id = '.$ilDB->quote($this->getId(),'integer');
310  $res = $ilDB->query($query);
311  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
312  {
313  $this->setServer($row->sid);
314  $this->setMid($row->mid);
315  $this->setCmsId($row->cms_id);
316  $this->setCmsSubId($row->cms_sub_id);
317  $this->setObjId($row->obj_id);
318  $this->setUid($row->usr_id);
319  $this->setStatus($row->status);
320  }
321  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
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 223 of file class.ilECSCourseMemberAssignment.php.

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

224  {
225  global $ilDB;
226 
227  $this->id = $ilDB->nextId('ecs_course_assignments');
228 
229 
230  $assignment = self::lookupAssignment(
231  $this->getCmsId(),
232  $this->getCmsSubId(),
233  $this->getObjId(),
234  $this->getUid()
235  );
236  if($assignment instanceof ilECSCourseMemberAssignment)
237  {
238  $assignment->update();
239  return TRUE;
240  }
241 
242  $query = 'INSERT INTO ecs_course_assignments '.
243  '(id,sid,mid,cms_id,cms_sub_id,obj_id,usr_id,status) '.
244  'VALUES( '.
245  $ilDB->quote($this->getId(),'integer').', '.
246  $ilDB->quote($this->getServer(),'integer').', '.
247  $ilDB->quote($this->getMid(),'integer').', '.
248  $ilDB->quote($this->getCmsId(),'integer').', '.
249  $ilDB->quote($this->getCmsSubId(),'integer').', '.
250  $ilDB->quote($this->getObjId(),'integer').', '.
251  $ilDB->quote($this->getUid(),'text').', '.
252  $ilDB->quote($this->getStatus(),'integer').' '.
253  ')';
254  $ilDB->manipulate($query);
255  }
Storage of ecs course assignments.
global $ilDB
+ Here is the call graph for this function:

◆ setCmsId()

ilECSCourseMemberAssignment::setCmsId (   $a_id)

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

Referenced by read().

170  {
171  $this->cms_id = $a_id;
172  }
+ Here is the caller graph for this function:

◆ setCmsSubId()

ilECSCourseMemberAssignment::setCmsSubId (   $a_id)

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

Referenced by read().

180  {
181  $this->cms_sub_id = $a_id;
182  }
+ Here is the caller graph for this function:

◆ setMid()

ilECSCourseMemberAssignment::setMid (   $a_mid)

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

Referenced by read().

160  {
161  $this->mid = $a_mid;
162  }
+ Here is the caller graph for this function:

◆ setObjId()

ilECSCourseMemberAssignment::setObjId (   $a_id)

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

Referenced by read().

190  {
191  $this->obj_id = $a_id;
192  }
+ Here is the caller graph for this function:

◆ setServer()

ilECSCourseMemberAssignment::setServer (   $a_server)

Set server.

Parameters
intserver_id

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

Referenced by read().

146  {
147  $this->server = $a_server;
148  }
+ Here is the caller graph for this function:

◆ setStatus()

ilECSCourseMemberAssignment::setStatus (   $a_status)

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

Referenced by read().

210  {
211  $this->status = $a_status;
212  }
+ Here is the caller graph for this function:

◆ setUid()

ilECSCourseMemberAssignment::setUid (   $a_id)

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

Referenced by read().

200  {
201  $this->uid = $a_id;
202  }
+ Here is the caller graph for this function:

◆ update()

ilECSCourseMemberAssignment::update ( )

Update assignemt type $ilDB.

Returns
boolean

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

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

263  {
264  global $ilDB;
265 
266  $query = 'UPDATE ecs_course_assignments '.
267  'SET '.
268  'sid = '.$ilDB->quote($this->getServer(),'integer').', '.
269  'mid = '.$ilDB->quote($this->getMid(),'integer').', '.
270  'cms_id = '.$ilDB->quote($this->getCmsId(),'integer').', '.
271  'cms_sub_id = '.$ilDB->quote($this->getCmsSubId(),'integer').', '.
272  'obj_id = '.$ilDB->quote($this->getObjId(),'integer').', '.
273  'usr_id = '.$ilDB->quote($this->getUid(),'text').', '.
274  'status = '.$ilDB->quote($this->getStatus(),'integer').' '.
275  'WHERE id = '.$ilDB->quote($this->getId(),'integer');
276  $ilDB->manipulate($query);
277  return true;
278  }
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: