ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLPStatus.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
16{
17 public $obj_id = null;
18
19 public $db = null;
20
21 public static $list_gui_cache;
22
23 const LP_STATUS_NOT_ATTEMPTED = 'trac_no_attempted';
24 const LP_STATUS_IN_PROGRESS = 'trac_in_progress';
25 const LP_STATUS_COMPLETED = 'trac_completed';
26 const LP_STATUS_FAILED = 'trac_failed';
27
32
33 const LP_STATUS_REGISTERED = 'trac_registered';
34 const LP_STATUS_NOT_REGISTERED = 'trac_not_registered';
35 const LP_STATUS_PARTICIPATED = 'trac_participated';
36 const LP_STATUS_NOT_PARTICIPATED = 'trac_not_participated';
37
38 public function __construct($a_obj_id)
39 {
40 global $DIC;
41
42 $ilDB = $DIC['ilDB'];
43
44 $this->obj_id = $a_obj_id;
45 $this->db = $ilDB;
46 }
47
48 public static function _getCountNotAttempted($a_obj_id)
49 {
50 return 0;
51 }
52
53 public static function _getNotAttempted($a_obj_id)
54 {
55 return array();
56 }
57
58 public static function _getCountInProgress($a_obj_id)
59 {
60 return 0;
61 }
62
63 public static function _getInProgress($a_obj_id)
64 {
65 return array();
66 }
67
68 public static function _getCountCompleted($a_obj_id)
69 {
70 return 0;
71 }
72
73 public static function _getCompleted($a_obj_id)
74 {
75 return array();
76 }
77
78 public static function _getFailed($a_obj_id)
79 {
80 return array();
81 }
82
83 public static function _getCountFailed()
84 {
85 return 0;
86 }
87
88 public static function _getStatusInfo($a_obj_id)
89 {
90 return array();
91 }
92
93 public static function _getTypicalLearningTime($a_obj_id)
94 {
95 include_once 'Services/MetaData/classes/class.ilMDEducational.php';
97 }
98
99
203 public function _updateStatus($a_obj_id, $a_usr_id, $a_obj = null, $a_percentage = false, $a_force_raise = false)
204 {
206 $log->debug(sprintf(
207 "obj_id: %s, user id: %s, object: %s",
208 $a_obj_id,
209 $a_usr_id,
210 (is_object($a_obj) ? get_class($a_obj) : 'null')
211 ));
212
213 $status = $this->determineStatus($a_obj_id, $a_usr_id, $a_obj);
214 $percentage = $this->determinePercentage($a_obj_id, $a_usr_id, $a_obj);
215 $changed = self::writeStatus($a_obj_id, $a_usr_id, $status, $percentage);
216
217 // ak: I don't think that this is a good way to fix 15529, we should not
218 // raise the event, if the status does not change imo.
219 // for now the changes in the next line just prevent the event being raised twice
220 if (!$changed && (bool) $a_force_raise) { // #15529
221 self::raiseEvent($a_obj_id, $a_usr_id, $status, $percentage);
222 }
223 }
224
231 public function determinePercentage($a_obj_id, $a_usr_id, $a_obj = null)
232 {
233 return false;
234 }
235
242 public function determineStatus($a_obj_id, $a_usr_id, $a_obj = null)
243 {
244 return false;
245 }
246
247
255 public static function checkStatusForObject($a_obj_id, $a_users = false)
256 {
257 global $DIC;
258
259 $ilDB = $DIC['ilDB'];
260
261 //@todo: there maybe the need to add extra handling for sessions here, since the
262 // "in progress" status is time dependent here. On the other hand, if they registered
263 // to the session, they already accessed the course and should have a "in progress"
264 // anyway. But the status on the session itself may not be correct.
265
266 $sql = "SELECT usr_id FROM ut_lp_marks WHERE " .
267 " obj_id = " . $ilDB->quote($a_obj_id, "integer") . " AND " .
268 " status_dirty = " . $ilDB->quote(1, "integer");
269 if (is_array($a_users) && count($a_users) > 0) {
270 $sql .= " AND " . $ilDB->in("usr_id", $a_users, false, "integer");
271 }
272 $set = $ilDB->query($sql);
273 $dirty = false;
274 if ($rec = $ilDB->fetchAssoc($set)) {
275 $dirty = true;
276 }
277
278 // check if any records are missing
279 $missing = false;
280 if (!$dirty && is_array($a_users) && count($a_users) > 0) {
281 $set = $ilDB->query("SELECT count(usr_id) cnt FROM ut_lp_marks WHERE " .
282 " obj_id = " . $ilDB->quote($a_obj_id, "integer") . " AND " .
283 $ilDB->in("usr_id", $a_users, false, "integer"));
284 $r = $ilDB->fetchAssoc($set);
285 if ($r["cnt"] < count($a_users)) {
286 $missing = true;
287 }
288 }
289
290 // refresh status, if records are dirty or missing
291 if ($dirty || $missing) {
292 require_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; // #13330
293 $trac_obj = ilLPStatusFactory::_getInstance($a_obj_id);
294 $trac_obj->refreshStatus($a_obj_id, $a_users);
295 }
296 }
297
298 protected static function raiseEvent($a_obj_id, $a_usr_id, $a_status, $a_percentage)
299 {
300 global $DIC;
301
302 $ilAppEventHandler = $DIC['ilAppEventHandler'];
303
305 $log->debug("obj_id: " . $a_obj_id . ", user id: " . $a_usr_id . ", status: " .
306 $a_status . ", percentage: " . $a_percentage);
307
308 $ilAppEventHandler->raise("Services/Tracking", "updateStatus", array(
309 "obj_id" => $a_obj_id,
310 "usr_id" => $a_usr_id,
311 "status" => $a_status,
312 "percentage" => $a_percentage
313 ));
314 }
315
322 public function refreshStatus($a_obj_id, $a_users = null)
323 {
324 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
325 $not_attempted = ilLPStatusWrapper::_getNotAttempted($a_obj_id);
326 foreach ($not_attempted as $user_id) {
327 $percentage = $this->determinePercentage($a_obj_id, $user_id);
328 if (self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, $percentage, true)) {
329 //self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, $percentage);
330 }
331 }
332 $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
333 foreach ($in_progress as $user_id) {
334 $percentage = $this->determinePercentage($a_obj_id, $user_id);
335 if (self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_IN_PROGRESS_NUM, $percentage, true)) {
336 //self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_IN_PROGRESS_NUM, $percentage);
337 }
338 }
339 $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
340 foreach ($completed as $user_id) {
341 $percentage = $this->determinePercentage($a_obj_id, $user_id);
342 if (self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_COMPLETED_NUM, $percentage, true)) {
343 //self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_COMPLETED_NUM, $percentage);
344 }
345 }
347 foreach ($failed as $user_id) {
348 $percentage = $this->determinePercentage($a_obj_id, $user_id);
349 if (self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_FAILED_NUM, $percentage, true)) {
350 //self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_FAILED_NUM, $percentage);
351 }
352 }
353 if ($a_users) {
354 $missing_users = array_diff($a_users, $not_attempted + $in_progress + $completed + $failed);
355 if ($missing_users) {
356 foreach ($missing_users as $user_id) {
357 ilLPStatusWrapper::_updateStatus($a_obj_id, $user_id);
358 }
359 }
360 }
361 }
362
369 public static function writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage = false, $a_force_per = false)
370 {
371 global $DIC;
372
373 $ilDB = $DIC['ilDB'];
374
376 $log->debug("obj_id: " . $a_obj_id . ", user id: " . $a_user_id . ", status: " .
377 $a_status . ", percentage: " . $a_percentage . ", force: " . $a_force_per);
378
379 $update_collections = false;
380
381 // get status in DB
382 $set = $ilDB->query(
383 "SELECT usr_id,status,status_dirty FROM ut_lp_marks WHERE " .
384 " obj_id = " . $ilDB->quote($a_obj_id, "integer") . " AND " .
385 " usr_id = " . $ilDB->quote($a_user_id, "integer")
386 );
387 $rec = $ilDB->fetchAssoc($set);
388
389 // update
390 if ($rec) {
391 // status has changed: update
392 if ($rec["status"] != $a_status) {
393 $ret = $ilDB->manipulate(
394 "UPDATE ut_lp_marks SET " .
395 " status = " . $ilDB->quote($a_status, "integer") . "," .
396 " status_changed = " . $ilDB->now() . "," .
397 " status_dirty = " . $ilDB->quote(0, "integer") .
398 " WHERE usr_id = " . $ilDB->quote($a_user_id, "integer") .
399 " AND obj_id = " . $ilDB->quote($a_obj_id, "integer")
400 );
401 if ($ret != 0) {
402 $update_collections = true;
403 }
404 }
405 // status has not changed: reset dirty flag
406 elseif ($rec["status_dirty"]) {
407 $ilDB->manipulate(
408 "UPDATE ut_lp_marks SET " .
409 " status_dirty = " . $ilDB->quote(0, "integer") .
410 " WHERE usr_id = " . $ilDB->quote($a_user_id, "integer") .
411 " AND obj_id = " . $ilDB->quote($a_obj_id, "integer")
412 );
413 }
414 }
415 // insert
416 else {
417 /*
418 $ilDB->manipulate("INSERT INTO ut_lp_marks ".
419 "(status, status_changed, usr_id, obj_id, status_dirty) VALUES (".
420 $ilDB->quote($a_status, "integer").",".
421 $ilDB->now().",".
422 $ilDB->quote($a_user_id, "integer").",".
423 $ilDB->quote($a_obj_id, "integer").",".
424 $ilDB->quote(0, "integer").
425 ")");
426 */
427
428 // #13783
429 $ilDB->replace(
430 "ut_lp_marks",
431 array(
432 "obj_id" => array("integer", $a_obj_id),
433 "usr_id" => array("integer", $a_user_id)
434 ),
435 array(
436 "status" => array("integer", $a_status),
437 "status_changed" => array("timestamp", date("Y-m-d H:i:s")), // was $ilDB->now()
438 "status_dirty" => array("integer", 0)
439 )
440 );
441
442 $update_collections = true;
443 }
444
445 // update percentage
446 if ($a_percentage !== false || $a_force_per) {
447 $a_percentage = max(0, (int) $a_percentage);
448 $a_percentage = min(100, $a_percentage);
449 $ret = $ilDB->manipulate(
450 "UPDATE ut_lp_marks SET " .
451 " percentage = " . $ilDB->quote($a_percentage, "integer") .
452 " WHERE usr_id = " . $ilDB->quote($a_user_id, "integer") .
453 " AND obj_id = " . $ilDB->quote($a_obj_id, "integer")
454 );
455 }
456
457 // update collections
458 if ($update_collections) {
459 // a change occured - remove existing cache entry
460 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
461 ilLPStatusWrapper::_removeStatusCache($a_obj_id, $a_user_id);
462
463 $set = $ilDB->query("SELECT ut_lp_collections.obj_id obj_id FROM " .
464 "object_reference JOIN ut_lp_collections ON " .
465 "(object_reference.obj_id = " . $ilDB->quote($a_obj_id, "integer") .
466 " AND object_reference.ref_id = ut_lp_collections.item_id)");
467 while ($rec = $ilDB->fetchAssoc($set)) {
468 if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold"))) {
469 // just to make sure - remove existing cache entry
470 ilLPStatusWrapper::_removeStatusCache($rec["obj_id"], $a_user_id);
471
472 ilLPStatusWrapper::_updateStatus($rec["obj_id"], $a_user_id);
473 }
474 }
475
476 self::raiseEvent($a_obj_id, $a_user_id, $a_status, $a_percentage);
477 }
478
479 return $update_collections;
480 }
481
487 public static function setInProgressIfNotAttempted($a_obj_id, $a_user_id)
488 {
489 global $DIC;
490
491 $ilDB = $DIC['ilDB'];
492
493 // #11513
494
495 $needs_update = false;
496
497 $set = $ilDB->query(
498 "SELECT usr_id, status FROM ut_lp_marks WHERE " .
499 " obj_id = " . $ilDB->quote($a_obj_id, "integer") . " AND " .
500 " usr_id = " . $ilDB->quote($a_user_id, "integer")
501 );
502 if ($rec = $ilDB->fetchAssoc($set)) {
503 // current status is not attempted, so we need to update
504 if ($rec["status"] == self::LP_STATUS_NOT_ATTEMPTED_NUM) {
505 $needs_update = true;
506 }
507 } else {
508 // no ut_lp_marks yet, we should update
509 $needs_update = true;
510 }
511
512 if ($needs_update) {
513 require_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
514 ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
515 }
516 }
517
524 public static function setAllDirty()
525 {
526 global $DIC;
527
528 $ilDB = $DIC['ilDB'];
529
530 $ilDB->manipulate(
531 "UPDATE ut_lp_marks SET " .
532 " status_dirty = " . $ilDB->quote(1, "integer")
533 );
534 }
535
542 public static function setDirty($a_obj_id)
543 {
544 global $DIC;
545
546 $ilDB = $DIC['ilDB'];
547
548 $ilDB->manipulate(
549 "UPDATE ut_lp_marks SET " .
550 " status_dirty = " . $ilDB->quote(1, "integer") .
551 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
552 );
553 }
554
562 public static function _lookupStatus($a_obj_id, $a_user_id, $a_create = true)
563 {
564 global $DIC;
565
566 $ilDB = $DIC['ilDB'];
567
568 $set = $ilDB->query(
569 "SELECT status FROM ut_lp_marks WHERE " .
570 " status_dirty = " . $ilDB->quote(0, "integer") .
571 " AND usr_id = " . $ilDB->quote($a_user_id, "integer") .
572 " AND obj_id = " . $ilDB->quote($a_obj_id, "integer")
573 );
574 if ($rec = $ilDB->fetchAssoc($set)) {
575 return $rec["status"];
576 } elseif ((bool) $a_create) {
577 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
578 ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
579 $set = $ilDB->query(
580 "SELECT status FROM ut_lp_marks WHERE " .
581 " status_dirty = " . $ilDB->quote(0, "integer") .
582 " AND usr_id = " . $ilDB->quote($a_user_id, "integer") .
583 " AND obj_id = " . $ilDB->quote($a_obj_id, "integer")
584 );
585 if ($rec = $ilDB->fetchAssoc($set)) {
586 return $rec["status"];
587 }
588 }
589 }
590
597 public static function _lookupPercentage($a_obj_id, $a_user_id)
598 {
599 global $DIC;
600
601 $ilDB = $DIC['ilDB'];
602
603 $set = $ilDB->query(
604 "SELECT percentage FROM ut_lp_marks WHERE " .
605 " status_dirty = " . $ilDB->quote(0, "integer") .
606 " AND usr_id = " . $ilDB->quote($a_user_id, "integer") .
607 " AND obj_id = " . $ilDB->quote($a_obj_id, "integer")
608 );
609 if ($rec = $ilDB->fetchAssoc($set)) {
610 return $rec["percentage"];
611 }
612 }
613
621 public static function _hasUserCompleted($a_obj_id, $a_user_id)
622 {
623 return (self::_lookupStatus($a_obj_id, $a_user_id) == self::LP_STATUS_COMPLETED_NUM);
624 }
625
632 public static function _lookupStatusChanged($a_obj_id, $a_user_id)
633 {
634 global $DIC;
635
636 $ilDB = $DIC['ilDB'];
637
638 $set = $ilDB->query(
639 "SELECT status_changed FROM ut_lp_marks WHERE " .
640 " status_dirty = " . $ilDB->quote(0, "integer") .
641 " AND usr_id = " . $ilDB->quote($a_user_id, "integer") .
642 " AND obj_id = " . $ilDB->quote($a_obj_id, "integer")
643 );
644 if ($rec = $ilDB->fetchAssoc($set)) {
645 return $rec["status_changed"];
646 } else {
647 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
648 ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
649 $set = $ilDB->query(
650 "SELECT status_changed FROM ut_lp_marks WHERE " .
651 " status_dirty = " . $ilDB->quote(0, "integer") .
652 " AND usr_id = " . $ilDB->quote($a_user_id, "integer") .
653 " AND obj_id = " . $ilDB->quote($a_obj_id, "integer")
654 );
655 if ($rec = $ilDB->fetchAssoc($set)) {
656 return $rec["status_changed"];
657 }
658 }
659 }
660
669 protected static function _lookupStatusForObject($a_obj_id, $a_status, $a_user_ids = null)
670 {
671 global $DIC;
672
673 $ilDB = $DIC['ilDB'];
674
675 $sql = "SELECT usr_id, status, status_dirty FROM ut_lp_marks" .
676 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
677 " AND status = " . $ilDB->quote($a_status, "integer");
678 if ($a_user_ids) {
679 $sql .= " AND " . $ilDB->in("usr_id", $a_user_ids, "", "integer");
680 }
681
682 $set = $ilDB->query($sql);
683 $res = array();
684 while ($rec = $ilDB->fetchAssoc($set)) {
685 if ($res["status_dirty"]) {
686 // update status and check again
687 if (self::_lookupStatus($a_obj_id, $rec["usr_id"]) != $a_status) {
688 continue;
689 }
690 }
691 $res[] = $rec["usr_id"];
692 }
693
694 return $res;
695 }
696
704 public static function _lookupCompletedForObject($a_obj_id, $a_user_ids = null)
705 {
706 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
707 }
708
716 public static function _lookupFailedForObject($a_obj_id, $a_user_ids = null)
717 {
718 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_FAILED_NUM, $a_user_ids);
719 }
720
728 public static function _lookupInProgressForObject($a_obj_id, $a_user_ids = null)
729 {
730 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
731 }
732
733
734 //
735 // LIST GUI
736 //
737
746 protected static function validateLPForObjects($a_user_id, $a_obj_ids, $a_parent_ref_id)
747 {
748 $lp_invalid = array();
749
750 include_once "Services/Object/classes/class.ilObjectLP.php";
751 $memberships = ilObjectLP::getLPMemberships($a_user_id, $a_obj_ids, $a_parent_ref_id);
752 foreach ($memberships as $obj_id => $status) {
753 if (!$status) {
754 $lp_invalid[] = $obj_id;
755 }
756 }
757
758 return array_diff($a_obj_ids, $lp_invalid);
759 }
760
767 protected static function checkLPModesForObjects($a_obj_ids, array &$a_coll_obj_ids)
768 {
769 $valid = array();
770
771 // all lp modes with collections (gathered separately)
772 include_once "Services/Tracking/classes/collection/class.ilLPCollection.php";
774
775 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
776
777 // check if objects have LP activated at all (DB entries)
778 $existing = ilLPObjSettings::_lookupDBModeForObjects($a_obj_ids);
779 foreach ($existing as $obj_id => $obj_mode) {
780 if ($obj_mode != ilLPObjSettings::LP_MODE_DEACTIVATED) {
782
783 if (in_array($obj_mode, $coll_modes)) {
784 $a_coll_obj_ids[] = $obj_id;
785 }
786 }
787 }
788
789 // missing objects in DB (default mode)
790 include_once "Services/Object/classes/class.ilObjectLP.php";
791 if (sizeof($existing) != sizeof($a_obj_ids)) {
792 foreach (array_diff($a_obj_ids, $existing) as $obj_id) {
794 $mode = $olp->getCurrentMode();
796 // #11141
797 unset($valid[$obj_id]);
798 } elseif ($mode != ilLPObjSettings::LP_MODE_UNDEFINED) {
800
801 if (in_array($mode, $coll_modes)) {
802 $a_coll_obj_ids[] = $obj_id;
803 }
804 }
805 }
806 unset($existing);
807 }
808
809 return array_values($valid);
810 }
811
819 protected static function getLPStatusForObjects($a_user_id, $a_obj_ids)
820 {
821 global $DIC;
822
823 $ilDB = $DIC['ilDB'];
824
825 $res = array();
826
827 // get user lp data
828 $sql = "SELECT status, status_dirty, obj_id FROM ut_lp_marks" .
829 " WHERE " . $ilDB->in("obj_id", $a_obj_ids, "", "integer") .
830 " AND usr_id = " . $ilDB->quote($a_user_id, "integer");
831 $set = $ilDB->query($sql);
832 while ($row = $ilDB->fetchAssoc($set)) {
833 if (!$row["status_dirty"]) {
834 $res[$row["obj_id"]] = $row["status"];
835 } else {
836 $res[$row["obj_id"]] = self::_lookupStatus($row["obj_id"], $a_user_id);
837 }
838 }
839
840 // process missing user entries (same as dirty entries, see above)
841 foreach ($a_obj_ids as $obj_id) {
842 if (!isset($res[$obj_id])) {
843 $res[$obj_id] = self::_lookupStatus($obj_id, $a_user_id);
844 if ($res[$obj_id] === null) {
846 }
847 }
848 }
849
850 return $res;
851 }
852
853 public static function preloadListGUIData($a_obj_ids)
854 {
855 global $DIC;
856
857 $ilUser = $DIC['ilUser'];
858 $lng = $DIC['lng'];
859
860 $user_id = $ilUser->getId();
861
862 $res = array();
863
864 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
865 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
869 // -- validate
870
871 // :TODO: we need the parent ref id, but this is awful
872 $a_obj_ids = self::validateLPForObjects($user_id, $a_obj_ids, (int) $_GET["ref_id"]);
873
874 // we are not handling the collections differently yet
875 $coll_obj_ids = array();
876 $a_obj_ids = self::checkLPModesForObjects($a_obj_ids, $coll_obj_ids);
877
878
879 // -- gather
880
881 $res = self::getLPStatusForObjects($user_id, $a_obj_ids);
882
883
884 // -- render
885
886 // value to icon
887 $lng->loadLanguageModule("trac");
888 include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
889 foreach ($res as $obj_id => $status) {
892 $res[$obj_id] = [
893 "image" => ilUtil::img($path, $text),
894 "status" => $status
895 ];
896 }
897 }
898
899 self::$list_gui_cache = $res;
900 }
901
902 public static function getListGUIStatus($a_obj_id, $a_image_only = true)
903 {
904 if ($a_image_only) {
905 $image = '';
906 if (isset(self::$list_gui_cache[$a_obj_id]["image"])) {
907 $image = self::$list_gui_cache[$a_obj_id]["image"];
908 }
909
910 return $image;
911 }
912 return self::$list_gui_cache[$a_obj_id];
913 }
914}
$failed
Definition: Utf8Test.php:85
$path
Definition: aliased.php:25
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static _lookupDBModeForObjects(array $a_obj_ids)
static _getInstance($a_obj_id, $a_mode=null)
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _getNotAttempted($a_obj_id)
Static function to read the number of user who have the status 'not_attempted'.
static _removeStatusCache($a_obj_id, $a_usr_id)
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
const LP_STATUS_COMPLETED_NUM
_updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark)
static _lookupStatusForObject($a_obj_id, $a_status, $a_user_ids=null)
Get users with given status for object.
const LP_STATUS_NOT_PARTICIPATED
static _getStatusInfo($a_obj_id)
static preloadListGUIData($a_obj_ids)
determineStatus($a_obj_id, $a_usr_id, $a_obj=null)
Determine status.
static _getInProgress($a_obj_id)
static _getCountInProgress($a_obj_id)
static _getTypicalLearningTime($a_obj_id)
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
determinePercentage($a_obj_id, $a_usr_id, $a_obj=null)
Determine percentage.
const LP_STATUS_COMPLETED
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
static setInProgressIfNotAttempted($a_obj_id, $a_user_id)
This function shoudl be clalled for normal "read events".
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
const LP_STATUS_NOT_REGISTERED
const LP_STATUS_PARTICIPATED
const LP_STATUS_FAILED
const LP_STATUS_IN_PROGRESS_NUM
static checkStatusForObject($a_obj_id, $a_users=false)
This function checks whether the status for a given number of users is dirty and must be recalculated...
static _getCompleted($a_obj_id)
__construct($a_obj_id)
static _getCountNotAttempted($a_obj_id)
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_REGISTERED
static checkLPModesForObjects($a_obj_ids, array &$a_coll_obj_ids)
Process lp modes for given objects.
refreshStatus($a_obj_id, $a_users=null)
Refresh status.
static _getNotAttempted($a_obj_id)
static setAllDirty()
Sets all status to dirty.
static _getCountCompleted($a_obj_id)
static getLPStatusForObjects($a_user_id, $a_obj_ids)
Get LP status for given objects (and user)
static _lookupStatusChanged($a_obj_id, $a_user_id)
Lookup status changed.
static $list_gui_cache
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
static setDirty($a_obj_id)
Sets status of an object to dirty.
const LP_STATUS_FAILED_NUM
static validateLPForObjects($a_user_id, $a_obj_ids, $a_parent_ref_id)
Process given objects for lp-relevance.
static _lookupPercentage($a_obj_id, $a_user_id)
Lookup percentage.
static raiseEvent($a_obj_id, $a_usr_id, $a_status, $a_percentage)
static getListGUIStatus($a_obj_id, $a_image_only=true)
static _getFailed($a_obj_id)
static _getCountFailed()
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
static writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
Write status for user and object.
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
static _getImagePathForStatus($a_status)
Get image path for status.
static getLogger($a_component_id)
Get component logger.
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
static _enabledLearningProgress()
check wether learing progress is enabled or not
static getLPMemberships($a_usr_id, array $a_obj_ids, $a_parent_ref_id=null, $a_mapped_ref_ids=false)
Get all objects where given user is member (from LP POV)
static getInstance($a_obj_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$valid
$r
Definition: example_031.php:79
$row
$ret
Definition: parser.php:6
$log
Definition: sabredav.php:21
global $DIC
Definition: saml.php:7
$lng
foreach($_POST as $key=> $value) $res
global $ilDB
$ilUser
Definition: imgupload.php:18
$text
Definition: errorreport.php:18