ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
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
private
$ignoredContainerObjectTypes
;
21
22
public
function
__construct
(
ilDBInterface
$db
)
23
{
24
$this->db =
$db
;
25
26
$this->ignoredContainerObjectTypes =
array
(
'lm'
);
27
}
28
29
public
function
getOwnerId
()
30
{
31
return
$this->ownerId
;
32
}
33
34
public
function
setOwnerId
(
$ownerId
)
35
{
36
$this->ownerId =
$ownerId
;
37
}
38
39
public
function
purge
()
40
{
41
$questionIds = $this->
getPurgableQuestionIds
();
42
$this->
purgeQuestionIds
($questionIds);
43
}
44
45
private
function
getPurgableQuestionIds
()
46
{
47
$INtypes = $this->db->in(
'object_data.type'
, $this->
getIgnoredContainerObjectTypes
(),
true
,
'text'
);
48
49
$query
=
"
50
SELECT qpl_questions.question_id
51
FROM qpl_questions
52
INNER JOIN object_data
53
ON object_data.obj_id = qpl_questions.obj_fi
54
AND $INtypes
55
WHERE qpl_questions.owner = %s
56
AND qpl_questions.tstamp = %s
57
"
;
58
59
$res
= $this->db->queryF(
$query
,
array
(
'integer'
,
'integer'
),
array
($this->
getOwnerId
(), 0));
60
61
$questionIds =
array
();
62
63
while
(
$row
= $this->db->fetchAssoc(
$res
)) {
64
$questionIds[] =
$row
[
'question_id'
];
65
}
66
67
return
$questionIds;
68
}
69
70
private
function
purgeQuestionIds
($questionIds)
71
{
72
require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php'
;
73
74
foreach
($questionIds as $questionId) {
75
$question =
assQuestion::_instantiateQuestion
($questionId);
76
$question->delete($questionId);
77
}
78
}
79
80
protected
function
setIgnoredContainerObjectTypes
(
$ignoredContainerObjectTypes
)
81
{
82
$this->ignoredContainerObjectTypes =
$ignoredContainerObjectTypes
;
83
}
84
85
protected
function
getIgnoredContainerObjectTypes
()
86
{
87
return
$this->ignoredContainerObjectTypes
;
88
}
89
}
ilAssIncompleteQuestionPurger\$ownerId
$ownerId
Definition:
class.ilAssIncompleteQuestionPurger.php:18
ilAssIncompleteQuestionPurger\getOwnerId
getOwnerId()
Definition:
class.ilAssIncompleteQuestionPurger.php:29
ilAssIncompleteQuestionPurger\getIgnoredContainerObjectTypes
getIgnoredContainerObjectTypes()
Definition:
class.ilAssIncompleteQuestionPurger.php:85
ilAssIncompleteQuestionPurger\purgeQuestionIds
purgeQuestionIds($questionIds)
Definition:
class.ilAssIncompleteQuestionPurger.php:70
ilAssIncompleteQuestionPurger\setIgnoredContainerObjectTypes
setIgnoredContainerObjectTypes($ignoredContainerObjectTypes)
Definition:
class.ilAssIncompleteQuestionPurger.php:80
ilAssIncompleteQuestionPurger\purge
purge()
Definition:
class.ilAssIncompleteQuestionPurger.php:39
ilDBInterface
Interface ilDBInterface.
Definition:
interface.ilDBInterface.php:9
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilAssIncompleteQuestionPurger\$db
$db
Definition:
class.ilAssIncompleteQuestionPurger.php:16
$query
$query
Definition:
proxy_ylocal.php:13
ilAssIncompleteQuestionPurger\setOwnerId
setOwnerId($ownerId)
Definition:
class.ilAssIncompleteQuestionPurger.php:34
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
assQuestion\_instantiateQuestion
static _instantiateQuestion($question_id)
Definition:
class.assQuestion.php:3206
ilAssIncompleteQuestionPurger\__construct
__construct(ilDBInterface $db)
Definition:
class.ilAssIncompleteQuestionPurger.php:22
$row
$row
Definition:
10autofilter-selection-1.php:74
ilAssIncompleteQuestionPurger
Definition:
class.ilAssIncompleteQuestionPurger.php:11
ilAssIncompleteQuestionPurger\$ignoredContainerObjectTypes
$ignoredContainerObjectTypes
Definition:
class.ilAssIncompleteQuestionPurger.php:20
ilAssIncompleteQuestionPurger\getPurgableQuestionIds
getPurgableQuestionIds()
Definition:
class.ilAssIncompleteQuestionPurger.php:45
Modules
TestQuestionPool
classes
class.ilAssIncompleteQuestionPurger.php
Generated on Tue Jan 28 2025 19:01:25 for ILIAS by
1.8.13 (using
Doxyfile
)