19 declare(strict_types=1);
40 $src_pool_def_factory = new \ilTestRandomQuestionSetSourcePoolDefinitionFactory(
45 $this->src_pool_def_list = new \ilTestRandomQuestionSetSourcePoolDefinitionList(
51 $this->src_pool_def_list->loadDefinitions();
54 $this->staging_pool_question_list_by_pool_id = [];
59 $xml_writer->
xmlStartTag(
'RandomQuestionSetConfig');
63 $xml_writer->
xmlEndTag(
'RandomQuestionSetConfig');
68 $question_set_config = new \ilTestRandomQuestionSetConfig(
73 $this->component_repository,
75 $this->questionrepository
77 $question_set_config->loadFromDb();
79 $xml_writer->
xmlElement(
'RandomQuestionSetSettings', [
80 'amountMode' => $question_set_config->getQuestionAmountConfigurationMode(),
81 'questAmount' => $question_set_config->getQuestionAmountPerTest(),
82 'homogeneous' => $question_set_config->arePoolsWithHomogeneousScoredQuestionsRequired(),
83 'synctimestamp' => $question_set_config->getLastQuestionSyncTimestamp()
91 foreach ($this->src_pool_def_list->getInvolvedSourcePoolIds() as $pool_id) {
94 $xml_writer->
xmlStartTag(
'RandomQuestionStagingPool', [
'poolId' => $pool_id]);
95 $xml_writer->
xmlData(implode(
',', $question_list->getQuestions()));
96 $xml_writer->
xmlEndTag(
'RandomQuestionStagingPool');
99 $xml_writer->
xmlEndTag(
'RandomQuestionStage');
104 $xml_writer->
xmlStartTag(
'RandomQuestionSelectionDefinitions');
106 foreach ($this->src_pool_def_list as $definition) {
108 'id' => $definition->getId(),
109 'ref_id' => $definition->getPoolRefId(),
110 'poolId' => $definition->getPoolId(),
111 'questAmount' => $definition->getQuestionAmount() ??
'',
112 'poolQuestCount' => $definition->getPoolQuestionCount(),
113 'position' => $definition->getSequencePosition(),
114 'typeFilter' => implode(
',', $definition->getTypeFilterAsTypeTags()),
119 $mappedTaxFilter = $definition->getMappedTaxonomyFilter();
120 if (is_array($mappedTaxFilter) && count($mappedTaxFilter) > 0) {
121 $attributes[
'taxFilter'] = serialize($mappedTaxFilter);
124 $xml_writer->
xmlStartTag(
'RandomQuestionSelectionDefinition', $attributes);
125 $xml_writer->
xmlElement(
'RandomQuestionSourcePoolTitle',
null, $definition->getPoolTitle());
126 $xml_writer->
xmlElement(
'RandomQuestionSourcePoolPath',
null, $definition->getPoolPath());
127 $xml_writer->
xmlEndTag(
'RandomQuestionSelectionDefinition');
130 $xml_writer->
xmlEndTag(
'RandomQuestionSelectionDefinitions');
135 $question_qti_xml =
'';
137 foreach ($this->src_pool_def_list->getInvolvedSourcePoolIds() as $pool_id) {
140 foreach ($question_list as $question_id) {
145 return $question_qti_xml;
155 foreach ($this->src_pool_def_list->getInvolvedSourcePoolIds() as $pool_id) {
158 foreach ($question_list as $question_id) {
159 $question_ids[] = $question_id;
163 return $question_ids;
168 if (!isset($this->staging_pool_question_list_by_pool_id[$pool_id])) {
169 $question_list = new \ilTestRandomQuestionSetStagingPoolQuestionList($this->db, $this->component_repository);
170 $question_list->setTestId($this->test_obj->getTestId());
171 $question_list->setPoolId($pool_id);
172 $question_list->loadQuestions();
174 $this->staging_pool_question_list_by_pool_id[$pool_id] = $question_list;
177 return $this->staging_pool_question_list_by_pool_id[$pool_id];
getQuestionQtiXml(int $question_id)
ilTestRandomQuestionSetSourcePoolDefinitionList $src_pool_def_list
xmlData(string $data, bool $encode=true, bool $escape=true)
Writes data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
populateQuestionSetConfigXml(\ilXmlWriter $xml_writer)
populateSelectionDefinitions(\ilXmlWriter $xml_writer)
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
populateQuestionStages(\ilXmlWriter $xml_writer)
$staging_pool_question_list_by_pool_id
populateCommonSettings(\ilXmlWriter $xml_writer)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
getLoadedStagingPoolQuestionList(int $pool_id)
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)