4 require_once
'Services/Xml/classes/class.ilSaxParser.php';
58 xml_set_object($xmlParser,$this);
59 xml_set_element_handler($xmlParser,
'handlerBeginTag',
'handlerEndTag');
60 xml_set_character_data_handler($xmlParser,
'handlerCharacterData');
67 case 'RandomQuestionSetConfig':
68 $this->inRandomQuestionSetConfig =
true;
71 case 'RandomQuestionSetSettings':
72 if($this->inRandomQuestionSetConfig)
74 $this->inRandomQuestionSetSettings =
true;
76 $this->attr = $tagAttributes;
80 case 'RandomQuestionStage':
81 if($this->inRandomQuestionSetConfig)
83 $this->inRandomQuestionStage =
true;
87 case 'RandomQuestionStagingPool':
88 if($this->inRandomQuestionStage)
91 $this->attr = $tagAttributes;
95 case 'RandomQuestionSelectionDefinitions':
96 if($this->inRandomQuestionSetConfig)
98 $this->inRandomQuestionSelectionDefinitions =
true;
102 case 'RandomQuestionSelectionDefinition':
103 if($this->inRandomQuestionSelectionDefinitions)
106 $this->attr = $tagAttributes;
110 case 'RandomQuestionSourcePoolTitle':
111 case 'RandomQuestionSourcePoolPath':
124 case 'RandomQuestionSetConfig':
125 $this->inRandomQuestionSetConfig =
false;
128 case 'RandomQuestionSetSettings':
129 if($this->inRandomQuestionSetConfig)
136 case 'RandomQuestionStage':
137 if($this->inRandomQuestionSetConfig)
139 $this->inRandomQuestionStage =
false;
143 case 'RandomQuestionStagingPool':
144 if($this->inRandomQuestionSetConfig && $this->inRandomQuestionStage)
152 case 'RandomQuestionSelectionDefinitions':
153 if($this->inRandomQuestionSetConfig)
155 $this->inRandomQuestionSelectionDefinitions =
false;
159 case 'RandomQuestionSelectionDefinition':
160 if($this->inRandomQuestionSetConfig && $this->inRandomQuestionSelectionDefinitions)
163 $this->sourcePoolDefinition->saveToDb();
166 'Modules/Test',
'rnd_src_pool_def', $this->attr[
'id'], $this->sourcePoolDefinition->getId()
169 $this->sourcePoolDefinition = null;
174 case 'RandomQuestionSourcePoolTitle':
177 $this->sourcePoolDefinition->setPoolTitle($this->cdata);
182 case 'RandomQuestionSourcePoolPath':
183 if($this->sourcePoolDefinition instanceof ilTestRandomQuestionSetSourcePoolDefinition)
185 $this->sourcePoolDefinition->setPoolPath($this->cdata);
194 if( $charData !=
"\n" )
197 $charData = preg_replace(
"/\t+/",
" ",$charData);
199 $this->cdata .= $charData;
205 global $tree,
$ilDB, $ilPluginAdmin;
207 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetConfig.php';
210 if( !$questionSetConfig->isValidQuestionAmountConfigurationMode($attr[
'amountMode']) )
212 require_once
'Modules/Test/exceptions/class.ilTestException.php';
214 'invalid random test question set config amount mode given: "'.$attr[
'amountMode'].
'"' 218 $questionSetConfig->setQuestionAmountConfigurationMode($attr[
'amountMode']);
219 $questionSetConfig->setQuestionAmountPerTest((
int)$attr[
'questAmount']);
220 $questionSetConfig->setPoolsWithHomogeneousScoredQuestionsRequired((
bool)$attr[
'homogeneous']);
222 $questionSetConfig->saveToDb();
229 $oldPoolId = $attr[
'poolId'];
230 $newPoolId = $ilDB->nextId(
'object_data');
233 'Modules/Test',
'pool', $oldPoolId, $newPoolId
236 $oldQuestionIds = explode(
',', $cdata);
238 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestion.php';
240 foreach($oldQuestionIds as $oldQuestionId)
243 'Modules/Test',
'quest', $oldQuestionId
247 $stagingQuestion->setTestId($this->testOBJ->getTestId());
248 $stagingQuestion->setPoolId($newPoolId);
249 $stagingQuestion->setQuestionId($newQuestionId);
251 $stagingQuestion->saveQuestionStaging();
259 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinition.php';
267 'Modules/Test',
'pool', (
int)$attr[
'poolId']
274 if( isset($attr[
'tax']) && isset($attr[
'taxNode']) )
setQuestionAmount($questionAmount)
setImportMapping($importMapping)
importRandomQuestionSetSettings($attr)
Base Exception for all Exceptions relating to Modules/Test.
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
setPoolQuestionCount($poolQuestionCount)
getRandomQuestionSourcePoolDefinitionInstance()
handlerBeginTag($xmlParser, $tagName, $tagAttributes)
setMappedFilterTaxId($mappedFilterTaxId)
importRandomQuestionStagingPool($attr, $cdata)
setSequencePosition($sequencePosition)
setMappedFilterTaxNodeId($mappedFilterTaxNodeId)
importRandomQuestionSourcePoolDefinition(ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition, $attr)
handlerEndTag($xmlParser, $tagName)
handlerCharacterData($xmlParser, $charData)