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 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 296 of file class.ilECSCourseMemberAssignment.php.

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

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
+ 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.

References $ilDB, and $query.

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

References $ilDB, and $query.

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  }
$query
global $ilDB

◆ 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 type $ilDB.

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

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

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

Referenced by ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus().

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  }
foreach($_POST as $key=> $value) $res
$query
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  $assignments[] = new self($row->id);
53  }
54  return $assignments;
55  }
foreach($_POST as $key=> $value) $res
$query
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 93 of file class.ilECSCourseMemberAssignment.php.

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

Referenced by ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus().

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  }
foreach($_POST as $key=> $value) $res
$query
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 312 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().

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  }
foreach($_POST as $key=> $value) $res
$query
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 237 of file class.ilECSCourseMemberAssignment.php.

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

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  }
$query
Storage of ecs course assignments.
global $ilDB
+ Here is the call graph for this function:

◆ setCmsId()

ilECSCourseMemberAssignment::setCmsId (   $a_id)

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

Referenced by read().

184  {
185  $this->cms_id = $a_id;
186  }
+ Here is the caller graph for this function:

◆ setCmsSubId()

ilECSCourseMemberAssignment::setCmsSubId (   $a_id)

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

Referenced by read().

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

◆ setMid()

ilECSCourseMemberAssignment::setMid (   $a_mid)

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

Referenced by read().

174  {
175  $this->mid = $a_mid;
176  }
+ Here is the caller graph for this function:

◆ setObjId()

ilECSCourseMemberAssignment::setObjId (   $a_id)

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

Referenced by read().

204  {
205  $this->obj_id = $a_id;
206  }
+ 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.

Referenced by read().

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

◆ setStatus()

ilECSCourseMemberAssignment::setStatus (   $a_status)

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

Referenced by read().

224  {
225  $this->status = $a_status;
226  }
+ Here is the caller graph for this function:

◆ setUid()

ilECSCourseMemberAssignment::setUid (   $a_id)

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

Referenced by read().

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

◆ update()

ilECSCourseMemberAssignment::update ( )

Update assignemt type $ilDB.

Returns
boolean

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

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

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  }
$query
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: