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');
66 case 'RandomQuestionSetConfig':
67 $this->inRandomQuestionSetConfig =
true;
70 case 'RandomQuestionSetSettings':
71 if ($this->inRandomQuestionSetConfig) {
72 $this->inRandomQuestionSetSettings =
true;
74 $this->attr = $tagAttributes;
78 case 'RandomQuestionStage':
79 if ($this->inRandomQuestionSetConfig) {
80 $this->inRandomQuestionStage =
true;
84 case 'RandomQuestionStagingPool':
85 if ($this->inRandomQuestionStage) {
87 $this->attr = $tagAttributes;
91 case 'RandomQuestionSelectionDefinitions':
92 if ($this->inRandomQuestionSetConfig) {
93 $this->inRandomQuestionSelectionDefinitions =
true;
97 case 'RandomQuestionSelectionDefinition':
98 if ($this->inRandomQuestionSelectionDefinitions) {
100 $this->attr = $tagAttributes;
104 case 'RandomQuestionSourcePoolTitle':
105 case 'RandomQuestionSourcePoolPath':
116 case 'RandomQuestionSetConfig':
117 $this->inRandomQuestionSetConfig =
false;
120 case 'RandomQuestionSetSettings':
121 if ($this->inRandomQuestionSetConfig) {
127 case 'RandomQuestionStage':
128 if ($this->inRandomQuestionSetConfig) {
129 $this->inRandomQuestionStage =
false;
133 case 'RandomQuestionStagingPool':
134 if ($this->inRandomQuestionSetConfig && $this->inRandomQuestionStage) {
141 case 'RandomQuestionSelectionDefinitions':
142 if ($this->inRandomQuestionSetConfig) {
143 $this->inRandomQuestionSelectionDefinitions =
false;
147 case 'RandomQuestionSelectionDefinition':
148 if ($this->inRandomQuestionSetConfig && $this->inRandomQuestionSelectionDefinitions) {
150 $this->sourcePoolDefinition->saveToDb();
156 $this->sourcePoolDefinition->getId()
159 $this->sourcePoolDefinition = null;
164 case 'RandomQuestionSourcePoolTitle':
166 $this->sourcePoolDefinition->setPoolTitle($this->cdata);
171 case 'RandomQuestionSourcePoolPath':
172 if ($this->sourcePoolDefinition instanceof ilTestRandomQuestionSetSourcePoolDefinition) {
173 $this->sourcePoolDefinition->setPoolPath($this->cdata);
182 if ($charData !=
"\n") {
184 $charData = preg_replace(
"/\t+/",
" ", $charData);
186 $this->cdata .= $charData;
192 global $tree,
$ilDB, $ilPluginAdmin;
194 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetConfig.php';
197 if (!$questionSetConfig->isValidQuestionAmountConfigurationMode($attr[
'amountMode'])) {
198 require_once
'Modules/Test/exceptions/class.ilTestException.php';
200 'invalid random test question set config amount mode given: "' . $attr[
'amountMode'] .
'"' 204 $questionSetConfig->setQuestionAmountConfigurationMode($attr[
'amountMode']);
205 $questionSetConfig->setQuestionAmountPerTest((
int) $attr[
'questAmount']);
206 $questionSetConfig->setPoolsWithHomogeneousScoredQuestionsRequired((
bool) $attr[
'homogeneous']);
207 $questionSetConfig->setLastQuestionSyncTimestamp((
int) $attr[
'synctimestamp']);
209 $questionSetConfig->saveToDb();
216 $oldPoolId = $attr[
'poolId'];
217 $newPoolId = $ilDB->nextId(
'object_data');
226 $oldQuestionIds = explode(
',', $cdata);
228 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestion.php';
230 foreach ($oldQuestionIds as $oldQuestionId) {
238 $stagingQuestion->setTestId($this->testOBJ->getTestId());
239 $stagingQuestion->setPoolId($newPoolId);
240 $stagingQuestion->setQuestionId($newQuestionId);
242 $stagingQuestion->saveQuestionStaging();
250 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinition.php';
260 (
int) $attr[
'poolId']
268 if (isset($attr[
'tax']) && isset($attr[
'taxNode'])) {
269 $mappedTaxFilter =
array(
270 (
int) $attr[
'tax'] =>
array(
271 (
int) $attr[
'taxNode']
275 } elseif (isset($attr[
'taxFilter']) && strlen($attr[
'taxFilter']) > 0) {
276 $mappedTaxFilter = unserialize($attr[
'taxFilter']);
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 ...
setMappedTaxonomyFilter($filter=array())
set the original taxonomy filter condition
setPoolQuestionCount($poolQuestionCount)
getRandomQuestionSourcePoolDefinitionInstance()
handlerBeginTag($xmlParser, $tagName, $tagAttributes)
Create styles array
The data for the language used.
importRandomQuestionStagingPool($attr, $cdata)
setSequencePosition($sequencePosition)
importRandomQuestionSourcePoolDefinition(ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition, $attr)
handlerEndTag($xmlParser, $tagName)
handlerCharacterData($xmlParser, $charData)