45 if (is_null($node)) {
46 return null;
47 }
48 $a_hier_id = $node->getAttribute("HierId");
49 $a_pc_id = $node->getAttribute("PCID");
50 $child_node = null;
51 if (!is_object($node)) {
52 $this->log->debug("No node passed.");
53 return null;
54 }
55 $node_name = $node->nodeName;
56 if (in_array($node_name, ["PageObject", "TableRow"])) {
57 $this->log->debug("$node_name -> return.");
58 return null;
59 }
60 if ($node_name == "PageContent") {
61 $child_node = $node->firstChild;
62 $node_name = $child_node->nodeName;
63 }
64
65
66 if ($node_name == "Table") {
67 if ($child_node->getAttribute("DataTable") == "y") {
68 $tab = new \ilPCDataTable($page_object);
69 } else {
70 $tab = new \ilPCTable($page_object);
71 }
72 $tab->setDomNode($node);
73 $tab->setHierId($a_hier_id);
74 $tab->setPcId($a_pc_id);
75 $this->log->debug("return table.");
76 return $tab;
77 }
78
79
80 if ($node_name == "MediaObject") {
81 $mal_node = $child_node->firstChild;
82
83 $id_arr = explode("_", $mal_node->getAttribute("OriginId"));
84 $mob_id = (
int) $id_arr[count($id_arr) - 1];
85
86
88 $mob_id = 0;
89 }
90
91
92 $mob = new \ilPCMediaObject($page_object);
93 $mob->readMediaObject($mob_id);
94
95
96 $mob->setDomNode($node);
97 $mob->setHierId($a_hier_id);
98 $mob->setPcId($a_pc_id);
99 $this->log->debug("return media.");
100 return $mob;
101 }
102
103
104
105
106
107 $pc_def = $this->pc_definition->getPCDefinitionByName($node_name);
108
109
110 if (!is_array($pc_def)) {
111 throw new \ilCOPageUnknownPCTypeException('Unknown PC Name "' . $node_name . '".');
112 }
113 $pc_class = "ilPC" . $pc_def["name"];
114 $pc_path = "./" . $pc_def["component"] . "/" . $pc_def["directory"] . "/class." . $pc_class . ".php";
115
116 $pc = new ("\\" . $pc_class)($page_object);
117 if (!in_array(
118 $node->nodeName,
119 ["PageContent", "TableData", "FileItem", "ListItem"]
120 )) {
121 $this->log->debug("returning null.");
122 return null;
123 }
124 $pc->setDomNode($node);
125 $pc->setHierId($a_hier_id);
126 $pc->setPcId($a_pc_id);
127
128 return $pc;
129 }
static _lookupType(int $id, bool $reference=false)
Content object of ilPageObject (see ILIAS DTD).