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,
141 if ($cap[
"pc_id"] === $a_pc_id && $cap[
"hier_id"] === $a_hier_id) {
142 return $cap[
"caption"];
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]);
178 if ($child->nodeName ==
"Tab") {
179 $pc_id = $child->getAttribute(
"PCID");
180 $hier_id = $child->getAttribute(
"HierId");
183 if ($a_captions[$k] !=
"") {
184 $this->dom_util->setFirstOptionalElement(
192 $this->dom_util->deleteAllChildsByName($child, array(
"TabCaption"));
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(
238 return array(
"pc_vacc",
"pc_hacc",
"pc_carousel");
248 $val = $this->
getChildNode()->getAttribute(
"AutoAnimWait");
262 return (
bool) $this->
getChildNode()->getAttribute(
"RandomStart");
278 foreach ($tab_nodes as $tab_node) {
279 if ($tab_node->nodeName ===
"Tab") {
280 $current_pc_id = $tab_node->getAttribute(
"PCID");
281 if ($current_pc_id === $pc_id) {
282 if ($caption !==
"") {
283 $this->dom_util->setFirstOptionalElement(
291 $this->dom_util->deleteAllChildsByName($tab_node, [
"TabCaption"]);
298 public function addAbove(
string $pc_id,
string $caption =
""): void
300 $dom = $this->
getPage()->getDomDoc();
301 $new_tab = $dom->createElement(
"Tab");
302 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
303 if (!is_null($tab)) {
304 $new_tab = $tab->parentNode->insertBefore($new_tab, $tab);
305 if ($caption !==
"") {
318 public function addBelow(
string $pc_id,
string $caption =
""): void
320 $dom = $this->
getPage()->getDomDoc();
321 $new_tab = $dom->createElement(
"Tab");
322 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
323 if (!is_null($tab)) {
324 if ($next = $tab->nextSibling) {
325 $new_tab = $next->parentNode->insertBefore($new_tab, $next);
327 $new_tab = $tab->parentNode->appendChild($new_tab);
330 if ($caption !==
"") {
343 public function moveUp(
string $pc_id): void
345 $dom = $this->
getPage()->getDomDoc();
346 $new_tab = $dom->createElement(
"Tab");
347 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
348 if (!is_null($tab)) {
349 $prev = $tab->previousSibling;
351 $tab->parentNode->removeChild($tab);
352 $tab = $prev->parentNode->insertBefore($tab, $prev);
359 $dom = $this->
getPage()->getDomDoc();
360 $new_tab = $dom->createElement(
"Tab");
361 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
362 if (!is_null($tab)) {
363 $next = $tab->nextSibling;
365 $next2 = $next->nextSibling;
366 $tab->parentNode->removeChild($tab);
368 $tab = $next2->parentNode->insertBefore($tab, $next2);
370 $tab = $next->parentNode->appendChild($tab);
378 $dom = $this->
getPage()->getDomDoc();
379 $new_tab = $dom->createElement(
"Tab");
380 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
381 if (!is_null($tab)) {
382 $prev = $tab->previousSibling;
384 $tab->parentNode->removeChild($tab);
385 $first = $prev->parentNode->childNodes->item(0);
386 $tab = $prev->parentNode->insertBefore($tab, $first);
393 $dom = $this->
getPage()->getDomDoc();
394 $new_tab = $dom->createElement(
"Tab");
395 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
396 if (!is_null($tab)) {
397 $next = $tab->nextSibling;
399 $tab->parentNode->removeChild($tab);
400 $tab = $next->parentNode->appendChild($tab);
407 $dom = $this->
getPage()->getDomDoc();
408 $new_tab = $dom->createElement(
"Tab");
409 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
410 if (!is_null($tab)) {
411 $tab->parentNode->removeChild($tab);
417 $tab = $this->
getPage()->getDomNodeForPCId($pc_id);
418 if (!is_null($tab)) {
420 foreach ($tab->childNodes as $node) {
421 if ($node->nodeName ===
"PageContent") {
422 $xml .= $node->ownerDocument->saveXml($node);
433 bool $a_abstract_only =
false 437 if ($a_mode !==
"edit") {
438 $a_output .=
'<script type="module" src="' . $debug .
'./components/ILIAS/COPage/PC/Tabs/js/presentation.js"></script>';
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)
modifyPageContentPostXsl(string $a_output, string $a_mode, bool $a_abstract_only=false)
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()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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=[])