ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilLPStatusTestFinished.php
Go to the documentation of this file.
1
<?
php
2
3
/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
include_once
'./Services/Tracking/classes/class.ilLPStatus.php'
;
6
15
class
ilLPStatusTestFinished
extends
ilLPStatus
16
{
17
public
function
__construct
($a_obj_id)
18
{
19
global
$DIC
;
20
21
$ilDB
= $DIC[
'ilDB'
];
22
23
parent::__construct($a_obj_id);
24
$this->db =
$ilDB
;
25
}
26
27
public
static
function
_getInProgress
($a_obj_id)
28
{
29
global
$DIC
;
30
31
$ilDB
= $DIC[
'ilDB'
];
32
33
include_once
'./Modules/Test/classes/class.ilObjTestAccess.php'
;
34
35
$query
=
"
36
SELECT active_id, user_fi, COUNT(tst_sequence.active_fi) sequences
37
FROM tst_active
38
LEFT JOIN tst_sequence
39
ON tst_sequence.active_fi = tst_active.active_id
40
WHERE tries = {$ilDB->quote(0, "
integer
")}
41
AND test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id), "
integer
")}
42
GROUP BY active_id, user_fi
43
HAVING COUNT(tst_sequence.active_fi) > {$ilDB->quote(0, "
integer
")}
44
"
;
45
46
$res
=
$ilDB
->query(
$query
);
47
48
$user_ids = array();
49
50
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
51
$user_ids[
$row
->user_fi] =
$row
->user_fi;
52
}
53
54
return
array_values($user_ids);
55
}
56
57
58
public
static
function
_getCompleted
($a_obj_id)
59
{
60
global
$DIC
;
61
62
$ilDB
= $DIC[
'ilDB'
];
63
64
include_once
'./Modules/Test/classes/class.ilObjTestAccess.php'
;
65
66
$query
=
"
67
SELECT active_id, user_fi, COUNT(tst_sequence.active_fi) sequences
68
FROM tst_active
69
LEFT JOIN tst_sequence
70
ON tst_sequence.active_fi = tst_active.active_id
71
WHERE tries > {$ilDB->quote(0, "
integer
")}
72
AND test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
73
GROUP BY active_id, user_fi
74
HAVING COUNT(tst_sequence.active_fi) > {$ilDB->quote(0, "
integer
")}
75
"
;
76
77
$res
=
$ilDB
->query(
$query
);
78
79
$user_ids = array();
80
81
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
82
$user_ids[
$row
->user_fi] =
$row
->user_fi;
83
}
84
85
return
array_values($user_ids);
86
}
87
88
public
static
function
_getNotAttempted
($a_obj_id)
89
{
90
global
$DIC
;
91
92
$ilDB
= $DIC[
'ilDB'
];
93
94
include_once
'./Modules/Test/classes/class.ilObjTestAccess.php'
;
95
96
$query
=
"
97
SELECT active_id, user_fi, COUNT(tst_sequence.active_fi) sequences
98
FROM tst_active
99
LEFT JOIN tst_sequence
100
ON tst_sequence.active_fi = tst_active.active_id
101
WHERE test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
102
GROUP BY active_id, user_fi
103
HAVING COUNT(tst_sequence.active_fi) = {$ilDB->quote(0, "
integer
")}
104
"
;
105
106
$res
=
$ilDB
->query(
$query
);
107
108
$user_ids = array();
109
110
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
111
$user_ids[
$row
->user_fi] =
$row
->user_fi;
112
}
113
114
return
array_values($user_ids);
115
}
116
123
public
static
function
getParticipants
($a_obj_id)
124
{
125
global
$DIC
;
126
127
$ilDB
= $DIC[
'ilDB'
];
128
129
include_once
'./Modules/Test/classes/class.ilObjTestAccess.php'
;
130
131
$res
=
$ilDB
->query(
"SELECT DISTINCT user_fi FROM tst_active"
.
132
" WHERE test_fi = "
.
$ilDB
->quote(
ilObjTestAccess::_getTestIDFromObjectID
($a_obj_id)));
133
$user_ids = array();
134
135
while
($rec =
$ilDB
->fetchAssoc(
$res
)) {
136
$user_ids[] = $rec[
"user_fi"
];
137
}
138
return
$user_ids;
139
}
140
141
150
public
function
determineStatus
($a_obj_id, $a_user_id, $a_obj = null)
151
{
152
global
$DIC
;
153
154
$ilDB
= $DIC[
'ilDB'
];
155
156
include_once
'./Modules/Test/classes/class.ilObjTestAccess.php'
;
157
158
$res
=
$ilDB
->query(
"
159
SELECT active_id, user_fi, tries, COUNT(tst_sequence.active_fi) sequences
160
FROM tst_active
161
LEFT JOIN tst_sequence
162
ON tst_sequence.active_fi = tst_active.active_id
163
WHERE user_fi = {$ilDB->quote($a_user_id, "
integer
")}
164
AND test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
165
GROUP BY active_id, user_fi, tries
166
"
);
167
168
$status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
169
170
if
($rec =
$ilDB
->fetchAssoc(
$res
)) {
171
if
($rec[
'sequences'
] > 0) {
172
$status = self::LP_STATUS_IN_PROGRESS_NUM;
173
174
if
($rec[
'tries'
] > 0) {
175
$status = self::LP_STATUS_COMPLETED_NUM;
176
}
177
}
178
}
179
180
return
$status;
181
}
182
}
$DIC
global $DIC
Definition:
saml.php:7
ilLPStatusTestFinished\_getNotAttempted
static _getNotAttempted($a_obj_id)
Definition:
class.ilLPStatusTestFinished.php:88
ilLPStatusTestFinished\_getInProgress
static _getInProgress($a_obj_id)
Definition:
class.ilLPStatusTestFinished.php:27
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilLPStatusTestFinished\determineStatus
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
Determine status.
Definition:
class.ilLPStatusTestFinished.php:150
ilLPStatusTestFinished
Definition:
class.ilLPStatusTestFinished.php:15
ilLPStatusTestFinished\__construct
__construct($a_obj_id)
Definition:
class.ilLPStatusTestFinished.php:17
ilObjTestAccess\_getTestIDFromObjectID
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
Definition:
class.ilObjTestAccess.php:427
$query
$query
Definition:
proxy_ylocal.php:13
ilLPStatusTestFinished\getParticipants
static getParticipants($a_obj_id)
Get participants.
Definition:
class.ilLPStatusTestFinished.php:123
$row
$row
Definition:
migrateto20.php:360
ilLPStatusTestFinished\_getCompleted
static _getCompleted($a_obj_id)
Definition:
class.ilLPStatusTestFinished.php:58
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilLPStatus
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
Definition:
class.ilLPStatus.php:15
php
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
Services
Tracking
classes
status
class.ilLPStatusTestFinished.php
Generated on Thu Jan 16 2025 19:02:32 for ILIAS by
1.8.13 (using
Doxyfile
)