30 public function init(): void
47 $this->dom_util->setAttribute($this->
getChildNode(), $a_attr, $a_value);
54 string $a_type =
"HorizontalTabs" 77 return $this->
getChildNode()->getAttribute(
"ContentWidth");
87 return $this->
getChildNode()->getAttribute(
"ContentHeight");
97 return $this->
getChildNode()->getAttribute(
"HorizontalAlign");
115 if ($child->nodeName ==
"Tab") {
116 $pc_id = $child->getAttribute(
"PCID");
117 $hier_id = $child->getAttribute(
"HierId");
118 $current_caption =
"";
119 foreach ($child->childNodes as $tab_child) {
120 if ($tab_child->nodeName ==
"TabCaption") {
121 $current_caption = $this->dom_util->getContent($tab_child);
124 $captions[] = array(
"pos" => $k,
125 "caption" => $current_caption,
"pc_id" => $pc_id,
"hier_id" =>
$hier_id);
138 if ($cap[
"pc_id"] === $a_pc_id && $cap[
"hier_id"] === $a_hier_id) {
139 return $cap[
"caption"];
156 if ($child->nodeName ==
"Tab") {
157 $pc_id = $child->getAttribute(
"PCID");
158 $hier_id = $child->getAttribute(
"HierId");
159 $nodes[
$hier_id .
":" . $pc_id] = $child;
162 $this->dom_util->deleteAllChildsByName($this->
getChildNode(), [
"Tab"]);
164 foreach ($a_pos as $k => $v) {
165 if (is_object($nodes[$k])) {
166 $nodes[$k] = $this->
getChildNode()->appendChild($nodes[$k]);
175 if ($child->nodeName ==
"Tab") {
176 $pc_id = $child->getAttribute(
"PCID");
177 $hier_id = $child->getAttribute(
"HierId");
180 if ($a_captions[$k] !=
"") {
181 $this->dom_util->setFirstOptionalElement(
189 $this->dom_util->deleteAllChildsByName($child, array(
"TabCaption"));
201 if ($child->nodeName ==
"Tab") {
202 if ($a_pc_id == $child->getAttribute(
"PCID") &&
203 $a_hier_id == $child->getAttribute(
"HierId")) {
204 $child->parentNode->removeChild($child);
210 public function addTab(
string $a_caption): void
212 $new_item = $this->dom_doc->createElement(
"Tab");
213 $new_item = $this->
getChildNode()->appendChild($new_item);
214 $this->dom_util->setFirstOptionalElement(
235 return array(
"pc_vacc",
"pc_hacc",
"pc_carousel");
245 $val = $this->
getChildNode()->getAttribute(
"AutoAnimWait");
259 return (
bool) $this->
getChildNode()->getAttribute(
"RandomStart");
275 foreach ($tab_nodes as $tab_node) {
276 if ($tab_node->nodeName ===
"Tab") {
277 $current_pc_id = $tab_node->getAttribute(
"PCID");
278 if ($current_pc_id === $pc_id) {
279 if ($caption !==
"") {
280 $this->dom_util->setFirstOptionalElement(
288 $this->dom_util->deleteAllChildsByName($tab_node, [
"TabCaption"]);
295 public function addAbove(
string $pc_id,
string $caption =
""): void
297 $dom = $this->
getPage()->getDomDoc();
298 $new_tab = $dom->createElement(
"Tab");
299 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
300 if (!is_null($tab)) {
301 $new_tab = $tab->parentNode->insertBefore($new_tab, $tab);
302 if ($caption !==
"") {
315 public function addBelow(
string $pc_id,
string $caption =
""): void
317 $dom = $this->
getPage()->getDomDoc();
318 $new_tab = $dom->createElement(
"Tab");
319 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
320 if (!is_null($tab)) {
321 if ($next = $tab->nextSibling) {
322 $new_tab = $next->parentNode->insertBefore($new_tab, $next);
324 $new_tab = $tab->parentNode->appendChild($new_tab);
327 if ($caption !==
"") {
340 public function moveUp(
string $pc_id): void
342 $dom = $this->
getPage()->getDomDoc();
343 $new_tab = $dom->createElement(
"Tab");
344 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
345 if (!is_null($tab)) {
346 $prev = $tab->previousSibling;
348 $tab->parentNode->removeChild($tab);
349 $tab = $prev->parentNode->insertBefore($tab, $prev);
356 $dom = $this->
getPage()->getDomDoc();
357 $new_tab = $dom->createElement(
"Tab");
358 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
359 if (!is_null($tab)) {
360 $next = $tab->nextSibling;
362 $next2 = $next->nextSibling;
363 $tab->parentNode->removeChild($tab);
365 $tab = $next2->parentNode->insertBefore($tab, $next2);
367 $tab = $next->parentNode->appendChild($tab);
375 $dom = $this->
getPage()->getDomDoc();
376 $new_tab = $dom->createElement(
"Tab");
377 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
378 if (!is_null($tab)) {
379 $prev = $tab->previousSibling;
381 $tab->parentNode->removeChild($tab);
382 $first = $prev->parentNode->childNodes->item(0);
383 $tab = $prev->parentNode->insertBefore($tab, $first);
390 $dom = $this->
getPage()->getDomDoc();
391 $new_tab = $dom->createElement(
"Tab");
392 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
393 if (!is_null($tab)) {
394 $next = $tab->nextSibling;
396 $tab->parentNode->removeChild($tab);
397 $tab = $next->parentNode->appendChild($tab);
404 $dom = $this->
getPage()->getDomDoc();
405 $new_tab = $dom->createElement(
"Tab");
406 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
407 if (!is_null($tab)) {
408 $tab->parentNode->removeChild($tab);
414 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
415 if (!is_null($tab)) {
417 foreach ($tab->childNodes as $node) {
418 if ($node->nodeName ===
"PageContent") {
419 $xml .= $node->ownerDocument->saveXml($node);
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
setTabType(string $a_type="HorizontalTabs")
static getLocalCssFiles()
savePositions(array $a_pos)
Save positions of tabs.
saveCaption(string $pc_id, string $caption)
setType(string $a_type)
Set Type.
addAbove(string $pc_id, string $caption="")
getJavascriptFiles(string $a_mode)
getCssFiles(string $a_mode)
setContentHeight(string $a_val)
setRandomStart(bool $a_val)
setTemplate(string $a_template)
setBehavior(string $a_val)
setContentWidth(string $a_val)
deleteTab(string $a_hier_id, string $a_pc_id)
Content object of ilPageObject (see ILIAS DTD).
moveBottom(string $pc_id)
static getLocalJavascriptFiles()
getCaption(string $a_hier_id, string $a_pc_id)
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
setTabsAttribute(string $a_attr, string $a_value)
addBelow(string $pc_id, string $caption="")
addTab(string $a_caption)
saveCaptions(array $a_captions)
deletePanel(string $pc_id)
ILIAS COPage Dom DomUtil $dom_util
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHorizontalAlign(string $a_val)
getNodeXml(string $pc_id)
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])