ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 __construct($a_obj_id)
39  {
40  global $ilDB;
41 
42  $this->obj_id = $a_obj_id;
43  $this->db = $ilDB;
44  }
45 
46  static function _getCountNotAttempted($a_obj_id)
47  {
48  return 0;
49  }
50 
51  static function _getNotAttempted($a_obj_id)
52  {
53  return array();
54  }
55 
56  static function _getCountInProgress($a_obj_id)
57  {
58  return 0;
59  }
60 
61  static function _getInProgress($a_obj_id)
62  {
63  return array();
64  }
65 
66  static function _getCountCompleted($a_obj_id)
67  {
68  return 0;
69  }
70 
71  static function _getCompleted($a_obj_id)
72  {
73  return array();
74  }
75 
76  static function _getFailed($a_obj_id)
77  {
78  return array();
79  }
80 
81  static function _getCountFailed()
82  {
83  return 0;
84  }
85 
86  static function _getStatusInfo($a_obj_id)
87  {
88  return array();
89  }
90 
91  static function _getTypicalLearningTime($a_obj_id)
92  {
93  include_once 'Services/MetaData/classes/class.ilMDEducational.php';
95  }
96 
97 
201  function _updateStatus($a_obj_id, $a_usr_id, $a_obj = null, $a_percentage = false, $a_force_raise = false)
202  {
204  $log->debug("obj_id: ".$a_obj_id.", user id: ".$a_usr_id.", object: ".
205  get_class($a_obj));
206 
207  $status = $this->determineStatus($a_obj_id, $a_usr_id, $a_obj);
208  $percentage = $this->determinePercentage($a_obj_id, $a_usr_id, $a_obj);
209  $changed = self::writeStatus($a_obj_id, $a_usr_id, $status, $percentage);
210 
211  // ak: I don't think that this is a good way to fix 15529, we should not
212  // raise the event, if the status does not change imo.
213  // for now the changes in the next line just prevent the event being raised twice
214  if(!$changed && (bool)$a_force_raise) // #15529
215  {
216  self::raiseEvent($a_obj_id, $a_usr_id, $status, $percentage);
217  }
218  }
219 
226  function determinePercentage($a_obj_id, $a_usr_id, $a_obj = null)
227  {
228  return false;
229  }
230 
237  function determineStatus($a_obj_id, $a_usr_id, $a_obj = null)
238  {
239  return false;
240  }
241 
242 
250  static function checkStatusForObject($a_obj_id, $a_users = false)
251  {
252  global $ilDB;
253 
254 //@todo: there maybe the need to add extra handling for sessions here, since the
255 // "in progress" status is time dependent here. On the other hand, if they registered
256 // to the session, they already accessed the course and should have a "in progress"
257 // anyway. But the status on the session itself may not be correct.
258 
259  $sql = "SELECT usr_id FROM ut_lp_marks WHERE ".
260  " obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
261  " status_dirty = ".$ilDB->quote(1, "integer");
262  if(is_array($a_users) && count($a_users) > 0)
263  {
264  $sql .= " AND ".$ilDB->in("usr_id", $a_users, false, "integer");
265  }
266  $set = $ilDB->query($sql);
267  $dirty = false;
268  if ($rec = $ilDB->fetchAssoc($set))
269  {
270  $dirty = true;
271  }
272 
273  // check if any records are missing
274  $missing = false;
275  if (!$dirty && is_array($a_users) && count($a_users) > 0)
276  {
277  $set = $ilDB->query("SELECT count(usr_id) cnt FROM ut_lp_marks WHERE ".
278  " obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
279  $ilDB->in("usr_id", $a_users, false, "integer"));
280  $r = $ilDB->fetchAssoc($set);
281  if ($r["cnt"] < count($a_users))
282  {
283  $missing = true;
284  }
285  }
286 
287  // refresh status, if records are dirty or missing
288  if ($dirty || $missing)
289  {
290  require_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; // #13330
291  $trac_obj = ilLPStatusFactory::_getInstance($a_obj_id);
292  $trac_obj->refreshStatus($a_obj_id, $a_users);
293  }
294  }
295 
296  static protected function raiseEvent($a_obj_id, $a_usr_id, $a_status, $a_percentage)
297  {
298  global $ilAppEventHandler;
299 
301  $log->debug("obj_id: ".$a_obj_id.", user id: ".$a_usr_id.", status: ".
302  $a_status.", percentage: ".$a_percentage);
303 
304  $ilAppEventHandler->raise("Services/Tracking", "updateStatus", array(
305  "obj_id" => $a_obj_id,
306  "usr_id" => $a_usr_id,
307  "status" => $a_status,
308  "percentage" => $a_percentage
309  ));
310  }
311 
318  function refreshStatus($a_obj_id, $a_users = null)
319  {
320  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
321  $not_attempted = ilLPStatusWrapper::_getNotAttempted($a_obj_id);
322  foreach ($not_attempted as $user_id)
323  {
324  $percentage = $this->determinePercentage($a_obj_id, $user_id);
325  if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, $percentage, true))
326  {
327  //self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, $percentage);
328  }
329  }
330  $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
331  foreach ($in_progress as $user_id)
332  {
333  $percentage = $this->determinePercentage($a_obj_id, $user_id);
334  if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_IN_PROGRESS_NUM, $percentage, true))
335  {
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  {
342  $percentage = $this->determinePercentage($a_obj_id, $user_id);
343  if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_COMPLETED_NUM, $percentage, true))
344  {
345  //self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_COMPLETED_NUM, $percentage);
346  }
347  }
349  foreach ($failed as $user_id)
350  {
351  $percentage = $this->determinePercentage($a_obj_id, $user_id);
352  if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_FAILED_NUM, $percentage, true))
353  {
354  //self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_FAILED_NUM, $percentage);
355  }
356  }
357  if($a_users)
358  {
359  $missing_users = array_diff($a_users, $not_attempted+$in_progress+$completed+$failed);
360  if($missing_users)
361  {
362  foreach ($missing_users as $user_id)
363  {
364  ilLPStatusWrapper::_updateStatus($a_obj_id, $user_id);
365  }
366  }
367  }
368  }
369 
376  static function writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage = false, $a_force_per = false)
377  {
378  global $ilDB;
379 
381  $log->debug("obj_id: ".$a_obj_id.", user id: ".$a_user_id.", status: ".
382  $a_status.", percentage: ".$a_percentage.", force: ".$a_force_per);
383 
384  $update_collections = false;
385 
386  // get status in DB
387  $set = $ilDB->query("SELECT usr_id,status,status_dirty FROM ut_lp_marks WHERE ".
388  " obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
389  " usr_id = ".$ilDB->quote($a_user_id, "integer")
390  );
391  $rec = $ilDB->fetchAssoc($set);
392 
393  // update
394  if ($rec)
395  {
396  // status has changed: update
397  if ($rec["status"] != $a_status)
398  {
399  $ret = $ilDB->manipulate("UPDATE ut_lp_marks SET ".
400  " status = ".$ilDB->quote($a_status, "integer").",".
401  " status_changed = ".$ilDB->now().",".
402  " status_dirty = ".$ilDB->quote(0, "integer").
403  " WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
404  " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
405  );
406  if ($ret != 0)
407  {
408  $update_collections = true;
409  }
410  }
411  // status has not changed: reset dirty flag
412  else if ($rec["status_dirty"])
413  {
414  $ilDB->manipulate("UPDATE ut_lp_marks SET ".
415  " status_dirty = ".$ilDB->quote(0, "integer").
416  " WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
417  " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
418  );
419  }
420  }
421  // insert
422  else
423  {
424  /*
425  $ilDB->manipulate("INSERT INTO ut_lp_marks ".
426  "(status, status_changed, usr_id, obj_id, status_dirty) VALUES (".
427  $ilDB->quote($a_status, "integer").",".
428  $ilDB->now().",".
429  $ilDB->quote($a_user_id, "integer").",".
430  $ilDB->quote($a_obj_id, "integer").",".
431  $ilDB->quote(0, "integer").
432  ")");
433  */
434 
435  // #13783
436  $ilDB->replace("ut_lp_marks",
437  array(
438  "obj_id" => array("integer", $a_obj_id),
439  "usr_id" => array("integer", $a_user_id)
440  ),
441  array(
442  "status" => array("integer", $a_status),
443  "status_changed" => array("timestamp", date("Y-m-d H:i:s")), // was $ilDB->now()
444  "status_dirty" => array("integer", 0)
445  )
446  );
447 
448  $update_collections = true;
449  }
450 
451  // update percentage
452  if ($a_percentage !== false || $a_force_per)
453  {
454  $a_percentage = max(0, (int) $a_percentage);
455  $a_percentage = min(100, $a_percentage);
456  $ret = $ilDB->manipulate("UPDATE ut_lp_marks SET ".
457  " percentage = ".$ilDB->quote($a_percentage, "integer").
458  " WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
459  " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
460  );
461  }
462 
463  // update collections
464  if ($update_collections)
465  {
466  // a change occured - remove existing cache entry
467  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
468  ilLPStatusWrapper::_removeStatusCache($a_obj_id, $a_user_id);
469 
470  $set = $ilDB->query("SELECT ut_lp_collections.obj_id obj_id FROM ".
471  "object_reference JOIN ut_lp_collections ON ".
472  "(object_reference.obj_id = ".$ilDB->quote($a_obj_id, "integer").
473  " AND object_reference.ref_id = ut_lp_collections.item_id)");
474  while ($rec = $ilDB->fetchAssoc($set))
475  {
476  if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold")))
477  {
478  // just to make sure - remove existing cache entry
479  ilLPStatusWrapper::_removeStatusCache($rec["obj_id"], $a_user_id);
480 
481  ilLPStatusWrapper::_updateStatus($rec["obj_id"], $a_user_id);
482  }
483  }
484 
485  self::raiseEvent($a_obj_id, $a_user_id, $a_status, $a_percentage);
486  }
487 
488  return $update_collections;
489  }
490 
496  static function setInProgressIfNotAttempted($a_obj_id, $a_user_id)
497  {
498  global $ilDB;
499 
500  // #11513
501 
502  $needs_update = false;
503 
504  $set = $ilDB->query("SELECT usr_id, status FROM ut_lp_marks WHERE ".
505  " obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
506  " usr_id = ".$ilDB->quote($a_user_id, "integer")
507  );
508  if ($rec = $ilDB->fetchAssoc($set))
509  {
510  // current status is not attempted, so we need to update
511  if($rec["status"] == self::LP_STATUS_NOT_ATTEMPTED_NUM)
512  {
513  $needs_update = true;
514  }
515  }
516  else
517  {
518  // no ut_lp_marks yet, we should update
519  $needs_update = true;
520  }
521 
522  if($needs_update)
523  {
524  require_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
525  ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
526  }
527  }
528 
535  static function setAllDirty()
536  {
537  global $ilDB;
538 
539  $ilDB->manipulate("UPDATE ut_lp_marks SET ".
540  " status_dirty = ".$ilDB->quote(1, "integer")
541  );
542 
543  }
544 
551  static function setDirty($a_obj_id)
552  {
553  global $ilDB;
554 
555  $ilDB->manipulate("UPDATE ut_lp_marks SET ".
556  " status_dirty = ".$ilDB->quote(1, "integer").
557  " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
558  );
559  }
560 
568  public static function _lookupStatus($a_obj_id, $a_user_id, $a_create = true)
569  {
570  global $ilDB;
571 
572  $set = $ilDB->query("SELECT status FROM ut_lp_marks WHERE ".
573  " status_dirty = ".$ilDB->quote(0, "integer").
574  " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
575  " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
576  );
577  if ($rec = $ilDB->fetchAssoc($set))
578  {
579  return $rec["status"];
580  }
581  else if((bool)$a_create)
582  {
583  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
584  ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
585  $set = $ilDB->query("SELECT status FROM ut_lp_marks WHERE ".
586  " status_dirty = ".$ilDB->quote(0, "integer").
587  " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
588  " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
589  );
590  if ($rec = $ilDB->fetchAssoc($set))
591  {
592  return $rec["status"];
593  }
594  }
595  }
596 
603  public static function _lookupPercentage($a_obj_id, $a_user_id)
604  {
605  global $ilDB;
606 
607  $set = $ilDB->query("SELECT percentage FROM ut_lp_marks WHERE ".
608  " status_dirty = ".$ilDB->quote(0, "integer").
609  " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
610  " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
611  );
612  if ($rec = $ilDB->fetchAssoc($set))
613  {
614  return $rec["percentage"];
615  }
616  }
617 
625  public static function _hasUserCompleted($a_obj_id, $a_user_id)
626  {
627  return (self::_lookupStatus($a_obj_id, $a_user_id) == self::LP_STATUS_COMPLETED_NUM);
628  }
629 
636  public static function _lookupStatusChanged($a_obj_id, $a_user_id)
637  {
638  global $ilDB;
639 
640  $set = $ilDB->query("SELECT status_changed FROM ut_lp_marks WHERE ".
641  " status_dirty = ".$ilDB->quote(0, "integer").
642  " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
643  " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
644  );
645  if ($rec = $ilDB->fetchAssoc($set))
646  {
647  return $rec["status_changed"];
648  }
649  else
650  {
651  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
652  ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
653  $set = $ilDB->query("SELECT status_changed FROM ut_lp_marks WHERE ".
654  " status_dirty = ".$ilDB->quote(0, "integer").
655  " AND usr_id = ".$ilDB->quote($a_user_id, "integer").
656  " AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
657  );
658  if ($rec = $ilDB->fetchAssoc($set))
659  {
660  return $rec["status_changed"];
661  }
662  }
663  }
664 
673  protected static function _lookupStatusForObject($a_obj_id, $a_status, $a_user_ids = null)
674  {
675  global $ilDB;
676 
677  $sql = "SELECT usr_id, status, status_dirty FROM ut_lp_marks".
678  " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
679  " AND status = ".$ilDB->quote($a_status, "integer");
680  if($a_user_ids)
681  {
682  $sql .= " AND ".$ilDB->in("usr_id", $a_user_ids, "", "integer");
683  }
684 
685  $set = $ilDB->query($sql);
686  $res = array();
687  while($rec = $ilDB->fetchAssoc($set))
688  {
689  if($res["status_dirty"])
690  {
691  // update status and check again
692  if(self::_lookupStatus($a_obj_id, $rec["usr_id"]) != $a_status)
693  {
694  continue;
695  }
696  }
697  $res[] = $rec["usr_id"];
698  }
699 
700  return $res;
701  }
702 
710  public static function _lookupCompletedForObject($a_obj_id, $a_user_ids = null)
711  {
712  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
713  }
714 
722  public static function _lookupFailedForObject($a_obj_id, $a_user_ids = null)
723  {
724  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_FAILED_NUM, $a_user_ids);
725  }
726 
734  public static function _lookupInProgressForObject($a_obj_id, $a_user_ids = null)
735  {
736  return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
737  }
738 
739 
740  //
741  // LIST GUI
742  //
743 
752  protected static function validateLPForObjects($a_user_id, $a_obj_ids, $a_parent_ref_id)
753  {
754  $lp_invalid = array();
755 
756  include_once "Services/Object/classes/class.ilObjectLP.php";
757  $memberships = ilObjectLP::getLPMemberships($a_user_id, $a_obj_ids, $a_parent_ref_id);
758  foreach($memberships as $obj_id => $status)
759  {
760  if(!$status)
761  {
762  $lp_invalid[] = $obj_id;
763  }
764  }
765 
766  return array_diff($a_obj_ids, $lp_invalid);
767  }
768 
775  protected static function checkLPModesForObjects($a_obj_ids, array &$a_coll_obj_ids)
776  {
777  $valid = array();
778 
779  // all lp modes with collections (gathered separately)
780  include_once "Services/Tracking/classes/collection/class.ilLPCollection.php";
781  $coll_modes = ilLPCollection::getCollectionModes();
782 
783  include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
784 
785  // check if objects have LP activated at all (DB entries)
786  $existing = ilLPObjSettings::_lookupDBModeForObjects($a_obj_ids);
787  foreach($existing as $obj_id => $obj_mode)
788  {
789  if($obj_mode != ilLPObjSettings::LP_MODE_DEACTIVATED)
790  {
792 
793  if(in_array($obj_mode, $coll_modes))
794  {
795  $a_coll_obj_ids[] = $obj_id;
796  }
797  }
798  }
799 
800  // missing objects in DB (default mode)
801  include_once "Services/Object/classes/class.ilObjectLP.php";
802  if(sizeof($existing) != sizeof($a_obj_ids))
803  {
804  foreach(array_diff($a_obj_ids, $existing) as $obj_id)
805  {
806  $olp = ilObjectLP::getInstance($obj_id);
807  $mode = $olp->getCurrentMode();
809  {
810  // #11141
811  unset($valid[$obj_id]);
812  }
813  else if($mode != ilLPObjSettings::LP_MODE_UNDEFINED)
814  {
816 
817  if(in_array($mode, $coll_modes))
818  {
819  $a_coll_obj_ids[] = $obj_id;
820  }
821  }
822  }
823  unset($existing);
824  }
825 
826  return array_values($valid);
827  }
828 
836  protected static function getLPStatusForObjects($a_user_id, $a_obj_ids)
837  {
838  global $ilDB;
839 
840  $res = array();
841 
842  // get user lp data
843  $sql = "SELECT status, status_dirty, obj_id FROM ut_lp_marks".
844  " WHERE ".$ilDB->in("obj_id", $a_obj_ids, "", "integer").
845  " AND usr_id = ".$ilDB->quote($a_user_id, "integer");
846  $set = $ilDB->query($sql);
847  while($row = $ilDB->fetchAssoc($set))
848  {
849  if(!$row["status_dirty"])
850  {
851  $res[$row["obj_id"]] = $row["status"];
852  }
853  else
854  {
855  $res[$row["obj_id"]] = self::_lookupStatus($row["obj_id"], $a_user_id);
856  }
857  }
858 
859  // process missing user entries (same as dirty entries, see above)
860  foreach($a_obj_ids as $obj_id)
861  {
862  if(!isset($res[$obj_id]))
863  {
864  $res[$obj_id] = self::_lookupStatus($obj_id, $a_user_id);
865  if($res[$obj_id] === null)
866  {
867  $res[$obj_id] = self::LP_STATUS_NOT_ATTEMPTED_NUM;
868  }
869  }
870  }
871 
872  return $res;
873  }
874 
875  public static function preloadListGUIData($a_obj_ids)
876  {
877  global $ilUser, $lng;
878 
879  $user_id = $ilUser->getId();
880 
881  $res = array();
882 
883  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
884  if($ilUser->getId() != ANONYMOUS_USER_ID &&
888  {
889  // -- validate
890 
891  // :TODO: we need the parent ref id, but this is awful
892  $a_obj_ids = self::validateLPForObjects($user_id, $a_obj_ids, (int)$_GET["ref_id"]);
893 
894  // we are not handling the collections differently yet
895  $coll_obj_ids = array();
896  $a_obj_ids = self::checkLPModesForObjects($a_obj_ids, $coll_obj_ids);
897 
898 
899  // -- gather
900 
901  $res = self::getLPStatusForObjects($user_id, $a_obj_ids);
902 
903 
904  // -- render
905 
906  // value to icon
907  $lng->loadLanguageModule("trac");
908  include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
909  foreach($res as $obj_id => $status)
910  {
914  }
915  }
916 
917  self::$list_gui_cache = $res;
918  }
919 
920  public static function getListGUIStatus($a_obj_id)
921  {
922  return self::$list_gui_cache[$a_obj_id];
923  }
924 }
925 ?>
const LP_STATUS_COMPLETED_NUM
static _getCountFailed()
static _getInProgress($a_obj_id)
Static function to read users who have the status &#39;in_progress&#39;.
$path
Definition: aliased.php:25
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
refreshStatus($a_obj_id, $a_users=null)
Refresh status.
determineStatus($a_obj_id, $a_usr_id, $a_obj=null)
Determine status.
static _getCompleted($a_obj_id)
Static function to read the users who have the status &#39;completed&#39;.
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
static _getImagePathForStatus($a_status)
Get image path for status.
static $list_gui_cache
static raiseEvent($a_obj_id, $a_usr_id, $a_status, $a_percentage)
static preloadListGUIData($a_obj_ids)
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...
$_GET["client_id"]
const LP_STATUS_PARTICIPATED
const LP_STATUS_NOT_ATTEMPTED
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
$valid
static _lookupPercentage($a_obj_id, $a_user_id)
Lookup percentage.
static validateLPForObjects($a_user_id, $a_obj_ids, $a_parent_ref_id)
Process given objects for lp-relevance.
const LP_STATUS_IN_PROGRESS_NUM
__construct($a_obj_id)
static getListGUIStatus($a_obj_id)
static _getNotAttempted($a_obj_id)
static _getTypicalLearningTime($a_obj_id)
const LP_STATUS_IN_PROGRESS
static _getNotAttempted($a_obj_id)
Static function to read the number of user who have the status &#39;not_attempted&#39;.
static _getFailed($a_obj_id)
Static function to read the users who have the status &#39;completed&#39;.
static _getCompleted($a_obj_id)
static _enabledLearningProgress()
check wether learing progress is enabled or not
const LP_STATUS_NOT_PARTICIPATED
$r
Definition: example_031.php:79
const LP_STATUS_FAILED
static _getStatusInfo($a_obj_id)
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static _getCountInProgress($a_obj_id)
static _getCountNotAttempted($a_obj_id)
$ilUser
Definition: imgupload.php:18
static _lookupStatusForObject($a_obj_id, $a_status, $a_user_ids=null)
Get users with given status for object.
static _getInstance($a_obj_id, $a_mode=NULL)
static _lookupStatusChanged($a_obj_id, $a_user_id)
Lookup status changed.
static checkLPModesForObjects($a_obj_ids, array &$a_coll_obj_ids)
Process lp modes for given objects.
_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) ...
$failed
Definition: Utf8Test.php:85
static _lookupDBModeForObjects(array $a_obj_ids)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getInProgress($a_obj_id)
static _removeStatusCache($a_obj_id, $a_usr_id)
const LP_STATUS_NOT_ATTEMPTED_NUM
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
const LP_STATUS_REGISTERED
static writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
Write status for user and object.
static setDirty($a_obj_id)
Sets status of an object to dirty.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getLPStatusForObjects($a_user_id, $a_obj_ids)
Get LP status for given objects (and user)
global $lng
Definition: privfeed.php:17
static setInProgressIfNotAttempted($a_obj_id, $a_user_id)
This function shoudl be clalled for normal "read events".
global $ilDB
static _getCountCompleted($a_obj_id)
$ret
Definition: parser.php:6
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
static _getFailed($a_obj_id)
$text
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
static getLogger($a_component_id)
Get component logger.
determinePercentage($a_obj_id, $a_usr_id, $a_obj=null)
Determine percentage.
static setAllDirty()
Sets all status to dirty.
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)
const LP_STATUS_COMPLETED
static getInstance($a_obj_id)
const LP_STATUS_NOT_REGISTERED
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
const LP_STATUS_FAILED_NUM