ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilIndividualAssessmentMembersStorageDB Class Reference

Store member infos to DB. More...

+ Inheritance diagram for ilIndividualAssessmentMembersStorageDB:
+ Collaboration diagram for ilIndividualAssessmentMembersStorageDB:

Public Member Functions

 __construct ($ilDB)
 
 loadMembers (ilObjIndividualAssessment $obj)
 Get ilIndividualAssessmentMembers-object containing meberinfo associated with $obj.
Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentMembers
More...
 
 loadMembersAsSingleObjects (ilObjIndividualAssessment $obj, string $filter=null, string $sort=null)
 Get ilIndividualAssessmentMember-object for each obj member associated with $obj.
Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentMember[]
More...
 
 loadMember (ilObjIndividualAssessment $obj, ilObjUser $usr)
 Get ilIndividualAssessmentMember-object containing meberinfo associated with $obj and $usr.
Parameters
ilObjIndividualAssessment$obj
ilObjUser$usr
Returns
ilIndividualAssessmentMember
More...
 
 updateMember (ilIndividualAssessmentMember $member)
 Create a new storage entry for member-object.
Parameters
ilIndividualAssessmentMember$member
More...
 
 deleteMembers (ilObjIndividualAssessment $obj)
 Delete entries associated with members-object.
Parameters
ilObjIndividualAssessment$obj
More...
 
 insertMembersRecord (ilObjIndividualAssessment $iass, array $record)
 Create a membership inside storage.
Parameters
ilObjIndividualAssessment$iass
string|int[]$record
More...
 
 removeMembersRecord (ilObjIndividualAssessment $iass, array $record)
 Remove a membership associated with a IndividualAssessment object inside storage.
Parameters
ilObjIndividualAssessment$iass
string|int[]$record
More...
 

Data Fields

const MEMBERS_TABLE = "iass_members"
 

Protected Member Functions

 loadMemberQuery ()
 
 loadMembersQuery ($obj_id)
 
 getWhereFromFilter ($filter)
 
 getOrderByFromSort (string $sort)
 

Protected Attributes

 $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilIndividualAssessmentMembersStorageDB::__construct (   $ilDB)

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

References $ilDB.

21  {
22  $this->db = $ilDB;
23  }
global $ilDB

Member Function Documentation

◆ deleteMembers()

ilIndividualAssessmentMembersStorageDB::deleteMembers ( ilObjIndividualAssessment  $obj)

Delete entries associated with members-object.

Parameters
ilObjIndividualAssessment$obj

Implements ilIndividualAssessmentMembersStorage.

Definition at line 114 of file class.ilIndividualAssessmentMembersStorageDB.php.

References ilObject\getId().

115  {
116  $sql = "DELETE FROM " . self::MEMBERS_TABLE . " WHERE obj_id = " . $this->db->quote($obj->getId(), 'integer');
117  $this->db->manipulate($sql);
118  }
getId()
get object id public
+ Here is the call graph for this function:

◆ getOrderByFromSort()

ilIndividualAssessmentMembersStorageDB::getOrderByFromSort ( string  $sort)
protected

Definition at line 227 of file class.ilIndividualAssessmentMembersStorageDB.php.

Referenced by loadMembersAsSingleObjects().

227  : string
228  {
229  $vals = explode(":", $sort);
230 
231  return " ORDER BY " . $vals[0] . " " . $vals[1];
232  }
+ Here is the caller graph for this function:

◆ getWhereFromFilter()

ilIndividualAssessmentMembersStorageDB::getWhereFromFilter (   $filter)
protected
Parameters
int|string

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

References ilIndividualAssessmentMembers\LP_ASSESSMENT_NOT_COMPLETED, ilIndividualAssessmentMembers\LP_COMPLETED, ilIndividualAssessmentMembers\LP_FAILED, and ilIndividualAssessmentMembers\LP_IN_PROGRESS.

Referenced by loadMembersAsSingleObjects().

209  : string
210  {
211  switch ($filter) {
213  return " AND finalized = 0 AND examiner_id IS NULL\n";
214  break;
216  return " AND finalized = 0 AND examiner_id IS NOT NULL\n";
217  break;
219  return " AND finalized = 1 AND learning_progress = 2\n";
220  break;
222  return " AND finalized = 1 AND learning_progress = 3\n";
223  break;
224  }
225  }
+ Here is the caller graph for this function:

◆ insertMembersRecord()

ilIndividualAssessmentMembersStorageDB::insertMembersRecord ( ilObjIndividualAssessment  $iass,
array  $record 
)

Create a membership inside storage.

Parameters
ilObjIndividualAssessment$iass
string|int[]$record

Implements ilIndividualAssessmentMembersStorage.

Definition at line 172 of file class.ilIndividualAssessmentMembersStorageDB.php.

References $values, ilIndividualAssessmentMembers\FIELD_CHANGE_TIME, ilIndividualAssessmentMembers\FIELD_CHANGER_ID, ilIndividualAssessmentMembers\FIELD_EVENTTIME, ilIndividualAssessmentMembers\FIELD_EXAMINER_ID, ilIndividualAssessmentMembers\FIELD_FILE_NAME, ilIndividualAssessmentMembers\FIELD_FINALIZED, ilIndividualAssessmentMembers\FIELD_INTERNAL_NOTE, ilIndividualAssessmentMembers\FIELD_LEARNING_PROGRESS, ilIndividualAssessmentMembers\FIELD_NOTIFICATION_TS, ilIndividualAssessmentMembers\FIELD_NOTIFY, ilIndividualAssessmentMembers\FIELD_PLACE, ilIndividualAssessmentMembers\FIELD_RECORD, ilIndividualAssessmentMembers\FIELD_USER_VIEW_FILE, ilIndividualAssessmentMembers\FIELD_USR_ID, and ilObject\getId().

173  {
174  $values = array("obj_id" => array("integer", $iass->getId())
175  , "usr_id" => array("integer", $record[ilIndividualAssessmentMembers::FIELD_USR_ID])
183  , ilIndividualAssessmentMembers::FIELD_FINALIZED => array("integer", 0)
189  );
190 
191  $this->db->insert(self::MEMBERS_TABLE, $values);
192  }
getId()
get object id public
$values
+ Here is the call graph for this function:

◆ loadMember()

ilIndividualAssessmentMembersStorageDB::loadMember ( ilObjIndividualAssessment  $obj,
ilObjUser  $usr 
)

Get ilIndividualAssessmentMember-object containing meberinfo associated with $obj and $usr.

Parameters
ilObjIndividualAssessment$obj
ilObjUser$usr
Returns
ilIndividualAssessmentMember

Implements ilIndividualAssessmentMembersStorage.

Definition at line 67 of file class.ilIndividualAssessmentMembersStorageDB.php.

References ilObject\getId(), and loadMemberQuery().

68  {
69  $obj_id = $obj->getId();
70  $usr_id = $usr->getId();
71  $sql = $this->loadMemberQuery();
72  $sql .= " WHERE obj_id = " . $this->db->quote($obj_id, 'integer') . "\n"
73  . " AND iassme.usr_id = " . $this->db->quote($usr_id, 'integer');
74 
75  $rec = $this->db->fetchAssoc($this->db->query($sql));
76  if ($rec) {
77  $member = new ilIndividualAssessmentMember($obj, $usr, $rec);
78  return $member;
79  } else {
80  throw new ilIndividualAssessmentException("invalid usr-obj combination");
81  }
82  }
getId()
get object id public
Edit the record of a user, set LP.
+ Here is the call graph for this function:

◆ loadMemberQuery()

ilIndividualAssessmentMembersStorageDB::loadMemberQuery ( )
protected

Definition at line 120 of file class.ilIndividualAssessmentMembersStorageDB.php.

Referenced by loadMember(), and loadMembersAsSingleObjects().

121  {
122  return "SELECT "
123  . "iassme.obj_id,"
124  . "iassme.usr_id,"
125  . "iassme.examiner_id,"
126  . "iassme.record,"
127  . "iassme.internal_note,"
128  . "iassme.notify,"
129  . "iassme.notification_ts,"
130  . "iassme.learning_progress,"
131  . "iassme.finalized,"
132  . "iassme.place,"
133  . "iassme.event_time,"
134  . "iassme.user_view_file,"
135  . "iassme.file_name,"
136  . "iassme.changer_id,"
137  . "iassme.change_time,"
138  . "usr.lastname AS user_lastname,"
139  . "ex.login AS examiner_login"
140  . " FROM " . self::MEMBERS_TABLE . " iassme\n"
141  . " JOIN usr_data usr ON iassme.usr_id = usr.usr_id\n"
142  . " LEFT JOIN usr_data ex ON iassme.examiner_id = ex.usr_id\n"
143  ;
144  }
+ Here is the caller graph for this function:

◆ loadMembers()

ilIndividualAssessmentMembersStorageDB::loadMembers ( ilObjIndividualAssessment  $obj)

Get ilIndividualAssessmentMembers-object containing meberinfo associated with $obj.

Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentMembers

Implements ilIndividualAssessmentMembersStorage.

Definition at line 28 of file class.ilIndividualAssessmentMembersStorageDB.php.

References $res, ilObject\getId(), and loadMembersQuery().

29  {
30  $members = new ilIndividualAssessmentMembers($obj);
31  $obj_id = $obj->getId();
32  $sql = $this->loadMembersQuery($obj_id);
33  $res = $this->db->query($sql);
34  while ($rec = $this->db->fetchAssoc($res)) {
35  $members = $members->withAdditionalRecord($rec);
36  }
37  return $members;
38  }
foreach($_POST as $key=> $value) $res
getId()
get object id public
Member administration related logic, add and remove members, get the list of all members, etc.
+ Here is the call graph for this function:

◆ loadMembersAsSingleObjects()

ilIndividualAssessmentMembersStorageDB::loadMembersAsSingleObjects ( ilObjIndividualAssessment  $obj,
string  $filter = null,
string  $sort = null 
)

Get ilIndividualAssessmentMember-object for each obj member associated with $obj.

Parameters
ilObjIndividualAssessment$obj
Returns
ilIndividualAssessmentMember[]

Implements ilIndividualAssessmentMembersStorage.

Definition at line 43 of file class.ilIndividualAssessmentMembersStorageDB.php.

References $res, ilObject\getId(), getOrderByFromSort(), getWhereFromFilter(), and loadMemberQuery().

44  {
45  $members = [];
46  $sql = $this->loadMemberQuery();
47  $sql .= " WHERE obj_id = " . $this->db->quote($obj->getId(), 'integer');
48 
49  if (!is_null($filter)) {
50  $sql .= $this->getWhereFromFilter($filter);
51  }
52 
53  if (!is_null($sort)) {
54  $sql .= $this->getOrderByFromSort($sort);
55  }
56  $res = $this->db->query($sql);
57  while ($rec = $this->db->fetchAssoc($res)) {
58  $usr = new ilObjUser($rec["usr_id"]);
59  $members[] = new ilIndividualAssessmentMember($obj, $usr, $rec);
60  }
61  return $members;
62  }
foreach($_POST as $key=> $value) $res
getId()
get object id public
Edit the record of a user, set LP.
+ Here is the call graph for this function:

◆ loadMembersQuery()

ilIndividualAssessmentMembersStorageDB::loadMembersQuery (   $obj_id)
protected

Definition at line 149 of file class.ilIndividualAssessmentMembersStorageDB.php.

References ilIndividualAssessmentMembers\FIELD_CHANGER_FIRSTNAME, ilIndividualAssessmentMembers\FIELD_CHANGER_LASTNAME, ilIndividualAssessmentMembers\FIELD_EXAMINER_FIRSTNAME, ilIndividualAssessmentMembers\FIELD_EXAMINER_LASTNAME, ilIndividualAssessmentMembers\FIELD_FILE_NAME, ilIndividualAssessmentMembers\FIELD_FIRSTNAME, ilIndividualAssessmentMembers\FIELD_LASTNAME, and ilIndividualAssessmentMembers\FIELD_LOGIN.

Referenced by loadMembers().

150  {
151  return "SELECT ex.firstname as " . ilIndividualAssessmentMembers::FIELD_EXAMINER_FIRSTNAME
155  . " ,usr.firstname as " . ilIndividualAssessmentMembers::FIELD_FIRSTNAME
156  . " ,usr.lastname as " . ilIndividualAssessmentMembers::FIELD_LASTNAME
157  . " ,usr.login as " . ilIndividualAssessmentMembers::FIELD_LOGIN
159  . " ,iassme.obj_id, iassme.usr_id, iassme.examiner_id, iassme.record, iassme.internal_note, iassme.notify"
160  . " ,iassme.notification_ts, iassme.learning_progress, iassme.finalized,iassme.place"
161  . " ,iassme.event_time, iassme.changer_id, iassme.change_time\n"
162  . " FROM iass_members iassme"
163  . " JOIN usr_data usr ON iassme.usr_id = usr.usr_id"
164  . " LEFT JOIN usr_data ex ON iassme.examiner_id = ex.usr_id"
165  . " LEFT JOIN usr_data ud ON iassme.changer_id = ud.usr_id"
166  . " WHERE obj_id = " . $this->db->quote($obj_id, 'integer');
167  }
+ Here is the caller graph for this function:

◆ removeMembersRecord()

ilIndividualAssessmentMembersStorageDB::removeMembersRecord ( ilObjIndividualAssessment  $iass,
array  $record 
)

Remove a membership associated with a IndividualAssessment object inside storage.

Parameters
ilObjIndividualAssessment$iass
string|int[]$record

Implements ilIndividualAssessmentMembersStorage.

Definition at line 197 of file class.ilIndividualAssessmentMembersStorageDB.php.

References ilIndividualAssessmentMembers\FIELD_USR_ID, and ilObject\getId().

198  {
199  $sql = "DELETE FROM " . self::MEMBERS_TABLE . "\n"
200  . " WHERE obj_id = " . $this->db->quote($iass->getId(), 'integer') . "\n"
201  . " AND usr_id = " . $this->db->quote($record[ilIndividualAssessmentMembers::FIELD_USR_ID], 'integer');
202 
203  $this->db->manipulate($sql);
204  }
getId()
get object id public
+ Here is the call graph for this function:

◆ updateMember()

ilIndividualAssessmentMembersStorageDB::updateMember ( ilIndividualAssessmentMember  $member)

Create a new storage entry for member-object.

Parameters
ilIndividualAssessmentMember$member

Implements ilIndividualAssessmentMembersStorage.

Definition at line 87 of file class.ilIndividualAssessmentMembersStorageDB.php.

References $values, ilIndividualAssessmentMember\assessmentId(), ilIndividualAssessmentMember\changerId(), ilIndividualAssessmentMember\eventTime(), ilIndividualAssessmentMember\examinerId(), ilIndividualAssessmentMembers\FIELD_CHANGE_TIME, ilIndividualAssessmentMembers\FIELD_CHANGER_ID, ilIndividualAssessmentMembers\FIELD_EVENTTIME, ilIndividualAssessmentMembers\FIELD_EXAMINER_ID, ilIndividualAssessmentMembers\FIELD_FILE_NAME, ilIndividualAssessmentMembers\FIELD_FINALIZED, ilIndividualAssessmentMembers\FIELD_INTERNAL_NOTE, ilIndividualAssessmentMembers\FIELD_LEARNING_PROGRESS, ilIndividualAssessmentMembers\FIELD_NOTIFICATION_TS, ilIndividualAssessmentMembers\FIELD_NOTIFY, ilIndividualAssessmentMembers\FIELD_PLACE, ilIndividualAssessmentMembers\FIELD_RECORD, ilIndividualAssessmentMembers\FIELD_USER_VIEW_FILE, ilIndividualAssessmentMember\fileName(), ilIndividualAssessmentMember\finalized(), ilIndividualAssessmentMember\id(), IL_CAL_DATETIME, IL_CAL_UNIX, ilIndividualAssessmentMember\internalNote(), ilIndividualAssessmentMember\LPStatus(), ilIndividualAssessmentMember\notificationTS(), ilIndividualAssessmentMember\notify(), ilIndividualAssessmentMember\place(), ilIndividualAssessmentMember\record(), and ilIndividualAssessmentMember\viewFile().

88  {
89  $where = array("obj_id" => array("integer", $member->assessmentId())
90  , "usr_id" => array("integer", $member->id())
91  );
92 
94  , ilIndividualAssessmentMembers::FIELD_EXAMINER_ID => array("integer", $member->examinerId())
95  , ilIndividualAssessmentMembers::FIELD_RECORD => array("text", $member->record())
97  , ilIndividualAssessmentMembers::FIELD_PLACE => array("text", $member->place())
98  , ilIndividualAssessmentMembers::FIELD_EVENTTIME => array("integer", $member->eventTime()->get(IL_CAL_UNIX))
99  , ilIndividualAssessmentMembers::FIELD_NOTIFY => array("integer", $member->notify() ? 1 : 0)
100  , ilIndividualAssessmentMembers::FIELD_FINALIZED => array("integer", $member->finalized() ? 1 : 0)
102  , ilIndividualAssessmentMembers::FIELD_FILE_NAME => array("text", $member->fileName())
103  , ilIndividualAssessmentMembers::FIELD_USER_VIEW_FILE => array("integer", $member->viewFile() ? 1 : 0)
104  , ilIndividualAssessmentMembers::FIELD_CHANGER_ID => array("integer", $member->changerId())
106  );
107 
108  $this->db->update(self::MEMBERS_TABLE, $values, $where);
109  }
const IL_CAL_DATETIME
examinerId()
Get the user id of the examiner.
const IL_CAL_UNIX
notificationTS()
Get the timestamp, at which the notification was sent.
finalized()
Is this membership allready finalized?
changerId()
Get the user id of the changer.
$values
Date and time handling
viewFile()
Can user see the uploaded file.
notify()
Will the user be notified after finalization?
fileName()
Get the name of the uploaded file.
assessmentId()
Get the ilObjIndividualAssessment id corresponding to this membership.
id()
Get the user id corresponding to this membership.
LPStatus()
Get the LP-status corresponding to this membership.
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilIndividualAssessmentMembersStorageDB::$db
protected

◆ MEMBERS_TABLE

const ilIndividualAssessmentMembersStorageDB::MEMBERS_TABLE = "iass_members"

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