30 public function init(): void
47 $this->dom_util->setAttribute($this->getChildNode(), $a_attr, $a_value);
54 string $a_type =
"HorizontalTabs"
60 $this->setTabsAttribute(
"Type", $a_type);
67 return $this->getChildNode()->getAttribute(
"Type");
72 $this->setTabsAttribute(
"ContentWidth", $a_val);
77 return $this->getChildNode()->getAttribute(
"ContentWidth");
82 $this->setTabsAttribute(
"ContentHeight", $a_val);
87 return $this->getChildNode()->getAttribute(
"ContentHeight");
92 $this->setTabsAttribute(
"HorizontalAlign", $a_val);
97 return $this->getChildNode()->getAttribute(
"HorizontalAlign");
102 $this->setTabsAttribute(
"Behavior", $a_val);
107 return $this->getChildNode()->getAttribute(
"Behavior");
114 foreach ($this->getChildNode()->childNodes as $child) {
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,
127 "hier_id" => $hier_id
140 foreach ($this->getCaptions() as $cap) {
141 if ($cap[
"pc_id"] === $a_pc_id && $cap[
"hier_id"] === $a_hier_id) {
142 return $cap[
"caption"];
158 foreach ($this->getChildNode()->childNodes as $child) {
159 if ($child->nodeName ==
"Tab") {
160 $pc_id = $child->getAttribute(
"PCID");
161 $hier_id = $child->getAttribute(
"HierId");
162 $nodes[$hier_id .
":" . $pc_id] = $child;
165 $this->dom_util->deleteAllChildsByName($this->getChildNode(), [
"Tab"]);
167 foreach ($a_pos as $k => $v) {
168 if (is_object($nodes[$k])) {
169 $nodes[$k] = $this->getChildNode()->appendChild($nodes[$k]);
177 foreach ($this->getChildNode()->childNodes as $child) {
178 if ($child->nodeName ==
"Tab") {
179 $pc_id = $child->getAttribute(
"PCID");
180 $hier_id = $child->getAttribute(
"HierId");
181 $k = $hier_id .
":" . $pc_id;
183 if ($a_captions[$k] !=
"") {
184 $this->dom_util->setFirstOptionalElement(
192 $this->dom_util->deleteAllChildsByName($child, array(
"TabCaption"));
203 foreach ($this->getChildNode()->childNodes as $child) {
204 if ($child->nodeName ==
"Tab") {
205 if ($a_pc_id == $child->getAttribute(
"PCID") &&
206 $a_hier_id == $child->getAttribute(
"HierId")) {
207 $child->parentNode->removeChild($child);
213 public function addTab(
string $a_caption): void
215 $new_item = $this->dom_doc->createElement(
"Tab");
216 $new_item = $this->getChildNode()->appendChild($new_item);
217 $this->dom_util->setFirstOptionalElement(
228 $this->setTabsAttribute(
"Template", $a_template);
233 return $this->getChildNode()->getAttribute(
"Template");
238 return array(
"pc_vacc",
"pc_hacc",
"pc_carousel");
243 $this->setTabsAttribute(
"AutoAnimWait", (
string) $a_val);
248 $val = $this->getChildNode()->getAttribute(
"AutoAnimWait");
257 $this->setTabsAttribute(
"RandomStart", $a_val);
262 return (
bool) $this->getChildNode()->getAttribute(
"RandomStart");
268 if ($a_mode !==
"edit") {
269 $files[] =
"./components/ILIAS/COPage/PC/Tabs/js/presentation.js";
281 $tab_nodes = $this->getChildNode()->childNodes;
282 foreach ($tab_nodes as $tab_node) {
283 if ($tab_node->nodeName ===
"Tab") {
284 $current_pc_id = $tab_node->getAttribute(
"PCID");
285 if ($current_pc_id === $pc_id) {
286 if ($caption !==
"") {
287 $this->dom_util->setFirstOptionalElement(
295 $this->dom_util->deleteAllChildsByName($tab_node, [
"TabCaption"]);
302 public function addAbove(
string $pc_id,
string $caption =
""): void
304 $dom = $this->getPage()->getDomDoc();
305 $new_tab = $dom->createElement(
"Tab");
306 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
307 if (!is_null($tab)) {
308 $new_tab = $tab->parentNode->insertBefore($new_tab, $tab);
309 if ($caption !==
"") {
310 $dom_util = $this->domain->domUtil();
311 $dom_util->setFirstOptionalElement(
322 public function addBelow(
string $pc_id,
string $caption =
""): void
324 $dom = $this->getPage()->getDomDoc();
325 $new_tab = $dom->createElement(
"Tab");
326 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
327 if (!is_null($tab)) {
328 if ($next = $tab->nextSibling) {
329 $new_tab = $next->parentNode->insertBefore($new_tab, $next);
331 $new_tab = $tab->parentNode->appendChild($new_tab);
334 if ($caption !==
"") {
335 $dom_util = $this->domain->domUtil();
336 $dom_util->setFirstOptionalElement(
347 public function moveUp(
string $pc_id): void
349 $dom = $this->getPage()->getDomDoc();
350 $new_tab = $dom->createElement(
"Tab");
351 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
352 if (!is_null($tab)) {
353 $prev = $tab->previousSibling;
355 $tab->parentNode->removeChild($tab);
356 $tab = $prev->parentNode->insertBefore($tab, $prev);
363 $dom = $this->getPage()->getDomDoc();
364 $new_tab = $dom->createElement(
"Tab");
365 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
366 if (!is_null($tab)) {
367 $next = $tab->nextSibling;
369 $next2 = $next->nextSibling;
370 $tab->parentNode->removeChild($tab);
372 $tab = $next2->parentNode->insertBefore($tab, $next2);
374 $tab = $next->parentNode->appendChild($tab);
382 $dom = $this->getPage()->getDomDoc();
383 $new_tab = $dom->createElement(
"Tab");
384 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
385 if (!is_null($tab)) {
386 $prev = $tab->previousSibling;
388 $tab->parentNode->removeChild($tab);
389 $first = $prev->parentNode->childNodes->item(0);
390 $tab = $prev->parentNode->insertBefore($tab, $first);
397 $dom = $this->getPage()->getDomDoc();
398 $new_tab = $dom->createElement(
"Tab");
399 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
400 if (!is_null($tab)) {
401 $next = $tab->nextSibling;
403 $tab->parentNode->removeChild($tab);
404 $tab = $next->parentNode->appendChild($tab);
411 $dom = $this->getPage()->getDomDoc();
412 $new_tab = $dom->createElement(
"Tab");
413 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
414 if (!is_null($tab)) {
415 $tab->parentNode->removeChild($tab);
421 $tab = $this->getPage()->getDomNodeForPCId($pc_id);
422 if (!is_null($tab)) {
424 foreach ($tab->childNodes as $node) {
425 if ($node->nodeName ===
"PageContent") {
426 $xml .= $node->ownerDocument->saveXml($node);
static getLocalJavascriptFiles()
static getLocalCssFiles()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getJavascriptFiles(string $a_mode)
moveBottom(string $pc_id)
setBehavior(string $a_val)
setTabType(string $a_type="HorizontalTabs")
getNodeXml(string $pc_id)
saveCaption(string $pc_id, string $caption)
addBelow(string $pc_id, string $caption="")
deleteTab(string $a_hier_id, string $a_pc_id)
getCssFiles(string $a_mode)
addAbove(string $pc_id, string $caption="")
setTabsAttribute(string $a_attr, string $a_value)
addTab(string $a_caption)
static getLangVars()
Get lang vars needed for editing.
setRandomStart(bool $a_val)
setContentWidth(string $a_val)
saveCaptions(array $a_captions)
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
setHorizontalAlign(string $a_val)
getCaption(string $a_hier_id, string $a_pc_id)
deletePanel(string $pc_id)
savePositions(array $a_pos)
Save positions of tabs.
setContentHeight(string $a_val)
setTemplate(string $a_template)
Content object of ilPageObject (see ILIAS DTD).
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])
setType(string $a_type)
Set Type.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)