function setListTitle($a_title, $a_language) { ilDOMUtil::setFirstOptionalElement($this->dom, $this->list_node, "Title", array("FileItem"), $a_title, array("Language" => $a_language)); }
/** * set table caption */ function setCaption($a_content, $a_align) { if ($a_content != "") { ilDOMUtil::setFirstOptionalElement($this->dom, $this->tab_node, "Caption", array("Summary", "TableRow"), $a_content, array("Align" => $a_align)); } else { ilDOMUtil::deleteAllChildsByName($this->tab_node, array("Caption")); } }
/** * Add a tab */ function addTab($a_caption) { $new_item = $this->dom->create_element("Tab"); $new_item = $this->tabs_node->append_child($new_item); ilDOMUtil::setFirstOptionalElement($this->dom, $new_item, "TabCaption", array(), $a_caption, array()); }
/** * Add a new trigger marker */ function addTriggerMarker() { global $lng; $max = 0; $triggers = $this->getTriggers(); foreach ($triggers as $t) { $max = max($max, (int) $t["Nr"]); } $attributes = array("Type" => self::MARKER, "Title" => $lng->txt("cont_new_marker"), "Nr" => $max + 1, "OverlayX" => "0", "OverlayY" => "0", "MarkerX" => "0", "MarkerY" => "0", "PopupNr" => "", "PopupX" => "0", "PopupY" => "0", "PopupWidth" => "150", "PopupHeight" => "200"); $ma_node = ilDOMUtil::addElementToList($this->dom, $this->iim_node, "Trigger", array("ContentPopup"), "", $attributes); }
/** * Add a new area to the map */ function addMapArea($a_shape_type, $a_coords, $a_title, $a_link, $a_id = "") { $attributes = array("Shape" => $a_shape_type, "Coords" => $a_coords, "Id" => $a_id); $ma_node = ilDOMUtil::addElementToList($this->dom, $this->item_node, "MapArea", array(), "", $attributes); if ($a_link["LinkType"] == "int" || $a_link["LinkType"] == "IntLink") { $attributes = array("Type" => $a_link["Type"], "TargetFrame" => $a_link["TargetFrame"], "Target" => $a_link["Target"]); ilDOMUtil::setFirstOptionalElement($this->dom, $ma_node, "IntLink", array(""), $a_title, $attributes); } if ($a_link["LinkType"] == "ext" || $a_link["LinkType"] == "ExtLink") { $attributes = array("Href" => $a_link["Href"]); ilDOMUtil::setFirstOptionalElement($this->dom, $ma_node, "ExtLink", array(""), $a_title, $attributes); } }
/** * Places a new node $a_node_name directly before nodes with names of * $a_successors. The content of the node is set to $a_content and the * attributes to $a_attributes */ function addElementToList(&$doc, &$parent_node, $a_node_name, $a_successors, $a_content, $a_attributes) { $search = $a_successors; $childs = $parent_node->child_nodes(); $cnt_childs = count($childs); $found = false; foreach ($childs as $child) { $child_name = $child->node_name(); if (in_array($child_name, $search)) { $found = true; break; } } // didn't successors -> append at the end if (!$found) { $new_node = $doc->create_element($a_node_name); $new_node = $parent_node->append_child($new_node); if ($a_content != "") { $new_node->set_content($a_content); } ilDOMUtil::set_attributes($new_node, $a_attributes); } else { $new_node = $doc->create_element($a_node_name); $new_node = $child->insert_before($new_node, $child); if ($a_content != "") { $new_node->set_content($a_content); } ilDOMUtil::set_attributes($new_node, $a_attributes); } return $new_node; }