ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilLOUserResults Class Reference
+ Collaboration diagram for ilLOUserResults:

Public Member Functions

 __construct (int $a_course_obj_id, int $a_user_id)
 
 delete ()
 
 saveObjectiveResult (int $a_objective_id, int $a_type, int $a_status, int $a_result_percentage, int $a_limit_percentage, int $a_tries, bool $a_is_final)
 
 getCompletedObjectiveIdsByType (int $a_type)
 
 getSuggestedObjectiveIds ()
 Get all objectives where the user failed the initial test. More...
 
 getCompletedObjectiveIds ()
 Get all objectives where the user completed the qualified test. More...
 
 getFailedObjectiveIds (bool $a_is_final=true)
 
 getCourseResultsForUserPresentation ()
 

Static Public Member Functions

static updateResultLimit (int $a_objective_id, int $a_test_type, int $a_limit)
 
static lookupResult (int $a_course_obj_id, int $a_user_id, int $a_objective_id, int $a_tst_type)
 
static resetFinalByObjective (int $a_objective_id)
 
static deleteResultsForUser (int $a_user_id)
 
static deleteResultsForCourse (int $a_course_id)
 
static deleteResultsFromLP (int $a_course_id, array $a_user_ids, bool $a_remove_initial, bool $a_remove_qualified, array $a_objective_ids)
 
static getObjectiveStatusForLP (int $a_user_id, int $a_obj_id, array $a_objective_ids)
 
static getSummarizedObjectiveStatusForLP (int $a_obj_id, array $a_objective_ids, int $a_user_id=0)
 
static hasResults (int $a_container_id, int $a_user_id)
 
static getCompletionsOfUser (int $a_user_id, int $a_from_ts, int $a_to_ts)
 Get completed learning objectives for user and time frame. More...
 

Data Fields

const TYPE_UNDEFINED = 0
 
const TYPE_INITIAL = 1
 
const TYPE_QUALIFIED = 2
 
const STATUS_COMPLETED = 1
 
const STATUS_FAILED = 2
 

Protected Member Functions

 findObjectiveIds (int $a_type=0, int $a_status=0, ?bool $a_is_final=null)
 

Static Protected Member Functions

static isValidType (int $a_type)
 
static isValidStatus (int $a_status)
 

Protected Attributes

int $course_obj_id
 
int $user_id
 
ilDBInterface $db
 

Detailed Description

Definition at line 25 of file class.ilLOUserResults.php.

Constructor & Destructor Documentation

◆ __construct()

ilLOUserResults::__construct ( int  $a_course_obj_id,
int  $a_user_id 
)

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

References $DIC.

41  {
42  global $DIC;
43 
44  $this->course_obj_id = $a_course_obj_id;
45  $this->user_id = $a_user_id;
46 
47  $this->db = $DIC->database();
48  }
global $DIC
Definition: shib_login.php:26

Member Function Documentation

◆ delete()

ilLOUserResults::delete ( )

Definition at line 144 of file class.ilLOUserResults.php.

References ilDBConstants\T_INTEGER.

Referenced by ilObjCourseGUI\resetObject().

144  : void
145  {
146  $query = 'DELETE FROM loc_user_results ' .
147  'WHERE course_id = ' . $this->db->quote($this->course_obj_id, ilDBConstants::T_INTEGER) . ' ' .
148  'AND user_id = ' . $this->db->quote($this->user_id, ilDBConstants::T_INTEGER);
149  $this->db->manipulate($query);
150  }
+ Here is the caller graph for this function:

◆ deleteResultsForCourse()

static ilLOUserResults::deleteResultsForCourse ( int  $a_course_id)
static

Definition at line 131 of file class.ilLOUserResults.php.

References $DIC, and $ilDB.

131  : bool
132  {
133  global $DIC;
134 
135  $ilDB = $DIC->database();
136  if (!$a_course_id) {
137  return false;
138  }
139  $ilDB->manipulate("DELETE FROM loc_user_results" .
140  " WHERE course_id = " . $ilDB->quote($a_course_id, "integer"));
141  return true;
142  }
global $DIC
Definition: shib_login.php:26

◆ deleteResultsForUser()

static ilLOUserResults::deleteResultsForUser ( int  $a_user_id)
static

Definition at line 117 of file class.ilLOUserResults.php.

References $DIC, and $ilDB.

Referenced by ilObjCourse\_deleteUser().

117  : bool
118  {
119  global $DIC;
120 
121  $ilDB = $DIC->database();
122  if (!$a_user_id) {
123  return false;
124  }
125 
126  $ilDB->manipulate("DELETE FROM loc_user_results" .
127  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer"));
128  return true;
129  }
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ deleteResultsFromLP()

static ilLOUserResults::deleteResultsFromLP ( int  $a_course_id,
array  $a_user_ids,
bool  $a_remove_initial,
bool  $a_remove_qualified,
array  $a_objective_ids 
)
static

Definition at line 152 of file class.ilLOUserResults.php.

References $DIC, and $ilDB.

Referenced by ilTestLP\resetCustomLPDataForUserIds().

158  : bool {
159  global $DIC;
160 
161  $ilDB = $DIC->database();
162  if (!$a_course_id ||
163  $a_user_ids === []) {
164  return false;
165  }
166 
167  $base_sql = "DELETE FROM loc_user_results" .
168  " WHERE course_id = " . $ilDB->quote($a_course_id, "integer") .
169  " AND " . $ilDB->in("user_id", $a_user_ids, false, "integer");
170 
171  if ($a_objective_ids !== []) {
172  $base_sql .= ' AND ' . $ilDB->in('objective_id', $a_objective_ids, false, "integer");
173  }
174 
175  $sql = '';
176  if ($a_remove_initial) {
177  $sql = $base_sql .
178  " AND type = " . $ilDB->quote(self::TYPE_INITIAL, "integer");
179  $ilDB->manipulate($sql);
180  }
181 
182  if ($a_remove_qualified) {
183  $sql = $base_sql .
184  " AND type = " . $ilDB->quote(self::TYPE_QUALIFIED, "integer");
185  $ilDB->manipulate($sql);
186  }
187 
188  if ($a_objective_ids === []) {
189  $ilDB->manipulate($base_sql);
190  }
191  $ilDB->manipulate($sql);
192  return true;
193  }
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ findObjectiveIds()

ilLOUserResults::findObjectiveIds ( int  $a_type = 0,
int  $a_status = 0,
?bool  $a_is_final = null 
)
protected

Definition at line 228 of file class.ilLOUserResults.php.

References $res, isValidStatus(), isValidType(), and null.

Referenced by getCompletedObjectiveIds(), getCompletedObjectiveIdsByType(), getFailedObjectiveIds(), and getSuggestedObjectiveIds().

228  : array
229  {
230  $res = array();
231  $sql = "SELECT objective_id" .
232  " FROM loc_user_results" .
233  " WHERE course_id = " . $this->db->quote($this->course_obj_id, "integer") .
234  " AND user_id = " . $this->db->quote($this->user_id, "integer");
235 
236  if ($this->isValidType($a_type)) {
237  $sql .= " AND type = " . $this->db->quote($a_type, "integer");
238  }
239  if ($this->isValidStatus($a_status)) {
240  $sql .= " AND status = " . $this->db->quote($a_status, "integer");
241  }
242  if ($a_is_final !== null) {
243  $sql .= " AND is_final = " . $this->db->quote($a_is_final, "integer");
244  }
245 
246  $set = $this->db->query($sql);
247  while ($row = $this->db->fetchAssoc($set)) {
248  $res[] = $row["objective_id"];
249  }
250 
251  return $res;
252  }
$res
Definition: ltiservices.php:66
static isValidStatus(int $a_status)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static isValidType(int $a_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCompletedObjectiveIds()

ilLOUserResults::getCompletedObjectiveIds ( )

Get all objectives where the user completed the qualified test.

Definition at line 270 of file class.ilLOUserResults.php.

References findObjectiveIds(), and ilLOSettings\getInstanceByObjId().

270  : array
271  {
272  $settings = ilLOSettings::getInstanceByObjId($this->course_obj_id);
273 
274  if (!$settings->isInitialTestQualifying() || !$settings->worksWithInitialTest()) {
275  return $this->findObjectiveIds(self::TYPE_QUALIFIED, self::STATUS_COMPLETED);
276  }
277 
278  // status of final final test overwrites initial qualified.
279  $completed = [];
280  if (
281  $settings->isInitialTestQualifying() &&
282  $settings->worksWithInitialTest()
283  ) {
284  $completed_candidates = array_unique(
285  array_merge(
286  $this->findObjectiveIds(self::TYPE_INITIAL, self::STATUS_COMPLETED),
287  $this->findObjectiveIds(self::TYPE_QUALIFIED, self::STATUS_COMPLETED)
288  )
289  );
290  $failed_final = $this->findObjectiveIds(self::TYPE_QUALIFIED, self::STATUS_FAILED);
291 
292  foreach ($completed_candidates as $objective_completed) {
293  if (!in_array($objective_completed, $failed_final)) {
294  $completed[] = $objective_completed;
295  }
296  }
297  return $completed;
298  }
299  return [];
300  }
static getInstanceByObjId(int $a_obj_id)
findObjectiveIds(int $a_type=0, int $a_status=0, ?bool $a_is_final=null)
+ Here is the call graph for this function:

◆ getCompletedObjectiveIdsByType()

ilLOUserResults::getCompletedObjectiveIdsByType ( int  $a_type)

Definition at line 254 of file class.ilLOUserResults.php.

References findObjectiveIds().

254  : array
255  {
256  return $this->findObjectiveIds($a_type, self::STATUS_COMPLETED);
257  }
findObjectiveIds(int $a_type=0, int $a_status=0, ?bool $a_is_final=null)
+ Here is the call graph for this function:

◆ getCompletionsOfUser()

static ilLOUserResults::getCompletionsOfUser ( int  $a_user_id,
int  $a_from_ts,
int  $a_to_ts 
)
static

Get completed learning objectives for user and time frame.

Definition at line 489 of file class.ilLOUserResults.php.

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

Referenced by ilCourseLearningHistoryProvider\getEntries().

489  : array
490  {
491  global $DIC;
492 
493  $ilDB = $DIC->database();
494  $res = [];
495  $sql = "SELECT lor.objective_id, lor.user_id, lor.status, lor.is_final, lor.tstamp, lor.course_id, cobj.title" .
496  " FROM loc_user_results lor" .
497  " JOIN crs_objectives cobj ON (cobj.objective_id = lor.objective_id)" .
498  " WHERE lor.user_id = " . $ilDB->quote($a_user_id, "integer") .
499  " AND lor.type = " . $ilDB->quote(self::TYPE_QUALIFIED, "integer") .
500  " AND lor.tstamp >= " . $ilDB->quote($a_from_ts, "integer") .
501  " AND lor.tstamp <= " . $ilDB->quote($a_to_ts, "integer") .
502  " AND lor.status = " . $ilDB->quote(self::STATUS_COMPLETED, "integer");
503 
504  $set = $ilDB->query($sql);
505  while ($row = $ilDB->fetchAssoc($set)) {
506  $res[(int) $row["objective_id"]] = $row;
507  }
508  return $res;
509  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCourseResultsForUserPresentation()

ilLOUserResults::getCourseResultsForUserPresentation ( )

Definition at line 307 of file class.ilLOUserResults.php.

References $res, ilLOSettings\getInstanceByObjId(), and ILIAS\Repository\int().

307  : array
308  {
309  $res = [];
310  $settings = ilLOSettings::getInstanceByObjId($this->course_obj_id);
311 
312  $set = $this->db->query("SELECT *" .
313  " FROM loc_user_results" .
314  " WHERE course_id = " . $this->db->quote($this->course_obj_id, "integer") .
315  " AND user_id = " . $this->db->quote($this->user_id, "integer"));
316  while ($row = $this->db->fetchAssoc($set)) {
317  // do not read initial test results, if disabled.
318  if (
319  $row['type'] == self::TYPE_INITIAL &&
320  !$settings->worksWithInitialTest()
321  ) {
322  continue;
323  }
324 
325  $objective_id = (int) $row["objective_id"];
326  $type = (int) $row["type"];
327  unset($row["objective_id"]);
328  unset($row["type"]);
329  $res[$objective_id][$type] = $row;
330  }
331  return $res;
332  }
$res
Definition: ltiservices.php:66
static getInstanceByObjId(int $a_obj_id)
+ Here is the call graph for this function:

◆ getFailedObjectiveIds()

ilLOUserResults::getFailedObjectiveIds ( bool  $a_is_final = true)

Definition at line 302 of file class.ilLOUserResults.php.

References findObjectiveIds().

302  : array
303  {
304  return $this->findObjectiveIds(self::TYPE_QUALIFIED, self::STATUS_FAILED, $a_is_final);
305  }
findObjectiveIds(int $a_type=0, int $a_status=0, ?bool $a_is_final=null)
+ Here is the call graph for this function:

◆ getObjectiveStatusForLP()

static ilLOUserResults::getObjectiveStatusForLP ( int  $a_user_id,
int  $a_obj_id,
array  $a_objective_ids 
)
static
Returns
int[]

Definition at line 337 of file class.ilLOUserResults.php.

References $DIC, $ilDB, $res, ilLOSettings\getInstanceByObjId(), ILIAS\Repository\int(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, and ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

Referenced by ilTrQuery\getObjectivesStatusForUser().

337  : array
338  {
339  global $DIC;
340 
341  $ilDB = $DIC->database();
342 
343  // are initital test(s) qualifying?
344  $lo_set = ilLOSettings::getInstanceByObjId($a_obj_id);
345  $initial_qualifying = $lo_set->isInitialTestQualifying();
346 
347  // this method returns LP status codes!
348 
349  $res = array();
350 
351  $sql = "SELECT lor.objective_id, lor.user_id, lor.status, lor.is_final" .
352  " FROM loc_user_results lor" .
353  " JOIN crs_objectives cobj ON (cobj.objective_id = lor.objective_id)" .
354  " WHERE " . $ilDB->in("lor.objective_id", $a_objective_ids, false, "integer");
355  if (!$initial_qualifying) {
356  $sql .= " AND lor.type = " . $ilDB->quote(self::TYPE_QUALIFIED, "integer");
357  }
358  $sql .= " AND lor.user_id = " . $ilDB->quote($a_user_id, "integer") .
359  " AND cobj.active = " . $ilDB->quote(1, "integer") .
360  " ORDER BY lor.type"; // qualified must come last!
361  $set = $ilDB->query($sql);
362  while ($row = $ilDB->fetchAssoc($set)) {
363  switch ($row["status"]) {
364  case self::STATUS_FAILED:
365  if ($row["is_final"]) {
367  } else {
368  // #15379
370  }
371  break;
372 
373  case self::STATUS_COMPLETED:
375  break;
376 
377  default:
378  continue 2;
379  }
380 
381  // if both initial and qualified, qualified will overwrite initial
382  $res[(int) $row["objective_id"]] = $status;
383  }
384  return $res;
385  }
const LP_STATUS_COMPLETED_NUM
$res
Definition: ltiservices.php:66
const LP_STATUS_IN_PROGRESS_NUM
global $DIC
Definition: shib_login.php:26
static getInstanceByObjId(int $a_obj_id)
const LP_STATUS_FAILED_NUM
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuggestedObjectiveIds()

ilLOUserResults::getSuggestedObjectiveIds ( )

Get all objectives where the user failed the initial test.

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

References findObjectiveIds().

262  : array
263  {
264  return $this->findObjectiveIds(self::TYPE_INITIAL, self::STATUS_FAILED);
265  }
findObjectiveIds(int $a_type=0, int $a_status=0, ?bool $a_is_final=null)
+ Here is the call graph for this function:

◆ getSummarizedObjectiveStatusForLP()

static ilLOUserResults::getSummarizedObjectiveStatusForLP ( int  $a_obj_id,
array  $a_objective_ids,
int  $a_user_id = 0 
)
static
Returns
?int | int[]

Definition at line 390 of file class.ilLOUserResults.php.

References $DIC, $ilDB, $res, $user_id, ilLOSettings\getInstanceByObjId(), ILIAS\Repository\int(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and null.

Referenced by ilLPStatusObjectives\_getStatusInfo(), and ilLPStatusObjectives\determineStatus().

394  {
395  global $DIC;
396 
397  $ilDB = $DIC->database();
398  // change event is NOT parsed here!
399  // are initital test(s) qualifying?
400  $lo_set = ilLOSettings::getInstanceByObjId($a_obj_id);
401  $initial_qualifying = $lo_set->isInitialTestQualifying();
402 
403  // this method returns LP status codes!
404 
405  $res = $tmp_completed = array();
406 
407  $sql = "SELECT lor.objective_id, lor.user_id, lor.status, lor.type, lor.is_final" .
408  " FROM loc_user_results lor" .
409  " JOIN crs_objectives cobj ON (cobj.objective_id = lor.objective_id)" .
410  " WHERE " . $ilDB->in("lor.objective_id", $a_objective_ids, false, "integer") .
411  " AND cobj.active = " . $ilDB->quote(1, "integer");
412  if (!$initial_qualifying) {
413  $sql .= " AND lor.type = " . $ilDB->quote(self::TYPE_QUALIFIED, "integer");
414  }
415  if ($a_user_id) {
416  $sql .= " AND lor.user_id = " . $ilDB->quote($a_user_id, "integer");
417  }
418  $sql .= " ORDER BY lor.type DESC"; // qualified must come first!
419  $set = $ilDB->query($sql);
420 
421  $has_final_result = array();
422  while ($row = $ilDB->fetchAssoc($set)) {
423  if ($row['type'] == self::TYPE_QUALIFIED) {
424  $has_final_result[$row['objective_id']] = $row['user_id'];
425  }
426 
427  $user_id = (int) $row["user_id"];
428  $status = (int) $row["status"];
429 
430  // initial tests only count if no qualified test
431  if (
432  $row["type"] == self::TYPE_INITIAL &&
433  in_array($row['user_id'], (array) ($has_final_result[(int) $row['objective_id']] ?? []))
434  ) {
435  continue;
436  }
437 
438  // user did do something
440 
441  switch ($status) {
442  case self::STATUS_COMPLETED:
443  $tmp_completed[$user_id] = ($tmp_completed[$user_id] ?? 0) + 1;
444  break;
445 
446  case self::STATUS_FAILED:
447  if ($row["is_final"]) {
448  // object is failed when at least 1 objective is failed without any tries left
450  }
451  break;
452  }
453  }
454 
455  $all_nr = count($a_objective_ids);
456  foreach ($tmp_completed as $user_id => $counter) {
457  // if used as precondition object should be completed ASAP, status can be lost on subsequent tries
458  if ($counter == $all_nr) {
460  }
461  }
462 
463  if ($a_user_id) {
464  return isset($res[$a_user_id]) ? (int) $res[$a_user_id] : null;
465  } else {
466  return $res;
467  }
468  }
const LP_STATUS_COMPLETED_NUM
$res
Definition: ltiservices.php:66
const LP_STATUS_IN_PROGRESS_NUM
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
static getInstanceByObjId(int $a_obj_id)
const LP_STATUS_FAILED_NUM
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasResults()

static ilLOUserResults::hasResults ( int  $a_container_id,
int  $a_user_id 
)
static

Definition at line 470 of file class.ilLOUserResults.php.

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

Referenced by ILIAS\Containter\Content\ObjectiveRenderer\renderObjectives().

470  : bool
471  {
472  global $DIC;
473 
474  $ilDB = $DIC->database();
475  $query = 'SELECT objective_id FROM loc_user_results ' .
476  'WHERE course_id = ' . $ilDB->quote($a_container_id, 'integer') . ' ' .
477  'AND user_id = ' . $ilDB->quote($a_user_id, 'integer');
478 
479  $res = $ilDB->query($query);
480  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
481  return true;
482  }
483  return false;
484  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ isValidStatus()

static ilLOUserResults::isValidStatus ( int  $a_status)
staticprotected

Definition at line 112 of file class.ilLOUserResults.php.

Referenced by findObjectiveIds().

112  : bool
113  {
114  return in_array($a_status, array(self::STATUS_COMPLETED, self::STATUS_FAILED));
115  }
+ Here is the caller graph for this function:

◆ isValidType()

static ilLOUserResults::isValidType ( int  $a_type)
staticprotected

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

Referenced by findObjectiveIds().

107  : bool
108  {
109  return in_array($a_type, array(self::TYPE_INITIAL, self::TYPE_QUALIFIED));
110  }
+ Here is the caller graph for this function:

◆ lookupResult()

static ilLOUserResults::lookupResult ( int  $a_course_obj_id,
int  $a_user_id,
int  $a_objective_id,
int  $a_tst_type 
)
static

Definition at line 62 of file class.ilLOUserResults.php.

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

Referenced by ilLOTestQuestionAdapter\initUserResult(), ilObjCourseAccess\isObjectiveResultRangeAchieved(), ilLOMemberTestResultTableGUI\parse(), and ilLOTestQuestionAdapter\updateQuestionResult().

67  : array {
68  global $DIC;
69 
70  $ilDB = $DIC->database();
71  $query = 'SELECT * FROM loc_user_results ' .
72  'WHERE user_id = ' . $ilDB->quote($a_user_id, 'integer') . ' ' .
73  'AND course_id = ' . $ilDB->quote($a_course_obj_id, 'integer') . ' ' .
74  'AND objective_id = ' . $ilDB->quote($a_objective_id, 'integer') . ' ' .
75  'AND type = ' . $ilDB->quote($a_tst_type, 'integer');
76  $res = $ilDB->query($query);
77  $ur = array(
78  'status' => self::STATUS_FAILED,
79  'result_perc' => 0,
80  'limit_perc' => 0,
81  'tries' => 0,
82  'is_final' => 0,
83  'has_result' => false
84  );
85  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
86  $ur['status'] = $row->status;
87  $ur['result_perc'] = $row->result_perc;
88  $ur['limit_perc'] = $row->limit_perc;
89  $ur['tries'] = $row->tries;
90  $ur['is_final'] = $row->is_final;
91  $ur['has_result'] = true;
92  }
93  return $ur;
94  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ resetFinalByObjective()

static ilLOUserResults::resetFinalByObjective ( int  $a_objective_id)
static

Definition at line 96 of file class.ilLOUserResults.php.

References $DIC, ilDBInterface\manipulate(), and ilDBInterface\quote().

96  : void
97  {
98  global $DIC;
99 
100  $db = $DIC->database();
101  $query = 'UPDATE loc_user_results ' .
102  'SET is_final = ' . $db->quote(0, 'integer') . ' ' .
103  'WHERE objective_id = ' . $db->quote($a_objective_id, 'integer');
104  $db->manipulate($query);
105  }
quote($value, string $type)
global $DIC
Definition: shib_login.php:26
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:

◆ saveObjectiveResult()

ilLOUserResults::saveObjectiveResult ( int  $a_objective_id,
int  $a_type,
int  $a_status,
int  $a_result_percentage,
int  $a_limit_percentage,
int  $a_tries,
bool  $a_is_final 
)

Definition at line 195 of file class.ilLOUserResults.php.

203  : bool {
204  if (!self::isValidType($a_type) ||
205  !self::isValidStatus($a_status)) {
206  return false;
207  }
208  $this->db->replace(
209  "loc_user_results",
210  array(
211  "course_id" => array("integer", $this->course_obj_id),
212  "user_id" => array("integer", $this->user_id),
213  "objective_id" => array("integer", $a_objective_id),
214  "type" => array("integer", $a_type)
215  ),
216  array(
217  "status" => array("integer", $a_status),
218  "result_perc" => array("integer", $a_result_percentage),
219  "limit_perc" => array("integer", $a_limit_percentage),
220  "tries" => array("integer", $a_tries),
221  "is_final" => array("integer", $a_is_final),
222  "tstamp" => array("integer", time()),
223  )
224  );
225  return true;
226  }

◆ updateResultLimit()

static ilLOUserResults::updateResultLimit ( int  $a_objective_id,
int  $a_test_type,
int  $a_limit 
)
static

Definition at line 50 of file class.ilLOUserResults.php.

References $DIC, ilDBInterface\manipulate(), ilDBInterface\quote(), and ilDBConstants\T_INTEGER.

Referenced by ilCourseObjectivesGUI\updateFinalTestLimits(), and ilCourseObjectivesGUI\updateSelfAssessmentLimits().

50  : void
51  {
52  global $DIC;
53 
54  $db = $DIC->database();
55  $query = 'UPDATE loc_user_results ' .
56  'SET limit_perc = ' . $db->quote($a_limit, ilDBConstants::T_INTEGER) . ' ' .
57  'WHERE objective_id = ' . $db->quote($a_objective_id, ilDBConstants::T_INTEGER) . ' ' .
58  'AND type = ' . $db->quote($a_test_type, ilDBConstants::T_INTEGER);
59  $db->manipulate($query);
60  }
quote($value, string $type)
global $DIC
Definition: shib_login.php:26
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $course_obj_id

int ilLOUserResults::$course_obj_id
protected

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

◆ $db

ilDBInterface ilLOUserResults::$db
protected

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

◆ $user_id

int ilLOUserResults::$user_id
protected

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

Referenced by getSummarizedObjectiveStatusForLP().

◆ STATUS_COMPLETED

◆ STATUS_FAILED

const ilLOUserResults::STATUS_FAILED = 2

◆ TYPE_INITIAL

◆ TYPE_QUALIFIED

◆ TYPE_UNDEFINED

const ilLOUserResults::TYPE_UNDEFINED = 0

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