ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 var $obj_id = null;
18
19 var $db = null;
20
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 function ilLPStatus($a_obj_id)
39 {
40 global $ilDB;
41
42 $this->obj_id = $a_obj_id;
43 $this->db =& $ilDB;
44 }
45
46 function _getCountNotAttempted($a_obj_id)
47 {
48 return 0;
49 }
50
51 function _getNotAttempted($a_obj_id)
52 {
53 return array();
54 }
55
56 function _getCountInProgress($a_obj_id)
57 {
58 return 0;
59 }
60 function _getInProgress($a_obj_id)
61 {
62 return array();
63 }
64
65 function _getCountCompleted($a_obj_id)
66 {
67 return 0;
68 }
69 function _getCompleted($a_obj_id)
70 {
71 return array();
72 }
73 function _getFailed($a_obj_id)
74 {
75 return array();
76 }
77 function _getCountFailed()
78 {
79 return 0;
80 }
81 function _getStatusInfo($a_obj_id)
82 {
83 return array();
84 }
85 function _getTypicalLearningTime($a_obj_id)
86 {
87 include_once 'Services/MetaData/classes/class.ilMDEducational.php';
89 }
90
91
195 function _updateStatus($a_obj_id, $a_usr_id, $a_obj = null, $a_percentage = false, $a_force_raise = false)
196 {
197//global $ilLog;
198//$ilLog->write("ilLPStatus-_updateStatus-");
199
200 $status = $this->determineStatus($a_obj_id, $a_usr_id, $a_obj);
201 $percentage = $this->determinePercentage($a_obj_id, $a_usr_id, $a_obj);
202 $changed = self::writeStatus($a_obj_id, $a_usr_id, $status, $percentage);
203
204 if($changed || (bool)$a_force_raise) // #15529
205 {
206 self::raiseEvent($a_obj_id, $a_usr_id, $status, $percentage);
207 }
208 }
209
216 function determinePercentage($a_obj_id, $a_usr_id, $a_obj = null)
217 {
218 return false;
219 }
220
227 function determineStatus($a_obj_id, $a_usr_id, $a_obj = null)
228 {
229 return false;
230 }
231
232
240 static function checkStatusForObject($a_obj_id, $a_users = false)
241 {
242 global $ilDB;
243
244//@todo: there maybe the need to add extra handling for sessions here, since the
245// "in progress" status is time dependent here. On the other hand, if they registered
246// to the session, they already accessed the course and should have a "in progress"
247// anyway. But the status on the session itself may not be correct.
248
249 $sql = "SELECT usr_id FROM ut_lp_marks WHERE ".
250 " obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
251 " status_dirty = ".$ilDB->quote(1, "integer");
252 if(is_array($a_users) && count($a_users) > 0)
253 {
254 $sql .= " AND ".$ilDB->in("usr_id", $a_users, false, "integer");
255 }
256 $set = $ilDB->query($sql);
257 $dirty = false;
258 if ($rec = $ilDB->fetchAssoc($set))
259 {
260 $dirty = true;
261 }
262
263 // check if any records are missing
264 $missing = false;
265 if (!$dirty && is_array($a_users) && count($a_users) > 0)
266 {
267 $set = $ilDB->query("SELECT count(usr_id) cnt FROM ut_lp_marks WHERE ".
268 " obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
269 $ilDB->in("usr_id", $a_users, false, "integer"));
270 $r = $ilDB->fetchAssoc($set);
271 if ($r["cnt"] < count($a_users))
272 {
273 $missing = true;
274 }
275 }
276
277 // refresh status, if records are dirty or missing
278 if ($dirty || $missing)
279 {
280 require_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; // #13330
281 $trac_obj = ilLPStatusFactory::_getInstance($a_obj_id);
282 $trac_obj->refreshStatus($a_obj_id, $a_users);
283 }
284 }
285
286 protected function raiseEvent($a_obj_id, $a_usr_id, $a_status, $a_percentage)
287 {
288 global $ilAppEventHandler;
289
290 $ilAppEventHandler->raise("Services/Tracking", "updateStatus", array(
291 "obj_id" => $a_obj_id,
292 "usr_id" => $a_usr_id,
293 "status" => $a_status,
294 "percentage" => $a_percentage
295 ));
296 }
297
304 function refreshStatus($a_obj_id, $a_users = null)
305 {
306 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
307 $not_attempted = ilLPStatusWrapper::_getNotAttempted($a_obj_id);
308 foreach ($not_attempted as $user_id)
309 {
310 $percentage = $this->determinePercentage($a_obj_id, $user_id);
311 if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, $percentage, true))
312 {
313 self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, $percentage);
314 }
315 }
316 $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
317 foreach ($in_progress as $user_id)
318 {
319 $percentage = $this->determinePercentage($a_obj_id, $user_id);
320 if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_IN_PROGRESS_NUM, $percentage, true))
321 {
322 self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_IN_PROGRESS_NUM, $percentage);
323 }
324 }
325 $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
326 foreach ($completed as $user_id)
327 {
328 $percentage = $this->determinePercentage($a_obj_id, $user_id);
329 if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_COMPLETED_NUM, $percentage, true))
330 {
331 self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_COMPLETED_NUM, $percentage);
332 }
333 }
335 foreach ($failed as $user_id)
336 {
337 $percentage = $this->determinePercentage($a_obj_id, $user_id);
338 if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_FAILED_NUM, $percentage, true))
339 {
340 self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_FAILED_NUM, $percentage);
341 }
342 }
343 if($a_users)
344 {
345 $missing_users = array_diff($a_users, $not_attempted+$in_progress+$completed+$failed);
346 if($missing_users)
347 {
348 foreach ($missing_users as $user_id)
349 {
350 ilLPStatusWrapper::_updateStatus($a_obj_id, $user_id);
351 }
352 }
353 }
354 }
355
362 static function writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage = false, $a_force_per = false)
363 {
364 global $ilDB;
365
366 $update_collections = false;
367
368 // get status in DB
369 $set = $ilDB->query("SELECT usr_id,status,status_dirty FROM ut_lp_marks WHERE ".
370 " obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
371 " usr_id = ".$ilDB->quote($a_user_id, "integer")
372 );
373 $rec = $ilDB->fetchAssoc($set);
374
375 // update
376 if ($rec)
377 {
378 // status has changed: update
379 if ($rec["status"] != $a_status)
380 {
381 $ret = $ilDB->manipulate("UPDATE ut_lp_marks SET ".
382 " status = ".$ilDB->quote($a_status, "integer").",".
383 " status_changed = ".$ilDB->now().",".
384 " status_dirty = ".$ilDB->quote(0, "integer").
385 " WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
386 " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
387 );
388 if ($ret != 0)
389 {
390 $update_collections = true;
391 }
392 }
393 // status has not changed: reset dirty flag
394 else if ($rec["status_dirty"])
395 {
396 $ilDB->manipulate("UPDATE ut_lp_marks SET ".
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 }
402 }
403 // insert
404 else
405 {
406 /*
407 $ilDB->manipulate("INSERT INTO ut_lp_marks ".
408 "(status, status_changed, usr_id, obj_id, status_dirty) VALUES (".
409 $ilDB->quote($a_status, "integer").",".
410 $ilDB->now().",".
411 $ilDB->quote($a_user_id, "integer").",".
412 $ilDB->quote($a_obj_id, "integer").",".
413 $ilDB->quote(0, "integer").
414 ")");
415 */
416
417 // #13783
418 $ilDB->replace("ut_lp_marks",
419 array(
420 "obj_id" => array("integer", $a_obj_id),
421 "usr_id" => array("integer", $a_user_id)
422 ),
423 array(
424 "status" => array("integer", $a_status),
425 "status_changed" => array("timestamp", date("Y-m-d H:i:s")), // was $ilDB->now()
426 "status_dirty" => array("integer", 0)
427 )
428 );
429
430 $update_collections = true;
431 }
432
433 // update percentage
434 if ($a_percentage !== false || $a_force_per)
435 {
436 $a_percentage = max(0, (int) $a_percentage);
437 $a_percentage = min(100, $a_percentage);
438 $ret = $ilDB->manipulate("UPDATE ut_lp_marks SET ".
439 " percentage = ".$ilDB->quote($a_percentage, "integer").
440 " WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
441 " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
442 );
443 }
444
445 // update collections
446 if ($update_collections)
447 {
448 // a change occured - remove existing cache entry
449 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
450 ilLPStatusWrapper::_removeStatusCache($a_obj_id, $a_user_id);
451
452 $set = $ilDB->query("SELECT ut_lp_collections.obj_id obj_id FROM ".
453 "object_reference JOIN ut_lp_collections ON ".
454 "(object_reference.obj_id = ".$ilDB->quote($a_obj_id, "integer").
455 " AND object_reference.ref_id = ut_lp_collections.item_id)");
456 while ($rec = $ilDB->fetchAssoc($set))
457 {
458 if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold")))
459 {
460 // just to make sure - remove existing cache entry
461 ilLPStatusWrapper::_removeStatusCache($rec["obj_id"], $a_user_id);
462
463 ilLPStatusWrapper::_updateStatus($rec["obj_id"], $a_user_id);
464 }
465 }
466 }
467
468 return $update_collections;
469 }
470
476 static function setInProgressIfNotAttempted($a_obj_id, $a_user_id)
477 {
478 global $ilDB;
479
480 // #11513
481
482 $needs_update = false;
483
484 $set = $ilDB->query("SELECT usr_id, status FROM ut_lp_marks WHERE ".
485 " obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
486 " usr_id = ".$ilDB->quote($a_user_id, "integer")
487 );
488 if ($rec = $ilDB->fetchAssoc($set))
489 {
490 // current status is not attempted, so we need to update
491 if($rec["status"] == self::LP_STATUS_NOT_ATTEMPTED_NUM)
492 {
493 $needs_update = true;
494 }
495 }
496 else
497 {
498 // no ut_lp_marks yet, we should update
499 $needs_update = true;
500 }
501
502 if($needs_update)
503 {
504 require_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
505 ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
506 }
507 }
508
515 static function setAllDirty()
516 {
517 global $ilDB;
518
519 $ilDB->manipulate("UPDATE ut_lp_marks SET ".
520 " status_dirty = ".$ilDB->quote(1, "integer")
521 );
522
523 }
524
531 static function setDirty($a_obj_id)
532 {
533 global $ilDB;
534
535 $ilDB->manipulate("UPDATE ut_lp_marks SET ".
536 " status_dirty = ".$ilDB->quote(1, "integer").
537 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
538 );
539 }
540
548 public static function _lookupStatus($a_obj_id, $a_user_id, $a_create = true)
549 {
550 global $ilDB;
551
552 $set = $ilDB->query("SELECT status FROM ut_lp_marks WHERE ".
553 " status_dirty = ".$ilDB->quote(0, "integer").
554 " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
555 " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
556 );
557 if ($rec = $ilDB->fetchAssoc($set))
558 {
559 return $rec["status"];
560 }
561 else if((bool)$a_create)
562 {
563 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
564 ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
565 $set = $ilDB->query("SELECT status FROM ut_lp_marks WHERE ".
566 " status_dirty = ".$ilDB->quote(0, "integer").
567 " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
568 " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
569 );
570 if ($rec = $ilDB->fetchAssoc($set))
571 {
572 return $rec["status"];
573 }
574 }
575 }
576
583 public static function _lookupPercentage($a_obj_id, $a_user_id)
584 {
585 global $ilDB;
586
587 $set = $ilDB->query("SELECT percentage FROM ut_lp_marks WHERE ".
588 " status_dirty = ".$ilDB->quote(0, "integer").
589 " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
590 " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
591 );
592 if ($rec = $ilDB->fetchAssoc($set))
593 {
594 return $rec["percentage"];
595 }
596 }
597
605 public static function _hasUserCompleted($a_obj_id, $a_user_id)
606 {
607 return (self::_lookupStatus($a_obj_id, $a_user_id) == self::LP_STATUS_COMPLETED_NUM);
608 }
609
616 function _lookupStatusChanged($a_obj_id, $a_user_id)
617 {
618 global $ilDB;
619
620 $set = $ilDB->query("SELECT status_changed FROM ut_lp_marks WHERE ".
621 " status_dirty = ".$ilDB->quote(0, "integer").
622 " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
623 " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
624 );
625 if ($rec = $ilDB->fetchAssoc($set))
626 {
627 return $rec["status_changed"];
628 }
629 else
630 {
631 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
632 ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
633 $set = $ilDB->query("SELECT status_changed FROM ut_lp_marks WHERE ".
634 " status_dirty = ".$ilDB->quote(0, "integer").
635 " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
636 " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
637 );
638 if ($rec = $ilDB->fetchAssoc($set))
639 {
640 return $rec["status_changed"];
641 }
642 }
643 }
644
653 protected static function _lookupStatusForObject($a_obj_id, $a_status, $a_user_ids = null)
654 {
655 global $ilDB;
656
657 $sql = "SELECT usr_id, status, status_dirty FROM ut_lp_marks".
658 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
659 " AND status = ".$ilDB->quote($a_status, "integer");
660 if($a_user_ids)
661 {
662 $sql .= " AND ".$ilDB->in("usr_id", $a_user_ids, "", "integer");
663 }
664
665 $set = $ilDB->query($sql);
666 $res = array();
667 while($rec = $ilDB->fetchAssoc($set))
668 {
669 if($res["status_dirty"])
670 {
671 // update status and check again
672 if(self::_lookupStatus($a_obj_id, $rec["usr_id"]) != $a_status)
673 {
674 continue;
675 }
676 }
677 $res[] = $rec["usr_id"];
678 }
679
680 return $res;
681 }
682
690 public static function _lookupCompletedForObject($a_obj_id, $a_user_ids = null)
691 {
692 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
693 }
694
702 public static function _lookupFailedForObject($a_obj_id, $a_user_ids = null)
703 {
704 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_FAILED_NUM, $a_user_ids);
705 }
706
714 public static function _lookupInProgressForObject($a_obj_id, $a_user_ids = null)
715 {
716 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
717 }
718
719
720 //
721 // LIST GUI
722 //
723
732 protected static function validateLPForObjects($a_user_id, $a_obj_ids, $a_parent_ref_id)
733 {
734 $lp_invalid = array();
735
736 include_once "Services/Object/classes/class.ilObjectLP.php";
737 $memberships = ilObjectLP::getLPMemberships($a_user_id, $a_obj_ids, $a_parent_ref_id);
738 foreach($memberships as $obj_id => $status)
739 {
740 if(!$status)
741 {
742 $lp_invalid[] = $obj_id;
743 }
744 }
745
746 return array_diff($a_obj_ids, $lp_invalid);
747 }
748
755 protected static function checkLPModesForObjects($a_obj_ids, array &$a_coll_obj_ids)
756 {
757 $valid = array();
758
759 // all lp modes with collections (gathered separately)
760 include_once "Services/Tracking/classes/collection/class.ilLPCollection.php";
762
763 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
764
765 // check if objects have LP activated at all (DB entries)
766 $existing = ilLPObjSettings::_lookupDBModeForObjects($a_obj_ids);
767 foreach($existing as $obj_id => $obj_mode)
768 {
770 {
772
773 if(in_array($obj_mode, $coll_modes))
774 {
775 $a_coll_obj_ids[] = $obj_id;
776 }
777 }
778 }
779
780 // missing objects in DB (default mode)
781 include_once "Services/Object/classes/class.ilObjectLP.php";
782 if(sizeof($existing) != sizeof($a_obj_ids))
783 {
784 foreach(array_diff($a_obj_ids, $existing) as $obj_id)
785 {
787 $mode = $olp->getCurrentMode();
789 {
790 // #11141
791 unset($valid[$obj_id]);
792 }
793 else if($mode != ilLPObjSettings::LP_MODE_UNDEFINED)
794 {
796
797 if(in_array($mode, $coll_modes))
798 {
799 $a_coll_obj_ids[] = $obj_id;
800 }
801 }
802 }
803 unset($existing);
804 }
805
806 return array_values($valid);
807 }
808
816 protected static function getLPStatusForObjects($a_user_id, $a_obj_ids)
817 {
818 global $ilDB;
819
820 $res = array();
821
822 // get user lp data
823 $sql = "SELECT status, status_dirty, obj_id FROM ut_lp_marks".
824 " WHERE ".$ilDB->in("obj_id", $a_obj_ids, "", "integer").
825 " AND usr_id = ".$ilDB->quote($a_user_id, "integer");
826 $set = $ilDB->query($sql);
827 while($row = $ilDB->fetchAssoc($set))
828 {
829 if(!$row["status_dirty"])
830 {
831 $res[$row["obj_id"]] = $row["status"];
832 }
833 else
834 {
835 $res[$row["obj_id"]] = self::_lookupStatus($row["obj_id"], $a_user_id);
836 }
837 }
838
839 // process missing user entries (same as dirty entries, see above)
840 foreach($a_obj_ids as $obj_id)
841 {
842 if(!isset($res[$obj_id]))
843 {
844 $res[$obj_id] = self::_lookupStatus($obj_id, $a_user_id);
845 if($res[$obj_id] === null)
846 {
848 }
849 }
850 }
851
852 return $res;
853 }
854
855 public static function preloadListGUIData($a_obj_ids)
856 {
857 global $ilUser, $lng;
858
859 $user_id = $ilUser->getId();
860
861 $res = array();
862
863 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
864 if($ilUser->getId() != ANONYMOUS_USER_ID &&
868 {
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)
890 {
894 }
895 }
896
897 self::$list_gui_cache = $res;
898 }
899
900 public static function getListGUIStatus($a_obj_id)
901 {
902 return self::$list_gui_cache[$a_obj_id];
903 }
904}
905?>
$failed
Definition: Utf8Test.php:86
$_GET["client_id"]
static _lookupDBModeForObjects(array $a_obj_ids)
_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.
_getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
_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)
_getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
_getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
_getNotAttempted($a_obj_id)
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
raiseEvent($a_obj_id, $a_usr_id, $a_status, $a_percentage)
static preloadListGUIData($a_obj_ids)
determineStatus($a_obj_id, $a_usr_id, $a_obj=null)
Determine status.
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
_lookupStatusChanged($a_obj_id, $a_user_id)
Lookup status changed.
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".
_getCountInProgress($a_obj_id)
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
const LP_STATUS_NOT_REGISTERED
_getFailed($a_obj_id)
const LP_STATUS_PARTICIPATED
_getStatusInfo($a_obj_id)
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...
_getCountNotAttempted($a_obj_id)
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
ilLPStatus($a_obj_id)
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_REGISTERED
_getCountCompleted($a_obj_id)
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 setAllDirty()
Sets all status to dirty.
static getLPStatusForObjects($a_user_id, $a_obj_ids)
Get LP status for given objects (and user)
_getCompleted($a_obj_id)
static $list_gui_cache
_getTypicalLearningTime($a_obj_id)
_getInProgress($a_obj_id)
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 getListGUIStatus($a_obj_id)
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.
_getImagePathForStatus($a_status)
Get image path for status.
_getStatusText($a_status, $a_lng=null)
Get status alt text.
_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="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$valid
$text
$r
Definition: example_031.php:79
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22
global $ilDB
global $ilUser
Definition: imgupload.php:15