ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLPStatusQuestions.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Tracking/classes/class.ilLPStatus.php';
5 
14 {
15  public static function _getInProgress($a_obj_id)
16  {
17  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
19 
20  // Exclude all users with status completed.
21  $users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
22 
23  return $users;
24  }
25 
26  public static function _getCompleted($a_obj_id)
27  {
28  $usr_ids = array();
29 
30  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
32 
33  include_once "Modules/LearningModule/classes/class.ilLMTracker.php";
34  foreach ($users as $user_id) {
35  // :TODO: this ought to be optimized
36  $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $user_id);
37  if ($tracker->getAllQuestionsCorrect()) {
38  $usr_ids[] = $user_id;
39  }
40  }
41 
42  return $usr_ids;
43  }
44 
53  public function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
54  {
55  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
56 
57  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
58  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
59  $status = self::LP_STATUS_IN_PROGRESS_NUM;
60 
61  include_once "Modules/LearningModule/classes/class.ilLMTracker.php";
62  $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $a_user_id);
63  if ($tracker->getAllQuestionsCorrect()) {
64  $status = self::LP_STATUS_COMPLETED_NUM;
65  }
66  }
67 
68  return $status;
69  }
70 }
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
Determine status.
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
static _getInProgress($a_obj_id)
static _getCompleted($a_obj_id)
Static function to read the users who have the status &#39;completed&#39;.
static getInstanceByObjId($a_obj_id, $a_user_id=0)
Get instance.
$users
Definition: authpage.php:44
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.