55 xml_set_object($a_xml_parser, $this);
56 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
57 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
63 case 'RandomQuestionSetConfig':
64 $this->inRandomQuestionSetConfig =
true;
67 case 'RandomQuestionSetSettings':
68 if ($this->inRandomQuestionSetConfig) {
69 $this->inRandomQuestionSetSettings =
true;
71 $this->attr = $tagAttributes;
75 case 'RandomQuestionStage':
76 if ($this->inRandomQuestionSetConfig) {
77 $this->inRandomQuestionStage =
true;
81 case 'RandomQuestionStagingPool':
82 if ($this->inRandomQuestionStage) {
84 $this->attr = $tagAttributes;
88 case 'RandomQuestionSelectionDefinitions':
89 if ($this->inRandomQuestionSetConfig) {
90 $this->inRandomQuestionSelectionDefinitions =
true;
94 case 'RandomQuestionSelectionDefinition':
95 if ($this->inRandomQuestionSelectionDefinitions) {
97 $this->attr = $tagAttributes;
101 case 'RandomQuestionSourcePoolTitle':
102 case 'RandomQuestionSourcePoolPath':
113 case 'RandomQuestionSetConfig':
114 $this->inRandomQuestionSetConfig =
false;
117 case 'RandomQuestionSetSettings':
118 if ($this->inRandomQuestionSetConfig) {
124 case 'RandomQuestionStage':
125 if ($this->inRandomQuestionSetConfig) {
126 $this->inRandomQuestionStage =
false;
130 case 'RandomQuestionStagingPool':
131 if ($this->inRandomQuestionSetConfig && $this->inRandomQuestionStage) {
138 case 'RandomQuestionSelectionDefinitions':
139 if ($this->inRandomQuestionSetConfig) {
140 $this->inRandomQuestionSelectionDefinitions =
false;
144 case 'RandomQuestionSelectionDefinition':
145 if ($this->inRandomQuestionSetConfig && $this->inRandomQuestionSelectionDefinitions) {
147 $this->sourcePoolDefinition->saveToDb();
153 $this->sourcePoolDefinition->getId()
156 $this->sourcePoolDefinition =
null;
161 case 'RandomQuestionSourcePoolTitle':
163 $this->sourcePoolDefinition->setPoolTitle($this->cdata);
168 case 'RandomQuestionSourcePoolPath':
170 $this->sourcePoolDefinition->setPoolPath($this->cdata);
179 if ($charData !=
"\n") {
181 $charData = preg_replace(
"/\t+/",
" ", $charData);
183 $this->cdata .= $charData;
190 $tree =
$DIC[
'tree'];
192 $component_repository =
$DIC[
'component.repository'];
195 if (!$questionSetConfig->isValidQuestionAmountConfigurationMode($attr[
'amountMode'])) {
197 'invalid random test question set config amount mode given: "' . $attr[
'amountMode'] .
'"'
201 $questionSetConfig->setQuestionAmountConfigurationMode($attr[
'amountMode']);
202 $questionSetConfig->setQuestionAmountPerTest((
int) $attr[
'questAmount']);
203 $questionSetConfig->setPoolsWithHomogeneousScoredQuestionsRequired((
bool) $attr[
'homogeneous']);
204 $questionSetConfig->setLastQuestionSyncTimestamp((
int) $attr[
'synctimestamp']);
206 $questionSetConfig->saveToDb();
214 $oldPoolId = $attr[
'poolId'];
215 $newPoolId =
$ilDB->nextId(
'object_data');
224 $oldQuestionIds = explode(
',',
$cdata);
226 foreach ($oldQuestionIds as $oldQuestionId) {
234 $stagingQuestion->setTestId($this->testOBJ->getTestId());
235 $stagingQuestion->setPoolId($newPoolId);
236 $stagingQuestion->setQuestionId($newQuestionId);
238 $stagingQuestion->saveQuestionStaging();
252 $source_pool_id = (
int) $attr[
'poolId'];
258 $sourcePoolDefinition->
setPoolId($effective_pool_id);
260 $derive_from_obj_id =
true;
262 if (isset($attr[
'ref_id']) && is_numeric($attr[
'ref_id'])) {
263 if ($source_pool_id === $effective_pool_id) {
264 $derive_from_obj_id =
false;
265 $sourcePoolDefinition->
setPoolRefId((
int) $attr[
'ref_id']);
269 if ($derive_from_obj_id) {
279 if (isset($attr[
'typeFilter']) && strlen($attr[
'typeFilter']) > 0) {
284 if (isset($attr[
'tax']) && isset($attr[
'taxNode'])) {
285 $mappedTaxFilter = array(
286 (
int) $attr[
'tax'] => array(
287 (
int) $attr[
'taxNode']
291 } elseif (isset($attr[
'taxFilter']) && strlen($attr[
'taxFilter']) > 0) {
292 $mappedTaxFilter = unserialize($attr[
'taxFilter'], [
'allowed_classes' =>
false]);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRandomQuestionSourcePoolDefinitionInstance()
importRandomQuestionStagingPool($attr, $cdata)
ilImportMapping $importMapping
handlerEndTag($xmlParser, $tagName)
setTestOBJ(\ilObjTest $testOBJ)
setHandlers($a_xml_parser)
setImportMapping(\ilImportMapping $importMapping)
handlerCharacterData($xmlParser, $charData)
importRandomQuestionSetSettings($attr)
importRandomQuestionSourcePoolDefinition(ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition, $attr)
handlerBeginTag($xmlParser, $tagName, $tagAttributes)
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setQuestionAmount($questionAmount)
setPoolQuestionCount($poolQuestionCount)
setTypeFilterFromTypeTags(array $tags)
Set the type filter from a list of type tags.
setSequencePosition($sequencePosition)
setMappedTaxonomyFilter($filter=array())
set the original taxonomy filter condition
setPoolRefId(?int $poolRefId)