ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLPMarks Class Reference
+ Collaboration diagram for ilLPMarks:

Public Member Functions

 __construct (int $a_obj_id, int $a_usr_id)
 
 getUserId ()
 
 setMark (string $a_mark)
 
 getMark ()
 
 setComment (string $a_comment)
 
 getComment ()
 
 setCompleted (bool $a_status)
 
 getCompleted ()
 
 getStatusChanged ()
 
 getObjId ()
 
 update ()
 
 __read ()
 
 __add ()
 

Static Public Member Functions

static deleteObject (int $a_obj_id)
 
static _hasCompleted (int $a_usr_id, int $a_obj_id)
 
static getCompletionsOfUser (int $user_id, string $from, string $to)
 
static _lookupMark (int $a_usr_id, int $a_obj_id)
 
static _lookupComment (int $a_usr_id, int $a_obj_id)
 
static _deleteForUsers (int $a_obj_id, array $a_user_ids)
 
static _getAllUserIds (int $a_obj_id)
 

Protected Attributes

ilDBInterface $db
 
ilObjectDataCache $ilObjectDataCache
 
int $obj_id
 
int $usr_id
 
string $obj_type
 
bool $completed = false
 
string $comment = ''
 
string $mark = ''
 
string $status_changed = ''
 
 $has_entry = false
 

Detailed Description

Definition at line 24 of file class.ilLPMarks.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPMarks::__construct ( int  $a_obj_id,
int  $a_usr_id 
)

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

References $DIC, and __read().

41  {
42  global $DIC;
43 
44  $this->ilObjectDataCache = $DIC['ilObjDataCache'];
45  $this->db = $DIC->database();
46 
47  $this->obj_id = $a_obj_id;
48  $this->usr_id = $a_usr_id;
49  $this->obj_type = $this->ilObjectDataCache->lookupType($this->obj_id);
50 
51  $this->__read();
52  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ __add()

ilLPMarks::__add ( )

Definition at line 244 of file class.ilLPMarks.php.

References $res, getComment(), getCompleted(), getMark(), getObjId(), and getUserId().

Referenced by update().

244  : void
245  {
246  $query = "INSERT INTO ut_lp_marks (mark,u_comment, completed,obj_id,usr_id) " .
247  "VALUES( " .
248  $this->db->quote($this->getMark(), 'text') . ", " .
249  $this->db->quote($this->getComment(), 'text') . ", " .
250  $this->db->quote($this->getCompleted(), 'integer') . ", " .
251  $this->db->quote($this->getObjId(), 'integer') . ", " .
252  $this->db->quote($this->getUserId(), 'integer') . " " .
253  ")";
254  $res = $this->db->manipulate($query);
255  $this->has_entry = true;
256  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __read()

ilLPMarks::__read ( )

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

References $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by __construct().

223  : bool
224  {
225  $res = $this->db->query(
226  "SELECT * FROM ut_lp_marks " .
227  "WHERE obj_id = " . $this->db->quote(
228  $this->obj_id,
229  'integer'
230  ) . " " .
231  "AND usr_id = " . $this->db->quote($this->usr_id, 'integer')
232  );
233  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
234  $this->has_entry = true;
235  $this->completed = (int) $row->completed;
236  $this->comment = (string) $row->u_comment;
237  $this->mark = (string) $row->mark;
238  $this->status_changed = (string) $row->status_changed;
239  return true;
240  }
241  return false;
242  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteForUsers()

static ilLPMarks::_deleteForUsers ( int  $a_obj_id,
array  $a_user_ids 
)
static

Definition at line 258 of file class.ilLPMarks.php.

References $DIC, and $ilDB.

Referenced by ilObjectLP\resetLPDataForUserIds().

261  : void {
262  global $DIC;
263 
264  $ilDB = $DIC['ilDB'];
265  $ilDB->manipulate(
266  "DELETE FROM ut_lp_marks" .
267  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
268  " AND " . $ilDB->in("usr_id", $a_user_ids, "", "integer")
269  );
270  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getAllUserIds()

static ilLPMarks::_getAllUserIds ( int  $a_obj_id)
static

Definition at line 272 of file class.ilLPMarks.php.

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ilObjectLP\gatherLPUsers().

272  : array
273  {
274  global $DIC;
275 
276  $ilDB = $DIC['ilDB'];
277 
278  $res = array();
279  $set = $ilDB->query(
280  "SELECT usr_id FROM ut_lp_marks" .
281  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
282  );
283  while ($row = $ilDB->fetchAssoc($set)) {
284  $res[] = (int) $row["usr_id"];
285  }
286  return $res;
287  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _hasCompleted()

static ilLPMarks::_hasCompleted ( int  $a_usr_id,
int  $a_obj_id 
)
static

Definition at line 134 of file class.ilLPMarks.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilContentPageKioskModeView\buildLearningProgressToggleControl(), and ilLearningModuleKioskModeView\maybeBuildLearningProgressToggleControl().

134  : bool
135  {
136  global $DIC;
137 
138  $ilDB = $DIC['ilDB'];
139 
140  $query = "SELECT * FROM ut_lp_marks " .
141  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
142  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
143 
144  $res = $ilDB->query($query);
145  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
146  return (bool) $row->completed;
147  }
148  return false;
149  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _lookupComment()

static ilLPMarks::_lookupComment ( int  $a_usr_id,
int  $a_obj_id 
)
static

Definition at line 205 of file class.ilLPMarks.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilWikiContributorsTableGUI\fillRow(), ilExGradesTableGUI\fillRow(), ilObjExerciseGUI\getService(), and ilObjWikiGUI\infoScreen().

205  : string
206  {
207  global $DIC;
208 
209  $ilDB = $DIC['ilDB'];
210 
211  $query = "SELECT * FROM ut_lp_marks " .
212  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
213  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
214 
215  $res = $ilDB->query($query);
216  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
217  return (string) $row->u_comment;
218  }
219  return '';
220  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _lookupMark()

static ilLPMarks::_lookupMark ( int  $a_usr_id,
int  $a_obj_id 
)
static

Definition at line 188 of file class.ilLPMarks.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilObjExercise\exportGradesExcel(), ilWikiContributorsTableGUI\fillRow(), ilExGradesTableGUI\fillRow(), ilCourseMailTemplateTutorContext\getCachedPeriodByObjId(), ilScormMailTemplateLPContext\getDescription(), ilObjExerciseGUI\getService(), ilObjWikiGUI\infoScreen(), and ilCertificateLPMarksHelper\lookUpMark().

188  : string
189  {
190  global $DIC;
191 
192  $ilDB = $DIC['ilDB'];
193 
194  $query = "SELECT * FROM ut_lp_marks " .
195  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
196  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
197 
198  $res = $ilDB->query($query);
199  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
200  return (string) $row->mark;
201  }
202  return '';
203  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ deleteObject()

static ilLPMarks::deleteObject ( int  $a_obj_id)
static

Definition at line 54 of file class.ilLPMarks.php.

References $DIC, $ilDB, and $res.

Referenced by ilEventParticipants\_deleteByEvent(), and ilObjectLP\handleDelete().

54  : void
55  {
56  global $DIC;
57 
58  $ilDB = $DIC['ilDB'];
59 
60  $query = "DELETE FROM ut_lp_marks " .
61  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer');
62  $res = $ilDB->manipulate($query);
63  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getComment()

ilLPMarks::getComment ( )

Definition at line 85 of file class.ilLPMarks.php.

References $comment.

Referenced by __add(), ilObjWikiGUI\saveGradingObject(), and update().

85  : string
86  {
87  return $this->comment;
88  }
string $comment
+ Here is the caller graph for this function:

◆ getCompleted()

ilLPMarks::getCompleted ( )

Definition at line 95 of file class.ilLPMarks.php.

References $completed.

Referenced by __add(), and update().

95  : bool
96  {
97  return $this->completed;
98  }
+ Here is the caller graph for this function:

◆ getCompletionsOfUser()

static ilLPMarks::getCompletionsOfUser ( int  $user_id,
string  $from,
string  $to 
)
static

Definition at line 151 of file class.ilLPMarks.php.

References $DIC, $ilDB, ILIAS\Repository\int(), and ilLPStatus\LP_STATUS_COMPLETED_NUM.

Referenced by ilTrackingLearningHistoryProvider\getEntries().

155  : array {
156  global $DIC;
157 
158  $ilDB = $DIC['ilDB'];
159 
160  $query = "SELECT * FROM ut_lp_marks " .
161  "WHERE usr_id = " . $ilDB->quote($user_id, 'integer') .
162  " AND status = " . $ilDB->quote(
164  'integer'
165  ) .
166  " AND status_changed >= " . $ilDB->quote($from, "timestamp") .
167  " AND status_changed <= " . $ilDB->quote($to, "timestamp");
168 
169  $set = $ilDB->query($query);
170  $completions = array();
171  while ($rec = $ilDB->fetchAssoc($set)) {
172  $completion = [
173  'obj_id' => (int) $rec['obj_id'],
174  'usr_id' => (int) $rec['usr_id'],
175  'completed' => (bool) $rec['completed'],
176  'mark' => (string) $rec['mark'],
177  'comment' => (string) $rec['u_comment'],
178  'status' => (int) $rec['status'],
179  'status_changed' => (string) $rec['status_changed'],
180  'status_dirty' => (int) $rec['status_changed'],
181  'percentage' => (int) $rec['percentage']
182  ];
183  $completions[] = $completion;
184  }
185  return $completions;
186  }
const LP_STATUS_COMPLETED_NUM
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMark()

ilLPMarks::getMark ( )

Definition at line 75 of file class.ilLPMarks.php.

References $mark.

Referenced by __add(), and update().

75  : string
76  {
77  return $this->mark;
78  }
+ Here is the caller graph for this function:

◆ getObjId()

ilLPMarks::getObjId ( )

Definition at line 105 of file class.ilLPMarks.php.

References $obj_id.

Referenced by __add(), and update().

105  : int
106  {
107  return $this->obj_id;
108  }
+ Here is the caller graph for this function:

◆ getStatusChanged()

ilLPMarks::getStatusChanged ( )

Definition at line 100 of file class.ilLPMarks.php.

References $status_changed.

100  : string
101  {
102  return $this->status_changed;
103  }
string $status_changed

◆ getUserId()

ilLPMarks::getUserId ( )

Definition at line 65 of file class.ilLPMarks.php.

References $usr_id.

Referenced by __add(), and update().

65  : int
66  {
67  return $this->usr_id;
68  }
+ Here is the caller graph for this function:

◆ setComment()

ilLPMarks::setComment ( string  $a_comment)

Definition at line 80 of file class.ilLPMarks.php.

References ILIAS\UI\examples\Symbol\Glyph\Comment\comment().

80  : void
81  {
82  $this->comment = $a_comment;
83  }
comment()
description: > Example for rendring a comment glyph.
Definition: comment.php:41
+ Here is the call graph for this function:

◆ setCompleted()

ilLPMarks::setCompleted ( bool  $a_status)

Definition at line 90 of file class.ilLPMarks.php.

90  : void
91  {
92  $this->completed = $a_status;
93  }

◆ setMark()

ilLPMarks::setMark ( string  $a_mark)

Definition at line 70 of file class.ilLPMarks.php.

70  : void
71  {
72  $this->mark = $a_mark;
73  }

◆ update()

ilLPMarks::update ( )

Definition at line 110 of file class.ilLPMarks.php.

References $res, __add(), getComment(), getCompleted(), getMark(), getObjId(), and getUserId().

110  : void
111  {
112  if (!$this->has_entry) {
113  $this->__add();
114  }
115  $query = "UPDATE ut_lp_marks " .
116  "SET mark = " . $this->db->quote($this->getMark(), 'text') . ", " .
117  "u_comment = " . $this->db->quote(
118  $this->getComment(),
119  'text'
120  ) . ", " .
121  "completed = " . $this->db->quote(
122  $this->getCompleted(),
123  'integer'
124  ) . " " .
125  "WHERE obj_id = " . $this->db->quote(
126  $this->getObjId(),
127  'integer'
128  ) . " " .
129  "AND usr_id = " . $this->db->quote($this->getUserId(), 'integer');
130  $res = $this->db->manipulate($query);
131  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

Field Documentation

◆ $comment

string ilLPMarks::$comment = ''
protected

Definition at line 34 of file class.ilLPMarks.php.

Referenced by getComment().

◆ $completed

bool ilLPMarks::$completed = false
protected

Definition at line 33 of file class.ilLPMarks.php.

Referenced by getCompleted().

◆ $db

ilDBInterface ilLPMarks::$db
protected

Definition at line 26 of file class.ilLPMarks.php.

◆ $has_entry

ilLPMarks::$has_entry = false
protected

Definition at line 38 of file class.ilLPMarks.php.

◆ $ilObjectDataCache

ilObjectDataCache ilLPMarks::$ilObjectDataCache
protected

Definition at line 27 of file class.ilLPMarks.php.

◆ $mark

string ilLPMarks::$mark = ''
protected

Definition at line 35 of file class.ilLPMarks.php.

Referenced by getMark().

◆ $obj_id

int ilLPMarks::$obj_id
protected

Definition at line 29 of file class.ilLPMarks.php.

Referenced by getObjId().

◆ $obj_type

string ilLPMarks::$obj_type
protected

Definition at line 31 of file class.ilLPMarks.php.

◆ $status_changed

string ilLPMarks::$status_changed = ''
protected

Definition at line 36 of file class.ilLPMarks.php.

Referenced by getStatusChanged().

◆ $usr_id

int ilLPMarks::$usr_id
protected

Definition at line 30 of file class.ilLPMarks.php.

Referenced by getUserId().


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