ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
QuestionManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
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  $node->setAttribute("QRef", "il__qst_" . $a_mapping[$qref]["pool"]);
51  $updated = true;
52  }
53  }
54  return $updated;
55  }
56 }
resolveQuestionReferences(\DOMDocument $dom, array $a_mapping)
Resolve all quesiont references (after import)
$path
Definition: ltiservices.php:29
global $DIC
Definition: shib_login.php:22