ILIAS
Release_4_4_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
class.ilAssIncompleteQuestionPurger.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
11
class
ilAssIncompleteQuestionPurger
12
{
16
protected
$db
;
17
18
protected
$ownerId
;
19
20
public
function
__construct
(
ilDB
$db
)
21
{
22
$this->db =
$db
;
23
}
24
25
public
function
getOwnerId
()
26
{
27
return
$this->ownerId
;
28
}
29
30
public
function
setOwnerId
(
$ownerId
)
31
{
32
$this->ownerId =
$ownerId
;
33
}
34
35
public
function
purge
()
36
{
37
$questionIds = $this->
getPurgableQuestionIds
();
38
$this->
purgeQuestionIds
($questionIds);
39
}
40
41
private
function
getPurgableQuestionIds
()
42
{
43
$query
=
"SELECT question_id FROM qpl_questions WHERE owner = %s AND tstamp = %s"
;
44
45
$res
= $this->db->queryF(
$query
, array(
'integer'
,
'integer'
), array($this->
getOwnerId
(), 0));
46
47
$questionIds = array();
48
49
while
(
$row
= $this->db->fetchAssoc(
$res
) )
50
{
51
$questionIds[] =
$row
[
'question_id'
];
52
}
53
54
return
$questionIds;
55
}
56
57
private
function
purgeQuestionIds
($questionIds)
58
{
59
require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php'
;
60
61
foreach
($questionIds as $questionId)
62
{
63
$question =
assQuestion::_instantiateQuestion
($questionId);
64
$question->delete($questionId);
65
}
66
}
67
}
Modules
TestQuestionPool
classes
class.ilAssIncompleteQuestionPurger.php
Generated on Wed Apr 27 2016 20:01:27 for ILIAS by
1.8.1.2 (using
Doxyfile
)