ILIAS  release_4-4 Revision
ilDynamicTestQuestionChangeListener Class Reference
+ Inheritance diagram for ilDynamicTestQuestionChangeListener:
+ Collaboration diagram for ilDynamicTestQuestionChangeListener:

Public Member Functions

 __construct (ilDB $db)
 
 addTestObjId ($testObjId)
 
 getTestObjIds ()
 
 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 ( ilDB  $db)
Parameters
ilDB$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.

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

Referenced by notifyQuestionDeleted(), and notifyQuestionEdited().

78  {
79  $activeIds = $this->getActiveIds();
80 
81  if( !count($activeIds) )
82  {
83  return null;
84  }
85 
86  $this->deleteTestsParticipantsResultsForQuestion($activeIds, $question->getId());
87  $this->deleteTestsParticipantsTrackingsForQuestion($activeIds, $question->getId());
88 
89  }
getId()
Gets the id of the assQuestion object.
+ 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 91 of file class.ilDynamicTestQuestionChangeListener.php.

Referenced by deleteTestsParticipantsQuestionData().

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

◆ deleteTestsParticipantsTrackingsForQuestion()

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

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

Referenced by deleteTestsParticipantsQuestionData().

116  {
117  $inActiveIds = $this->db->in('active_fi', $activeIds, false, 'integer');
118 
119  $tables = array(
120  'tst_seq_qst_tracking', 'tst_seq_qst_answstatus', 'tst_seq_qst_postponed', 'tst_seq_qst_checked'
121  );
122 
123  foreach($tables as $table)
124  {
125  $this->db->manipulateF(
126  "DELETE FROM $table WHERE question_fi = %s AND $inActiveIds",
127  array('integer'), array($questionId)
128  );
129  }
130  }
+ Here is the caller graph for this function:

◆ getActiveIds()

ilDynamicTestQuestionChangeListener::getActiveIds ( )
private

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

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

Referenced by deleteTestsParticipantsQuestionData().

133  {
134  if( !count($this->getTestObjIds()) )
135  {
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  {
153  $activeIds[] = $row['active_id'];
154  }
155 
156  return $activeIds;
157  }
+ 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.

References deleteTestsParticipantsQuestionData().

69  {
70  //mail('bheyser@databay.de', __METHOD__, __METHOD__);
71  $this->deleteTestsParticipantsQuestionData($question);
72  }
+ 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.

References deleteTestsParticipantsQuestionData().

63  {
64  //mail('bheyser@databay.de', __METHOD__, __METHOD__);
65  $this->deleteTestsParticipantsQuestionData($question);
66  }
+ 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: