ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssIncompleteQuestionPurger Class Reference
+ Collaboration diagram for ilAssIncompleteQuestionPurger:

Public Member Functions

 __construct (ilDBInterface $db)
 
 getOwnerId ()
 
 setOwnerId ($ownerId)
 
 purge ()
 

Protected Member Functions

 setIgnoredContainerObjectTypes ($ignoredContainerObjectTypes)
 
 getIgnoredContainerObjectTypes ()
 

Protected Attributes

 $db
 
 $ownerId
 

Private Member Functions

 getPurgableQuestionIds ()
 
 purgeQuestionIds ($questionIds)
 

Private Attributes

 $ignoredContainerObjectTypes
 

Detailed Description

Definition at line 25 of file class.ilAssIncompleteQuestionPurger.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssIncompleteQuestionPurger::__construct ( ilDBInterface  $db)

Definition at line 36 of file class.ilAssIncompleteQuestionPurger.php.

37 {
38 $this->db = $db;
39
40 $this->ignoredContainerObjectTypes = ['lm'];
41 }

References $db.

Member Function Documentation

◆ getIgnoredContainerObjectTypes()

ilAssIncompleteQuestionPurger::getIgnoredContainerObjectTypes ( )
protected

Definition at line 97 of file class.ilAssIncompleteQuestionPurger.php.

References $ignoredContainerObjectTypes.

Referenced by getPurgableQuestionIds().

+ Here is the caller graph for this function:

◆ getOwnerId()

ilAssIncompleteQuestionPurger::getOwnerId ( )

Definition at line 43 of file class.ilAssIncompleteQuestionPurger.php.

References $ownerId.

Referenced by getPurgableQuestionIds().

+ Here is the caller graph for this function:

◆ getPurgableQuestionIds()

ilAssIncompleteQuestionPurger::getPurgableQuestionIds ( )
private

Definition at line 59 of file class.ilAssIncompleteQuestionPurger.php.

59 : array
60 {
61 $INtypes = $this->db->in('object_data.type', $this->getIgnoredContainerObjectTypes(), true, 'text');
62
63 $query = "
64 SELECT qpl_questions.question_id
65 FROM qpl_questions
66 INNER JOIN object_data
67 ON object_data.obj_id = qpl_questions.obj_fi
68 AND $INtypes
69 WHERE qpl_questions.owner = %s
70 AND qpl_questions.tstamp = %s
71 ";
72
73 $res = $this->db->queryF($query, ['integer', 'integer'], [$this->getOwnerId(), 0]);
74
75 $questionIds = [];
76
77 while ($row = $this->db->fetchAssoc($res)) {
78 $questionIds[] = $row['question_id'];
79 }
80
81 return $questionIds;
82 }
$res
Definition: ltiservices.php:69

References $res, getIgnoredContainerObjectTypes(), and getOwnerId().

Referenced by purge().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ purge()

ilAssIncompleteQuestionPurger::purge ( )

Definition at line 53 of file class.ilAssIncompleteQuestionPurger.php.

53 : void
54 {
55 $questionIds = $this->getPurgableQuestionIds();
56 $this->purgeQuestionIds($questionIds);
57 }

References getPurgableQuestionIds(), and purgeQuestionIds().

+ Here is the call graph for this function:

◆ purgeQuestionIds()

ilAssIncompleteQuestionPurger::purgeQuestionIds (   $questionIds)
private

Definition at line 84 of file class.ilAssIncompleteQuestionPurger.php.

84 : void
85 {
86 foreach ($questionIds as $questionId) {
87 $question = assQuestion::instantiateQuestion($questionId);
88 $question->delete($questionId);
89 }
90 }
static instantiateQuestion(int $question_id)

References assQuestion\instantiateQuestion().

Referenced by purge().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIgnoredContainerObjectTypes()

ilAssIncompleteQuestionPurger::setIgnoredContainerObjectTypes (   $ignoredContainerObjectTypes)
protected

Definition at line 92 of file class.ilAssIncompleteQuestionPurger.php.

92 : void
93 {
94 $this->ignoredContainerObjectTypes = $ignoredContainerObjectTypes;
95 }

References $ignoredContainerObjectTypes.

◆ setOwnerId()

ilAssIncompleteQuestionPurger::setOwnerId (   $ownerId)

Definition at line 48 of file class.ilAssIncompleteQuestionPurger.php.

48 : void
49 {
50 $this->ownerId = $ownerId;
51 }

References $ownerId.

Field Documentation

◆ $db

ilAssIncompleteQuestionPurger::$db
protected

Definition at line 30 of file class.ilAssIncompleteQuestionPurger.php.

Referenced by __construct().

◆ $ignoredContainerObjectTypes

ilAssIncompleteQuestionPurger::$ignoredContainerObjectTypes
private

◆ $ownerId

ilAssIncompleteQuestionPurger::$ownerId
protected

Definition at line 32 of file class.ilAssIncompleteQuestionPurger.php.

Referenced by getOwnerId(), and setOwnerId().


The documentation for this class was generated from the following file: