ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPStatusManual.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 
15 {
16 
17  function ilLPStatusManual($a_obj_id)
18  {
19  global $ilDB;
20 
21  parent::ilLPStatus($a_obj_id);
22  $this->db =& $ilDB;
23  }
24 
25  function _getInProgress($a_obj_id)
26  {
27  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
28  $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
29 
30  // Exclude all users with status completed.
31  $users = array_diff((array) $users,ilLPStatusWrapper::_getCompleted($a_obj_id));
32 
33  return $users;
34  }
35 
36  function _getCompleted($a_obj_id)
37  {
38  global $ilDB;
39 
40  $usr_ids = array();
41 
42  $query = "SELECT DISTINCT(usr_id) user_id FROM ut_lp_marks ".
43  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
44  "AND completed = '1' ";
45 
46  $res = $ilDB->query($query);
47  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
48  {
49  $usr_ids[] = $row->user_id;
50  }
51 
52  return $usr_ids;
53  }
54 
63  function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
64  {
65  global $ilObjDataCache, $ilDB;
66 
68  switch ($ilObjDataCache->lookupType($a_obj_id))
69  {
70  case 'dbk':
71  case 'lm':
72  case 'htlm':
73  include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
74  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
75  {
76  $status = LP_STATUS_IN_PROGRESS_NUM;
77 
78  // completed?
79  $set = $ilDB->query($q = "SELECT usr_id FROM ut_lp_marks ".
80  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
81  "AND usr_id = ".$ilDB->quote($a_user_id ,'integer')." ".
82  "AND completed = '1' ");
83  if ($rec = $ilDB->fetchAssoc($set))
84  {
85  $status = LP_STATUS_COMPLETED_NUM;
86  }
87  }
88  break;
89  }
90  return $status;
91  }
92 
100  public static function _lookupFailedForObject($a_obj_id, $a_user_ids = null)
101  {
102  return array();
103  }
104 }
105 ?>