ILIAS  release_8 Revision v8.23
ilTestExportRandomQuestionSet Class Reference
+ Inheritance diagram for ilTestExportRandomQuestionSet:
+ Collaboration diagram for ilTestExportRandomQuestionSet:

Protected Member Functions

 initXmlExport ()
 
 populateQuestionSetConfigXml (ilXmlWriter $xmlWriter)
 
 populateCommonSettings (ilXmlWriter $xmlWriter)
 
 populateQuestionStages (ilXmlWriter $xmlWriter)
 
 populateSelectionDefinitions (ilXmlWriter $xmlWriter)
 
 getQuestionsQtiXml ()
 
 getQuestionIds ()
 
 getLoadedStagingPoolQuestionList ($poolId)
 
- Protected Member Functions inherited from ilTestExport
 aggregatedResultsToExcel ($deliver=true)
 Exports the aggregated results to the Microsoft Excel file format. More...
 
 aggregatedResultsToCSV ($deliver=true)
 Exports the aggregated results to CSV. More...
 
 orderQuestions (array $questions)
 
 initXmlExport ()
 
 getQuestionIds ()
 
 populateQuestionSetConfigXml (ilXmlWriter $xmlWriter)
 
 getQtiXml ()
 
 getQuestionsQtiXml ()
 
 getQuestionQtiXml ($questionId)
 
 populateQuestionSkillAssignmentsXml (ilXmlWriter $a_xml_writer, ilAssQuestionSkillAssignmentList $assignmentList, $questions)
 
 populateSkillLevelThresholdsXml (ilXmlWriter $a_xml_writer, ilAssQuestionSkillAssignmentList $assignmentList)
 
 buildQuestionSkillAssignmentList ()
 

Protected Attributes

 $srcPoolDefList
 
 $stagingPoolQuestionListByPoolId
 
- Protected Attributes inherited from ilTestExport
 $resultExportingEnabledForTestExport = false
 
 $forcedAccessFilteredParticipantList = null
 

Additional Inherited Members

- Public Member Functions inherited from ilTestExport
 __construct (&$a_test_obj, $a_mode="xml")
 Constructor. More...
 
 isResultExportingEnabledForTestExport ()
 
 setResultExportingEnabledForTestExport ($resultExprtingEnabledForTestExport)
 
 getForcedAccessFilteredParticipantList ()
 
 setForcedAccessFilteredParticipantList (ilTestParticipantList $forcedAccessFilteredParticipantList)
 
 getAccessFilteredParticipantList ()
 
 getExtension ()
 
 getInstId ()
 
 buildExportFile ()
 build export file (complete zip file) More...
 
 buildExportResultFile ()
 build xml export file More...
 
 exportToExcel ($deliver=true, $filterby="", $filtertext="", $passedonly=false)
 Exports the evaluation data to the Microsoft Excel file format. More...
 
 exportToCSV ($deliver=true, $filterby="", $filtertext="", $passedonly=false)
 Exports the evaluation data to the CSV file format. More...
 
 buildExportFileXML ()
 build xml export file More...
 
 exportXHTMLMediaObjects ($a_export_dir)
 
- Data Fields inherited from ilTestExport
 $err
 
 $db
 
 $ilias
 
 $test_obj
 
 $inst_id
 
 $mode
 

Detailed Description

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

Member Function Documentation

◆ getLoadedStagingPoolQuestionList()

ilTestExportRandomQuestionSet::getLoadedStagingPoolQuestionList (   $poolId)
protected
Parameters
$poolId
Returns
ilTestRandomQuestionSetStagingPoolQuestionList

Definition at line 178 of file class.ilTestExportRandomQuestionSet.php.

References $DIC, and $ilDB.

Referenced by getQuestionIds(), getQuestionsQtiXml(), and populateQuestionStages().

179  {
180  if (!isset($this->stagingPoolQuestionListByPoolId[$poolId])) {
181  global $DIC;
182  $ilDB = $DIC['ilDB'];
183  $component_repository = $DIC['component.repository'];
184 
185  $questionList = new ilTestRandomQuestionSetStagingPoolQuestionList($ilDB, $component_repository);
186  $questionList->setTestId($this->test_obj->getTestId());
187  $questionList->setPoolId($poolId);
188  $questionList->loadQuestions();
189 
190  $this->stagingPoolQuestionListByPoolId[$poolId] = $questionList;
191  }
192 
193  return $this->stagingPoolQuestionListByPoolId[$poolId];
194  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getQuestionIds()

ilTestExportRandomQuestionSet::getQuestionIds ( )
protected
Returns
array

Definition at line 159 of file class.ilTestExportRandomQuestionSet.php.

References getLoadedStagingPoolQuestionList().

Referenced by initXmlExport().

159  : array
160  {
161  $questionIds = array();
162 
163  foreach ($this->srcPoolDefList->getInvolvedSourcePoolIds() as $poolId) {
164  $questionList = $this->getLoadedStagingPoolQuestionList($poolId);
165 
166  foreach ($questionList as $questionId) {
167  $questionIds[] = $questionId;
168  }
169  }
170 
171  return $questionIds;
172  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionsQtiXml()

ilTestExportRandomQuestionSet::getQuestionsQtiXml ( )
protected

Definition at line 141 of file class.ilTestExportRandomQuestionSet.php.

References getLoadedStagingPoolQuestionList(), and ilTestExport\getQuestionQtiXml().

141  : string
142  {
143  $questionQtiXml = '';
144 
145  foreach ($this->srcPoolDefList->getInvolvedSourcePoolIds() as $poolId) {
146  $questionList = $this->getLoadedStagingPoolQuestionList($poolId);
147 
148  foreach ($questionList as $questionId) {
149  $questionQtiXml .= $this->getQuestionQtiXml($questionId);
150  }
151  }
152 
153  return $questionQtiXml;
154  }
getQuestionQtiXml($questionId)
+ Here is the call graph for this function:

◆ initXmlExport()

ilTestExportRandomQuestionSet::initXmlExport ( )
protected

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

References $DIC, $ilDB, and getQuestionIds().

38  {
39  global $DIC;
40  $ilDB = $DIC['ilDB'];
41  $component_repository = $DIC['component.repository'];
42 
43  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
45  $ilDB,
46  $this->test_obj
47  );
48 
49  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
50  $this->srcPoolDefList = new ilTestRandomQuestionSetSourcePoolDefinitionList(
51  $ilDB,
52  $this->test_obj,
53  $srcPoolDefFactory
54  );
55 
56  $this->srcPoolDefList->loadDefinitions();
57 
58  // fau: fixRandomTestExportPages - use the complete random question list
59  // ilObjTest::exportPagesXML() uses $this->questions
60  // ilObjTest::loadQuestions() loads only those of the current active_id of ilUser
61  $this->test_obj->questions = $this->getQuestionIds();
62  // fau.
63  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
64 
65  $this->stagingPoolQuestionListByPoolId = array();
66  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ populateCommonSettings()

ilTestExportRandomQuestionSet::populateCommonSettings ( ilXmlWriter  $xmlWriter)
protected

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

References $DIC, $ilDB, and ilXmlWriter\xmlElement().

Referenced by populateQuestionSetConfigXml().

78  {
79  global $DIC;
80  $tree = $DIC['tree'];
81  $ilDB = $DIC['ilDB'];
82  $component_repository = $DIC['component.repository'];
83 
84  $questionSetConfig = new ilTestRandomQuestionSetConfig($tree, $ilDB, $component_repository, $this->test_obj);
85  $questionSetConfig->loadFromDb();
86 
87  $xmlWriter->xmlElement('RandomQuestionSetSettings', array(
88  'amountMode' => $questionSetConfig->getQuestionAmountConfigurationMode(),
89  'questAmount' => $questionSetConfig->getQuestionAmountPerTest(),
90  'homogeneous' => $questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired(),
91  'synctimestamp' => $questionSetConfig->getLastQuestionSyncTimestamp()
92  ));
93  }
global $DIC
Definition: feed.php:28
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateQuestionSetConfigXml()

ilTestExportRandomQuestionSet::populateQuestionSetConfigXml ( ilXmlWriter  $xmlWriter)
protected

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

References populateCommonSettings(), populateQuestionStages(), populateSelectionDefinitions(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

69  {
70  $xmlWriter->xmlStartTag('RandomQuestionSetConfig');
71  $this->populateCommonSettings($xmlWriter);
72  $this->populateQuestionStages($xmlWriter);
73  $this->populateSelectionDefinitions($xmlWriter);
74  $xmlWriter->xmlEndTag('RandomQuestionSetConfig');
75  }
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:

◆ populateQuestionStages()

ilTestExportRandomQuestionSet::populateQuestionStages ( ilXmlWriter  $xmlWriter)
protected

Definition at line 95 of file class.ilTestExportRandomQuestionSet.php.

References getLoadedStagingPoolQuestionList(), ilXmlWriter\xmlData(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by populateQuestionSetConfigXml().

96  {
97  $xmlWriter->xmlStartTag('RandomQuestionStage');
98 
99  foreach ($this->srcPoolDefList->getInvolvedSourcePoolIds() as $poolId) {
100  $questionList = $this->getLoadedStagingPoolQuestionList($poolId);
101 
102  $xmlWriter->xmlStartTag('RandomQuestionStagingPool', array('poolId' => $poolId));
103  $xmlWriter->xmlData(implode(',', $questionList->getQuestions()));
104  $xmlWriter->xmlEndTag('RandomQuestionStagingPool');
105  }
106 
107  $xmlWriter->xmlEndTag('RandomQuestionStage');
108  }
xmlData(string $data, bool $encode=true, bool $escape=true)
Writes data.
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateSelectionDefinitions()

ilTestExportRandomQuestionSet::populateSelectionDefinitions ( ilXmlWriter  $xmlWriter)
protected

Definition at line 110 of file class.ilTestExportRandomQuestionSet.php.

References $attributes, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by populateQuestionSetConfigXml().

111  {
112  $xmlWriter->xmlStartTag('RandomQuestionSelectionDefinitions');
113 
114  foreach ($this->srcPoolDefList as $definition) {
115  $attributes = array(
116  'id' => $definition->getId(),
117  'ref_id' => $definition->getPoolRefId(),
118  'poolId' => $definition->getPoolId(),
119  'questAmount' => $definition->getQuestionAmount() ?? '',
120  'poolQuestCount' => $definition->getPoolQuestionCount(),
121  'position' => $definition->getSequencePosition(),
122  'typeFilter' => implode(',', $definition->getTypeFilterAsTypeTags()),
123  );
124 
125 
126  // #21330
127  $mappedTaxFilter = $definition->getMappedTaxonomyFilter();
128  if (is_array($mappedTaxFilter) && count($mappedTaxFilter) > 0) {
129  $attributes['taxFilter'] = serialize($mappedTaxFilter);
130  }
131 
132  $xmlWriter->xmlStartTag('RandomQuestionSelectionDefinition', $attributes);
133  $xmlWriter->xmlElement('RandomQuestionSourcePoolTitle', null, $definition->getPoolTitle());
134  $xmlWriter->xmlElement('RandomQuestionSourcePoolPath', null, $definition->getPoolPath());
135  $xmlWriter->xmlEndTag('RandomQuestionSelectionDefinition');
136  }
137 
138  $xmlWriter->xmlEndTag('RandomQuestionSelectionDefinitions');
139  }
$attributes
Definition: metadata.php:248
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $srcPoolDefList

ilTestExportRandomQuestionSet::$srcPoolDefList
protected

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

◆ $stagingPoolQuestionListByPoolId

ilTestExportRandomQuestionSet::$stagingPoolQuestionListByPoolId
protected

Definition at line 35 of file class.ilTestExportRandomQuestionSet.php.


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