ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
4include_once 'Services/Tracking/classes/class.ilLPStatus.php';
5
15{
16
17 function __construct($a_obj_id)
18 {
19 global $ilDB;
20
21 parent::__construct($a_obj_id);
22 $this->db = $ilDB;
23 }
24
25 static 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 static 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(ilDBConstants::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 'lm':
71 case 'htlm':
72 include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
73 if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
74 {
76
77 // completed?
78 $set = $ilDB->query($q = "SELECT usr_id FROM ut_lp_marks ".
79 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
80 "AND usr_id = ".$ilDB->quote($a_user_id ,'integer')." ".
81 "AND completed = '1' ");
82 if ($rec = $ilDB->fetchAssoc($set))
83 {
85 }
86 }
87 break;
88 }
89 return $status;
90 }
91
99 public static function _lookupFailedForObject($a_obj_id, $a_user_ids = null)
100 {
101 return array();
102 }
103}
104?>
An exception for terminatinating execution or to throw for unit testing.
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
static _getCompleted($a_obj_id)
static _getInProgress($a_obj_id)
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
Determine status.
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
global $ilDB