ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  static function _getInProgress($a_obj_id)
16  {
17  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
18  $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
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  static function _getCompleted($a_obj_id)
27  {
28  $usr_ids = array();
29 
30  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
31  $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
32 
33  include_once "Modules/LearningModule/classes/class.ilLMTracker.php";
34  foreach($users as $user_id)
35  {
36  // :TODO: this ought to be optimized
37  $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $user_id);
38  if($tracker->getAllQuestionsCorrect())
39  {
40  $usr_ids[] = $user_id;
41  }
42  }
43 
44  return $usr_ids;
45  }
46 
55  function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
56  {
57  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
58 
59  include_once "Services/Tracking/classes/class.ilChangeEvent.php";
60  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
61  {
62  $status = self::LP_STATUS_IN_PROGRESS_NUM;
63 
64  include_once "Modules/LearningModule/classes/class.ilLMTracker.php";
65  $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $a_user_id);
66  if($tracker->getAllQuestionsCorrect())
67  {
68  $status = self::LP_STATUS_COMPLETED_NUM;
69  }
70  }
71 
72  return $status;
73  }
74 }
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.
Create styles array
The data for the language used.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
$tracker
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.