ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\COPage\PC\Question\QuestionManager Class Reference
+ Collaboration diagram for ILIAS\COPage\PC\Question\QuestionManager:

Public Member Functions

 __construct ()
 
 resolveQuestionReferences (\DOMDocument $dom, array $a_mapping)
 Resolve all quesiont references (after import) More...
 

Protected Attributes

ILIAS COPage Dom DomUtil $dom_util
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file QuestionManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\PC\Question\QuestionManager::__construct ( )

Definition at line 30 of file QuestionManager.php.

31 {
32 global $DIC;
33 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
34 }
global $DIC
Definition: shib_login.php:26

References $DIC.

Member Function Documentation

◆ resolveQuestionReferences()

ILIAS\COPage\PC\Question\QuestionManager::resolveQuestionReferences ( \DOMDocument  $dom,
array  $a_mapping 
)

Resolve all quesiont references (after import)

Definition at line 40 of file QuestionManager.php.

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 }
$path
Definition: ltiservices.php:30

References ILIAS\Repository\int().

+ Here is the call graph for this function:

Field Documentation

◆ $dom_util

ILIAS COPage Dom DomUtil ILIAS\COPage\PC\Question\QuestionManager::$dom_util
protected

Definition at line 28 of file QuestionManager.php.


The documentation for this class was generated from the following file: