ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDynamicTestQuestionChangeListener Class Reference
+ Inheritance diagram for ilDynamicTestQuestionChangeListener:
+ Collaboration diagram for ilDynamicTestQuestionChangeListener:

Public Member Functions

 __construct (ilDBInterface $db)
 
 addTestObjId ($testObjId)
 
 getTestObjIds ()
 
 notifyQuestionCreated (assQuestion $question)
 
 notifyQuestionEdited (assQuestion $question)
 
 notifyQuestionDeleted (assQuestion $question)
 
 notifyQuestionCreated (assQuestion $question)
 
 notifyQuestionEdited (assQuestion $question)
 
 notifyQuestionDeleted (assQuestion $question)
 

Protected Attributes

 $db = null
 

Private Member Functions

 deleteTestsParticipantsQuestionData (assQuestion $question)
 
 deleteTestsParticipantsResultsForQuestion ($activeIds, $questionId)
 
 deleteTestsParticipantsTrackingsForQuestion ($activeIds, $questionId)
 
 getActiveIds ()
 

Private Attributes

 $testObjIds = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDynamicTestQuestionChangeListener::__construct ( ilDBInterface  $db)
Parameters
ilDBInterface$db

Definition at line 24 of file class.ilDynamicTestQuestionChangeListener.php.

References $db.

Member Function Documentation

◆ addTestObjId()

ilDynamicTestQuestionChangeListener::addTestObjId (   $testObjId)
Parameters
integer$testObjId

Definition at line 37 of file class.ilDynamicTestQuestionChangeListener.php.

38 {
39 $this->testObjIds[] = $testObjId;
40 }

◆ deleteTestsParticipantsQuestionData()

ilDynamicTestQuestionChangeListener::deleteTestsParticipantsQuestionData ( assQuestion  $question)
private
Parameters
assQuestion$question

Definition at line 77 of file class.ilDynamicTestQuestionChangeListener.php.

78 {
79 $activeIds = $this->getActiveIds();
80
81 if (!is_array($activeIds) || 0 === count($activeIds)) {
82 return null;
83 }
84
85 $this->deleteTestsParticipantsResultsForQuestion($activeIds, $question->getId());
86 $this->deleteTestsParticipantsTrackingsForQuestion($activeIds, $question->getId());
87 }
getId()
Gets the id of the assQuestion object.

References deleteTestsParticipantsResultsForQuestion(), deleteTestsParticipantsTrackingsForQuestion(), getActiveIds(), and assQuestion\getId().

Referenced by notifyQuestionDeleted(), and notifyQuestionEdited().

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

◆ deleteTestsParticipantsResultsForQuestion()

ilDynamicTestQuestionChangeListener::deleteTestsParticipantsResultsForQuestion (   $activeIds,
  $questionId 
)
private

Definition at line 89 of file class.ilDynamicTestQuestionChangeListener.php.

90 {
91 $inActiveIds = $this->db->in('active_fi', $activeIds, false, 'integer');
92
93 $this->db->manipulateF(
94 "DELETE FROM tst_solutions WHERE question_fi = %s AND $inActiveIds",
95 array('integer'),
96 array($questionId)
97 );
98
99 $this->db->manipulateF(
100 "DELETE FROM tst_qst_solved WHERE question_fi = %s AND $inActiveIds",
101 array('integer'),
102 array($questionId)
103 );
104
105 $this->db->manipulateF(
106 "DELETE FROM tst_test_result WHERE question_fi = %s AND $inActiveIds",
107 array('integer'),
108 array($questionId)
109 );
110
111 $this->db->manipulate("DELETE FROM tst_pass_result WHERE $inActiveIds");
112
113 $this->db->manipulate("DELETE FROM tst_result_cache WHERE $inActiveIds");
114 }

Referenced by deleteTestsParticipantsQuestionData().

+ Here is the caller graph for this function:

◆ deleteTestsParticipantsTrackingsForQuestion()

ilDynamicTestQuestionChangeListener::deleteTestsParticipantsTrackingsForQuestion (   $activeIds,
  $questionId 
)
private

Definition at line 116 of file class.ilDynamicTestQuestionChangeListener.php.

117 {
118 $inActiveIds = $this->db->in('active_fi', $activeIds, false, 'integer');
119
120 $tables = array(
121 'tst_seq_qst_tracking', 'tst_seq_qst_answstatus', 'tst_seq_qst_postponed', 'tst_seq_qst_checked'
122 );
123
124 foreach ($tables as $table) {
125 $this->db->manipulateF(
126 "DELETE FROM $table WHERE question_fi = %s AND $inActiveIds",
127 array('integer'),
128 array($questionId)
129 );
130 }
131 }
if(empty($password)) $table
Definition: pwgen.php:24

References $table.

Referenced by deleteTestsParticipantsQuestionData().

+ Here is the caller graph for this function:

◆ getActiveIds()

ilDynamicTestQuestionChangeListener::getActiveIds ( )
private

Definition at line 133 of file class.ilDynamicTestQuestionChangeListener.php.

134 {
135 if (!count($this->getTestObjIds())) {
136 return null;
137 }
138
139 $inTestObjIds = $this->db->in('obj_fi', $this->getTestObjIds(), false, 'integer');
140
141 $res = $this->db->query("
142 SELECT active_id
143 FROM tst_tests
144 INNER JOIN tst_active
145 ON test_fi = test_id
146 WHERE $inTestObjIds
147 ");
148
149 $activeIds = array();
150
151 while ($row = $this->db->fetchAssoc($res)) {
152 $activeIds[] = $row['active_id'];
153 }
154
155 return $activeIds;
156 }
$row
foreach($_POST as $key=> $value) $res

References $res, $row, and getTestObjIds().

Referenced by deleteTestsParticipantsQuestionData().

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

◆ getTestObjIds()

ilDynamicTestQuestionChangeListener::getTestObjIds ( )
Returns
array[integer]

Definition at line 45 of file class.ilDynamicTestQuestionChangeListener.php.

References $testObjIds.

Referenced by getActiveIds().

+ Here is the caller graph for this function:

◆ notifyQuestionCreated()

ilDynamicTestQuestionChangeListener::notifyQuestionCreated ( assQuestion  $question)
Parameters
assQuestion$question

Implements ilQuestionChangeListener.

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

54 {
55 //mail('bheyser@databay.de', __METHOD__, __METHOD__);
56 // nothing to do
57 }

◆ notifyQuestionDeleted()

ilDynamicTestQuestionChangeListener::notifyQuestionDeleted ( assQuestion  $question)
Parameters
assQuestion$question

Implements ilQuestionChangeListener.

Definition at line 68 of file class.ilDynamicTestQuestionChangeListener.php.

69 {
70 //mail('bheyser@databay.de', __METHOD__, __METHOD__);
72 }

References deleteTestsParticipantsQuestionData().

+ Here is the call graph for this function:

◆ notifyQuestionEdited()

ilDynamicTestQuestionChangeListener::notifyQuestionEdited ( assQuestion  $question)
Parameters
assQuestion$question

Implements ilQuestionChangeListener.

Definition at line 62 of file class.ilDynamicTestQuestionChangeListener.php.

63 {
64 //mail('bheyser@databay.de', __METHOD__, __METHOD__);
66 }

References deleteTestsParticipantsQuestionData().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDynamicTestQuestionChangeListener::$db = null
protected

Definition at line 19 of file class.ilDynamicTestQuestionChangeListener.php.

Referenced by __construct().

◆ $testObjIds

ilDynamicTestQuestionChangeListener::$testObjIds = array()
private

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

Referenced by getTestObjIds().


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