32 public function init(): void
39 parent::setNode($a_node);
50 $this->tabs_node = $this->dom->create_element(
"Tabs");
51 $this->tabs_node = $this->node->append_child($this->tabs_node);
58 if (!empty($a_value)) {
59 $this->tabs_node->set_attribute($a_attr, $a_value);
61 if ($this->tabs_node->has_attribute($a_attr)) {
62 $this->tabs_node->remove_attribute($a_attr);
71 string $a_type =
"HorizontalTabs" 77 $this->tabs_node->set_attribute(
"Type", $a_type);
84 return $this->tabs_node->get_attribute(
"Type");
94 return $this->tabs_node->get_attribute(
"ContentWidth");
104 return $this->tabs_node->get_attribute(
"ContentHeight");
114 return $this->tabs_node->get_attribute(
"HorizontalAlign");
124 return $this->tabs_node->get_attribute(
"Behavior");
130 $tab_nodes = $this->tabs_node->child_nodes();
132 for (
$i = 0;
$i < count($tab_nodes);
$i++) {
133 if ($tab_nodes[
$i]->node_name() ==
"Tab") {
134 $pc_id = $tab_nodes[
$i]->get_attribute(
"PCID");
135 $hier_id = $tab_nodes[
$i]->get_attribute(
"HierId");
137 $tab_node_childs = $tab_nodes[
$i]->child_nodes();
138 $current_caption =
"";
139 for ($j = 0; $j < count($tab_node_childs); $j++) {
140 if ($tab_node_childs[$j]->node_name() ==
"TabCaption") {
141 $current_caption = $tab_node_childs[$j]->get_content();
144 $captions[] = array(
"pos" => $k,
145 "caption" => $current_caption,
"pc_id" => $pc_id,
"hier_id" =>
$hier_id);
157 $tab_nodes = $this->tabs_node->child_nodes();
158 for (
$i = 0;
$i < count($tab_nodes);
$i++) {
159 if ($tab_nodes[
$i]->node_name() ==
"Tab") {
160 if ($a_pc_id == $tab_nodes[
$i]->get_attribute(
"PCID") &&
161 ($a_hier_id == $tab_nodes[
$i]->get_attribute(
"HierId"))) {
162 $tab_node_childs = $tab_nodes[
$i]->child_nodes();
163 for ($j = 0; $j < count($tab_node_childs); $j++) {
164 if ($tab_node_childs[$j]->node_name() ==
"TabCaption") {
165 return $tab_node_childs[$j]->get_content();
184 $childs = $this->tabs_node->child_nodes();
186 for (
$i = 0;
$i < count($childs);
$i++) {
187 if ($childs[
$i]->node_name() ==
"Tab") {
188 $pc_id = $childs[
$i]->get_attribute(
"PCID");
189 $hier_id = $childs[
$i]->get_attribute(
"HierId");
190 $nodes[
$hier_id .
":" . $pc_id] = $childs[
$i];
191 $childs[
$i]->unlink($childs[
$i]);
195 foreach ($a_pos as $k => $v) {
196 if (is_object($nodes[$k])) {
197 $nodes[$k] = $this->tabs_node->append_child($nodes[$k]);
205 $tab_nodes = $this->tabs_node->child_nodes();
206 for (
$i = 0;
$i < count($tab_nodes);
$i++) {
207 if ($tab_nodes[
$i]->node_name() ==
"Tab") {
208 $pc_id = $tab_nodes[
$i]->get_attribute(
"PCID");
209 $hier_id = $tab_nodes[
$i]->get_attribute(
"HierId");
212 if ($a_captions[$k] !=
"") {
233 $childs = $this->tabs_node->child_nodes();
235 for (
$i = 0;
$i < count($childs);
$i++) {
236 if ($childs[
$i]->node_name() ==
"Tab") {
237 if ($a_pc_id == $childs[
$i]->get_attribute(
"PCID") &&
238 $a_hier_id == $childs[
$i]->get_attribute(
"HierId")) {
239 $childs[
$i]->unlink($childs[
$i]);
245 public function addTab(
string $a_caption): void
247 $new_item = $this->dom->create_element(
"Tab");
248 $new_item = $this->tabs_node->append_child($new_item);
266 return $this->tabs_node->get_attribute(
"Template");
271 return array(
"pc_vacc",
"pc_hacc",
"pc_carousel");
281 $val = $this->tabs_node->get_attribute(
"AutoAnimWait");
295 return (
bool) $this->tabs_node->get_attribute(
"RandomStart");
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.
setType(string $a_type)
Set Type.
getJavascriptFiles(string $a_mode)
static setFirstOptionalElement(php4DOMDocument $doc, php4DOMElement $parent_node, string $a_node_name, array $a_successors, string $a_content, array $a_attributes, bool $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found...
static deleteAllChildsByName(php4DOMElement $a_parent, array $a_node_names)
delete all childs of a node by names in $a_node_names
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)
setNode(php4DOMElement $a_node)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLocalJavascriptFiles()
getCaption(string $a_hier_id, string $a_pc_id)
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
setTabsAttribute(string $a_attr, string $a_value)
addTab(string $a_caption)
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
saveCaptions(array $a_captions)
php4DOMElement $tabs_node
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHorizontalAlign(string $a_val)