ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 11 of file class.ilAssIncompleteQuestionPurger.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssIncompleteQuestionPurger::__construct ( ilDBInterface  $db)

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

References $db, and array.

23  {
24  $this->db = $db;
25 
26  $this->ignoredContainerObjectTypes = array('lm');
27  }
Create styles array
The data for the language used.

Member Function Documentation

◆ getIgnoredContainerObjectTypes()

ilAssIncompleteQuestionPurger::getIgnoredContainerObjectTypes ( )
protected

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

References $ignoredContainerObjectTypes.

Referenced by getPurgableQuestionIds().

+ Here is the caller graph for this function:

◆ getOwnerId()

ilAssIncompleteQuestionPurger::getOwnerId ( )

Definition at line 29 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 45 of file class.ilAssIncompleteQuestionPurger.php.

References $query, $res, $row, array, getIgnoredContainerObjectTypes(), and getOwnerId().

Referenced by purge().

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  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ purge()

ilAssIncompleteQuestionPurger::purge ( )

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

References getPurgableQuestionIds(), and purgeQuestionIds().

40  {
41  $questionIds = $this->getPurgableQuestionIds();
42  $this->purgeQuestionIds($questionIds);
43  }
+ Here is the call graph for this function:

◆ purgeQuestionIds()

ilAssIncompleteQuestionPurger::purgeQuestionIds (   $questionIds)
private

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

References assQuestion\_instantiateQuestion().

Referenced by purge().

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  }
static _instantiateQuestion($question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIgnoredContainerObjectTypes()

ilAssIncompleteQuestionPurger::setIgnoredContainerObjectTypes (   $ignoredContainerObjectTypes)
protected

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

References $ignoredContainerObjectTypes.

81  {
82  $this->ignoredContainerObjectTypes = $ignoredContainerObjectTypes;
83  }

◆ setOwnerId()

ilAssIncompleteQuestionPurger::setOwnerId (   $ownerId)

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

References $ownerId.

35  {
36  $this->ownerId = $ownerId;
37  }

Field Documentation

◆ $db

ilAssIncompleteQuestionPurger::$db
protected

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

Referenced by __construct().

◆ $ignoredContainerObjectTypes

ilAssIncompleteQuestionPurger::$ignoredContainerObjectTypes
private

◆ $ownerId

ilAssIncompleteQuestionPurger::$ownerId
protected

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

Referenced by getOwnerId(), and setOwnerId().


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