ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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
 

Additional Inherited Members

- Public Member Functions inherited from ilTestExport
 __construct (&$a_test_obj, $a_mode="xml")
 Constructor. More...
 
 isResultExportingEnabledForTestExport ()
 
 setResultExportingEnabledForTestExport ($resultExprtingEnabledForTestExport)
 
 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 12 of file class.ilTestExportRandomQuestionSet.php.

Member Function Documentation

◆ getLoadedStagingPoolQuestionList()

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

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

References $ilDB.

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

159  {
160  if (!isset($this->stagingPoolQuestionListByPoolId[$poolId])) {
161  global $ilDB, $ilPluginAdmin;
162 
163  $questionList = new ilTestRandomQuestionSetStagingPoolQuestionList($ilDB, $ilPluginAdmin);
164  $questionList->setTestId($this->test_obj->getTestId());
165  $questionList->setPoolId($poolId);
166  $questionList->loadQuestions();
167 
168  $this->stagingPoolQuestionListByPoolId[$poolId] = $questionList;
169  }
170 
171  return $this->stagingPoolQuestionListByPoolId[$poolId];
172  }
global $ilDB
+ Here is the caller graph for this function:

◆ getQuestionIds()

ilTestExportRandomQuestionSet::getQuestionIds ( )
protected
Returns
array

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

References array, and getLoadedStagingPoolQuestionList().

Referenced by initXmlExport().

140  {
141  $questionIds = array();
142 
143  foreach ($this->srcPoolDefList->getInvolvedSourcePoolIds() as $poolId) {
144  $questionList = $this->getLoadedStagingPoolQuestionList($poolId);
145 
146  foreach ($questionList as $questionId) {
147  $questionIds[] = $questionId;
148  }
149  }
150 
151  return $questionIds;
152  }
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:

◆ getQuestionsQtiXml()

ilTestExportRandomQuestionSet::getQuestionsQtiXml ( )
protected

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

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

122  {
123  $questionQtiXml = '';
124 
125  foreach ($this->srcPoolDefList->getInvolvedSourcePoolIds() as $poolId) {
126  $questionList = $this->getLoadedStagingPoolQuestionList($poolId);
127 
128  foreach ($questionList as $questionId) {
129  $questionQtiXml .= $this->getQuestionQtiXml($questionId);
130  }
131  }
132 
133  return $questionQtiXml;
134  }
getQuestionQtiXml($questionId)
+ Here is the call graph for this function:

◆ initXmlExport()

ilTestExportRandomQuestionSet::initXmlExport ( )
protected

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

References $ilDB, array, and getQuestionIds().

25  {
26  global $ilDB, $ilPluginAdmin;
27 
28  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
30  $ilDB,
31  $this->test_obj
32  );
33 
34  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
35  $this->srcPoolDefList = new ilTestRandomQuestionSetSourcePoolDefinitionList(
36  $ilDB,
37  $this->test_obj,
38  $srcPoolDefFactory
39  );
40 
41  $this->srcPoolDefList->loadDefinitions();
42 
43  // fau: fixRandomTestExportPages - use the complete random question list
44  // ilObjTest::exportPagesXML() uses $this->questions
45  // ilObjTest::loadQuestions() loads only those of the current active_id of ilUser
46  $this->test_obj->questions = $this->getQuestionIds();
47  // fau.
48  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
49 
50  $this->stagingPoolQuestionListByPoolId = array();
51  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ populateCommonSettings()

ilTestExportRandomQuestionSet::populateCommonSettings ( ilXmlWriter  $xmlWriter)
protected

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

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

Referenced by populateQuestionSetConfigXml().

63  {
64  global $tree, $ilDB, $ilPluginAdmin;
65 
66  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetConfig.php';
67  $questionSetConfig = new ilTestRandomQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->test_obj);
68  $questionSetConfig->loadFromDb();
69 
70  $xmlWriter->xmlElement('RandomQuestionSetSettings', array(
71  'amountMode' => $questionSetConfig->getQuestionAmountConfigurationMode(),
72  'questAmount' => $questionSetConfig->getQuestionAmountPerTest(),
73  'homogeneous' => $questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired(),
74  'synctimestamp' => $questionSetConfig->getLastQuestionSyncTimestamp()
75  ));
76  }
Create styles array
The data for the language used.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
global $ilDB
+ 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 53 of file class.ilTestExportRandomQuestionSet.php.

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

54  {
55  $xmlWriter->xmlStartTag('RandomQuestionSetConfig');
56  $this->populateCommonSettings($xmlWriter);
57  $this->populateQuestionStages($xmlWriter);
58  $this->populateSelectionDefinitions($xmlWriter);
59  $xmlWriter->xmlEndTag('RandomQuestionSetConfig');
60  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
+ Here is the call graph for this function:

◆ populateQuestionStages()

ilTestExportRandomQuestionSet::populateQuestionStages ( ilXmlWriter  $xmlWriter)
protected

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

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

Referenced by populateQuestionSetConfigXml().

79  {
80  $xmlWriter->xmlStartTag('RandomQuestionStage');
81 
82  foreach ($this->srcPoolDefList->getInvolvedSourcePoolIds() as $poolId) {
83  $questionList = $this->getLoadedStagingPoolQuestionList($poolId);
84 
85  $xmlWriter->xmlStartTag('RandomQuestionStagingPool', array('poolId' => $poolId));
86  $xmlWriter->xmlData(implode(',', $questionList->getQuestions()));
87  $xmlWriter->xmlEndTag('RandomQuestionStagingPool');
88  }
89 
90  $xmlWriter->xmlEndTag('RandomQuestionStage');
91  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlData($data, $encode=true, $escape=true)
Writes data.
xmlEndTag($tag)
Writes an endtag.
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:

◆ populateSelectionDefinitions()

ilTestExportRandomQuestionSet::populateSelectionDefinitions ( ilXmlWriter  $xmlWriter)
protected

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

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

Referenced by populateQuestionSetConfigXml().

94  {
95  $xmlWriter->xmlStartTag('RandomQuestionSelectionDefinitions');
96 
97  foreach ($this->srcPoolDefList as $definition) {
99  'id' => $definition->getId(),
100  'poolId' => $definition->getPoolId(),
101  'poolQuestCount' => $definition->getPoolQuestionCount(),
102  'questAmount' => $definition->getQuestionAmount(),
103  'position' => $definition->getSequencePosition()
104  );
105 
106  // #21330
107  $mappedTaxFilter = $definition->getMappedTaxonomyFilter();
108  if (is_array($mappedTaxFilter) && count($mappedTaxFilter) > 0) {
109  $attributes['taxFilter'] = serialize($mappedTaxFilter);
110  }
111 
112  $xmlWriter->xmlStartTag('RandomQuestionSelectionDefinition', $attributes);
113  $xmlWriter->xmlElement('RandomQuestionSourcePoolTitle', null, $definition->getPoolTitle());
114  $xmlWriter->xmlElement('RandomQuestionSourcePoolPath', null, $definition->getPoolPath());
115  $xmlWriter->xmlEndTag('RandomQuestionSelectionDefinition');
116  }
117 
118  $xmlWriter->xmlEndTag('RandomQuestionSelectionDefinitions');
119  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
$attributes
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
xmlElement($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 17 of file class.ilTestExportRandomQuestionSet.php.

◆ $stagingPoolQuestionListByPoolId

ilTestExportRandomQuestionSet::$stagingPoolQuestionListByPoolId
protected

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


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