ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 public function __construct($a_obj_id)
17 {
18 global $ilDB;
19
20 parent::__construct($a_obj_id);
21 $this->db = $ilDB;
22 }
23
24 public static function _getInProgress($a_obj_id)
25 {
26 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
28
29 // Exclude all users with status completed.
30 $users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
31
32 return $users;
33 }
34
35 public static function _getCompleted($a_obj_id)
36 {
37 global $ilDB;
38
39 $usr_ids = array();
40
41 $query = "SELECT DISTINCT(usr_id) user_id FROM ut_lp_marks " .
42 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
43 "AND completed = '1' ";
44
45 $res = $ilDB->query($query);
46 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
47 $usr_ids[] = $row->user_id;
48 }
49
50 return $usr_ids;
51 }
52
61 public function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
62 {
63 global $ilObjDataCache, $ilDB;
64
66 switch ($ilObjDataCache->lookupType($a_obj_id)) {
67 case 'lm':
68 case 'htlm':
69 include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
70 if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
72
73 // completed?
74 $set = $ilDB->query($q = "SELECT usr_id FROM ut_lp_marks " .
75 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
76 "AND usr_id = " . $ilDB->quote($a_user_id, 'integer') . " " .
77 "AND completed = '1' ");
78 if ($rec = $ilDB->fetchAssoc($set)) {
80 }
81 }
82 break;
83 }
84 return $status;
85 }
86
94 public static function _lookupFailedForObject($a_obj_id, $a_user_ids = null)
95 {
96 return array();
97 }
98}
$users
Definition: authpage.php:44
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
$query
foreach($_POST as $key=> $value) $res
global $ilDB