ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC;
19
20 $ilDB = $DIC['ilDB'];
21
22 parent::__construct($a_obj_id);
23 $this->db = $ilDB;
24 }
25
26 public static function _getInProgress($a_obj_id)
27 {
28 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
30
31 // Exclude all users with status completed.
32 $users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
33
34 return $users;
35 }
36
37 public static function _getCompleted($a_obj_id)
38 {
39 global $DIC;
40
41 $ilDB = $DIC['ilDB'];
42
43 $usr_ids = array();
44
45 $query = "SELECT DISTINCT(usr_id) user_id FROM ut_lp_marks " .
46 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
47 "AND completed = '1' ";
48
49 $res = $ilDB->query($query);
50 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
51 $usr_ids[] = $row->user_id;
52 }
53
54 return $usr_ids;
55 }
56
65 public function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
66 {
67 global $DIC;
68
69 $ilObjDataCache = $DIC['ilObjDataCache'];
70 $ilDB = $DIC['ilDB'];
71
73 switch ($ilObjDataCache->lookupType($a_obj_id)) {
74 case 'lm':
75 case 'copa':
76 case 'htlm':
77 include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
78 if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
80
81 // completed?
82 $set = $ilDB->query($q = "SELECT usr_id FROM ut_lp_marks " .
83 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
84 "AND usr_id = " . $ilDB->quote($a_user_id, 'integer') . " " .
85 "AND completed = '1' ");
86 if ($rec = $ilDB->fetchAssoc($set)) {
88 }
89 }
90 break;
91 }
92 return $status;
93 }
94
102 public static function _lookupFailedForObject($a_obj_id, $a_user_ids = null)
103 {
104 return array();
105 }
106}
$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
$row
$query
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB