ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ResourcesManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  protected \ILIAS\COPage\Dom\DomUtil $dom_util;
26 
27  public function __construct()
28  {
29  global $DIC;
30  $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
31  }
32 
33  public function getResourceIds(\DOMDocument $dom): array
34  {
35  $r_ids = [];
36  $path = "//Resources";
37  $nodes = $this->dom_util->path($dom, $path);
38  foreach ($nodes as $node) {
39  $id = "";
40  $c = $node->childNodes->item(0);
41  if (is_object($c) && $c->nodeName === "ResourceList") {
42  $id = $c->getAttribute("Type");
43  }
44  if (is_object($c) && $c->nodeName === "ItemGroup") {
45  $id = $c->getAttribute("RefId");
46  }
47  if ($id !== "" && !in_array($id, $r_ids)) {
48  $r_ids[] = $id;
49  }
50  }
51  return $r_ids;
52  }
53 
54 }
$c
Definition: deliver.php:25
$path
Definition: ltiservices.php:29
global $DIC
Definition: shib_login.php:26
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23