ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLPMarks Class Reference
+ Collaboration diagram for ilLPMarks:

Public Member Functions

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

Static Public Member Functions

static deleteObject ($a_obj_id)
 Delete object. More...
 
static _hasCompleted ($a_usr_id, $a_obj_id)
 
static getCompletionsOfUser ($user_id, $from, $to)
 Get completions of user. More...
 
static _lookupMark ($a_usr_id, $a_obj_id)
 
static _lookupComment ($a_usr_id, $a_obj_id)
 
static _deleteForUsers ($a_obj_id, array $a_user_ids)
 
static _getAllUserIds ($a_obj_id)
 

Data Fields

 $db = null
 
 $obj_id = null
 
 $usr_id = null
 
 $obj_type = null
 
 $completed = false
 
 $comment = ''
 
 $mark = ''
 
 $status_changed = ''
 
 $has_entry = false
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilLPMarks::__construct (   $a_obj_id,
  $a_usr_id 
)

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

References $DIC, $ilDB, and __read().

54  {
55  global $DIC;
56 
57  $ilObjDataCache = $DIC['ilObjDataCache'];
58  $ilDB = $DIC['ilDB'];
59 
60  $this->db = $ilDB;
61 
62  $this->obj_id = $a_obj_id;
63  $this->usr_id = $a_usr_id;
64  $this->obj_type = $ilObjDataCache->lookupType($this->obj_id);
65 
66  $this->__read();
67  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __add()

ilLPMarks::__add ( )

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

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

Referenced by update().

250  {
251  global $DIC;
252 
253  $ilDB = $DIC['ilDB'];
254 
255  $query = "INSERT INTO ut_lp_marks (mark,u_comment, completed,obj_id,usr_id) " .
256  "VALUES( " .
257  $ilDB->quote($this->getMark(), 'text') . ", " .
258  $ilDB->quote($this->getComment(), 'text') . ", " .
259  $ilDB->quote($this->getCompleted(), 'integer') . ", " .
260  $ilDB->quote($this->getObjId(), 'integer') . ", " .
261  $ilDB->quote($this->getUserId(), 'integer') . " " .
262  ")";
263  $res = $ilDB->manipulate($query);
264  $this->has_entry = true;
265 
266  return true;
267  }
global $DIC
Definition: saml.php:7
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:

◆ __read()

ilLPMarks::__read ( )

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

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

Referenced by __construct().

228  {
229  global $DIC;
230 
231  $ilDB = $DIC['ilDB'];
232 
233  $res = $this->db->query("SELECT * FROM ut_lp_marks " .
234  "WHERE obj_id = " . $this->db->quote($this->obj_id, 'integer') . " " .
235  "AND usr_id = " . $ilDB->quote($this->usr_id, 'integer'));
236  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
237  $this->has_entry = true;
238  $this->completed = (int) $row->completed;
239  $this->comment = $row->u_comment;
240  $this->mark = $row->mark;
241  $this->status_changed = $row->status_changed;
242 
243  return true;
244  }
245 
246  return false;
247  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _deleteForUsers()

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

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

References $DIC, and $ilDB.

Referenced by ilObjectLP\resetLPDataForUserIds().

270  {
271  global $DIC;
272 
273  $ilDB = $DIC['ilDB'];
274 
275  $ilDB->manipulate("DELETE FROM ut_lp_marks" .
276  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
277  " AND " . $ilDB->in("usr_id", $a_user_ids, "", "integer"));
278  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _getAllUserIds()

static ilLPMarks::_getAllUserIds (   $a_obj_id)
static

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

References $DIC, $ilDB, $res, and $row.

Referenced by ilObjectLP\gatherLPUsers().

281  {
282  global $DIC;
283 
284  $ilDB = $DIC['ilDB'];
285 
286  $res = array();
287 
288  $set = $ilDB->query("SELECT usr_id FROM ut_lp_marks" .
289  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer"));
290  while ($row = $ilDB->fetchAssoc($set)) {
291  $res[] = $row["usr_id"];
292  }
293 
294  return $res;
295  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _hasCompleted()

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

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

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

Referenced by ilContentPageKioskModeView\builtLearningProgressToggleControl(), and ilInfoScreenGUI\showLearningProgress().

146  {
147  global $DIC;
148 
149  $ilDB = $DIC['ilDB'];
150 
151  $query = "SELECT * FROM ut_lp_marks " .
152  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
153  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
154 
155  $res = $ilDB->query($query);
156  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
157  return (bool) $row->completed;
158  }
159  return false;
160  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupComment()

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

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

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

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

210  {
211  global $DIC;
212 
213  $ilDB = $DIC['ilDB'];
214 
215  $query = "SELECT * FROM ut_lp_marks " .
216  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
217  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
218 
219  $res = $ilDB->query($query);
220  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
221  return $row->u_comment;
222  }
223  return '';
224  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupMark()

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

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

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

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

192  {
193  global $DIC;
194 
195  $ilDB = $DIC['ilDB'];
196 
197  $query = "SELECT * FROM ut_lp_marks " .
198  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
199  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
200 
201  $res = $ilDB->query($query);
202  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
203  return $row->mark;
204  }
205  return '';
206  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ deleteObject()

static ilLPMarks::deleteObject (   $a_obj_id)
static

Delete object.

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

References $DIC, $ilDB, $query, and $res.

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

75  {
76  global $DIC;
77 
78  $ilDB = $DIC['ilDB'];
79 
80  $query = "DELETE FROM ut_lp_marks " .
81  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer');
82  $res = $ilDB->manipulate($query);
83  return true;
84  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getComment()

ilLPMarks::getComment ( )

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

References $comment.

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

104  {
105  return $this->comment;
106  }
+ Here is the caller graph for this function:

◆ getCompleted()

ilLPMarks::getCompleted ( )

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

References $completed.

Referenced by __add(), ilContentPageKioskModeView\toggleLearningProgress(), and update().

112  {
113  return $this->completed;
114  }
+ Here is the caller graph for this function:

◆ getCompletionsOfUser()

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

Get completions of user.

Parameters
$user_id
$from
$to
Returns
array

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

References $DIC, $from, $ilDB, $query, and ilLPStatus\LP_STATUS_COMPLETED_NUM.

Referenced by ilTrackingLearningHistoryProvider\getEntries().

170  {
171  global $DIC;
172 
173  $ilDB = $DIC['ilDB'];
174 
175  $query = "SELECT * FROM ut_lp_marks " .
176  "WHERE usr_id = " . $ilDB->quote($user_id, 'integer') .
177  " AND status = " . $ilDB->quote(ilLPStatus::LP_STATUS_COMPLETED_NUM, 'integer') .
178  " AND status_changed >= " . $ilDB->quote($from, "timestamp") .
179  " AND status_changed <= " . $ilDB->quote($to, "timestamp");
180 
181  $set = $ilDB->query($query);
182  $completions = array();
183  while ($rec = $ilDB->fetchAssoc($set)) {
184  $completions[] = $rec;
185  }
186 
187  return $completions;
188  }
const LP_STATUS_COMPLETED_NUM
global $DIC
Definition: saml.php:7
$from
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getMark()

ilLPMarks::getMark ( )

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

References $mark.

Referenced by __add(), and update().

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

◆ getObjId()

ilLPMarks::getObjId ( )

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

References $obj_id.

Referenced by __add(), and update().

121  {
122  return (int) $this->obj_id;
123  }
+ Here is the caller graph for this function:

◆ getStatusChanged()

ilLPMarks::getStatusChanged ( )

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

References $status_changed.

116  {
117  return $this->status_changed;
118  }

◆ getUserId()

ilLPMarks::getUserId ( )

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

References $usr_id.

Referenced by __add(), and update().

87  {
88  return $this->usr_id;
89  }
+ Here is the caller graph for this function:

◆ setComment()

ilLPMarks::setComment (   $a_comment)

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

References comment().

100  {
101  $this->comment = $a_comment;
102  }
comment()
Definition: comment.php:2
+ Here is the call graph for this function:

◆ setCompleted()

ilLPMarks::setCompleted (   $a_status)

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

Referenced by ilInfoScreenGUI\saveProgress(), and ilObjCourseGUI\updateLPFromStatus().

108  {
109  $this->completed = (bool) $a_status;
110  }
+ Here is the caller graph for this function:

◆ setMark()

ilLPMarks::setMark (   $a_mark)

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

92  {
93  $this->mark = $a_mark;
94  }

◆ update()

ilLPMarks::update ( )

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

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

126  {
127  global $DIC;
128 
129  $ilDB = $DIC['ilDB'];
130 
131  if (!$this->has_entry) {
132  $this->__add();
133  }
134  $query = "UPDATE ut_lp_marks " .
135  "SET mark = " . $ilDB->quote($this->getMark(), 'text') . ", " .
136  "u_comment = " . $ilDB->quote($this->getComment(), 'text') . ", " .
137  "completed = " . $ilDB->quote($this->getCompleted(), 'integer') . " " .
138  "WHERE obj_id = " . $ilDB->quote($this->getObjId(), 'integer') . " " .
139  "AND usr_id = " . $ilDB->quote($this->getUserId(), 'integer');
140  $res = $ilDB->manipulate($query);
141  return true;
142  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $comment

ilLPMarks::$comment = ''

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

Referenced by getComment().

◆ $completed

ilLPMarks::$completed = false

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

Referenced by getCompleted().

◆ $db

ilLPMarks::$db = null

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

◆ $has_entry

ilLPMarks::$has_entry = false

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

◆ $mark

ilLPMarks::$mark = ''

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

Referenced by getMark().

◆ $obj_id

ilLPMarks::$obj_id = null

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

Referenced by getObjId().

◆ $obj_type

ilLPMarks::$obj_type = null

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

◆ $status_changed

ilLPMarks::$status_changed = ''

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

Referenced by getStatusChanged().

◆ $usr_id

ilLPMarks::$usr_id = null

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

Referenced by getUserId().


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