ILIAS
trunk Revision v12.0_alpha-1227-g7ff6d300864
◀ ilDoc Overview
QuestionManager.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\COPage\PC\Question
;
22
26
class
QuestionManager
27
{
28
protected \ILIAS\COPage\Dom\DomUtil
$dom_util
;
29
30
public
function
__construct
()
31
{
32
global
$DIC
;
33
$this->dom_util =
$DIC
->copage()->internal()->domain()->domUtil();
34
}
35
40
public
function
resolveQuestionReferences
(
41
\DOMDocument $dom,
42
array $a_mapping
43
): bool {
44
$path
=
"//Question"
;
45
$updated =
false
;
46
$nodes = $this->dom_util->path($dom,
$path
);
47
foreach
($nodes as $node) {
48
$qref = $node->getAttribute(
"QRef"
);
49
if
(isset($a_mapping[$qref])) {
50
$new_id = (
int
) ($a_mapping[$qref][
"pool"
] ?? 0);
51
if
($new_id === 0 && isset($a_mapping[$qref][
"test"
])) {
// changed with 10
52
$new_id = $a_mapping[$qref][
"test"
];
53
}
54
$node->setAttribute(
"QRef"
,
"il__qst_"
. $new_id);
55
$updated =
true
;
56
}
57
}
58
return
$updated;
59
}
60
}
ILIAS\COPage\PC\Question\QuestionManager
Definition:
QuestionManager.php:27
ILIAS\COPage\PC\Question\QuestionManager\$dom_util
ILIAS COPage Dom DomUtil $dom_util
Definition:
QuestionManager.php:28
ILIAS\COPage\PC\Question\QuestionManager\resolveQuestionReferences
resolveQuestionReferences(\DOMDocument $dom, array $a_mapping)
Resolve all quesiont references (after import)
Definition:
QuestionManager.php:40
ILIAS\COPage\PC\Question\QuestionManager\__construct
__construct()
Definition:
QuestionManager.php:30
$path
$path
Definition:
ltiservices.php:30
ILIAS\COPage\PC\Question
Definition:
QuestionManager.php:21
ILIAS\Repository\int
int(string $key)
Definition:
trait.BaseGUIRequest.php:61
$DIC
global $DIC
Definition:
shib_login.php:26
components
ILIAS
COPage
PC
Question
QuestionManager.php
Generated on Wed Apr 8 2026 23:04:36 for ILIAS by
1.9.4 (using
Doxyfile
)