ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCTabs Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPCTabs:
+ Collaboration diagram for ilPCTabs:

Public Member Functions

 init ()
 
 setNode (php4DOMElement $a_node)
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 setTabType (string $a_type="HorizontalTabs")
 
 getTabType ()
 
 setContentWidth (string $a_val)
 
 getContentWidth ()
 
 setContentHeight (string $a_val)
 
 getContentHeight ()
 
 setHorizontalAlign (string $a_val)
 
 getHorizontalAlign ()
 
 setBehavior (string $a_val)
 
 getBehavior ()
 
 getCaptions ()
 
 getCaption (string $a_hier_id, string $a_pc_id)
 
 savePositions (array $a_pos)
 Save positions of tabs. More...
 
 saveCaptions (array $a_captions)
 
 deleteTab (string $a_hier_id, string $a_pc_id)
 
 addTab (string $a_caption)
 
 setTemplate (string $a_template)
 
 getTemplate ()
 
 setAutoTime (?int $a_val)
 
 getAutoTime ()
 
 setRandomStart (bool $a_val)
 
 getRandomStart ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 setNode (php4DOMElement $a_node)
 Set xml node of page content. More...
 
 getNode ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getOnloadCode (string $a_mode)
 
 setHierId (string $a_hier_id)
 
 getHierId ()
 
 lookupHierId ()
 
 readHierId ()
 
 setPcId (string $a_pcid)
 
 getPCId ()
 
 setFileDownloadLink (string $a_download_link)
 
 getFileDownloadLink ()
 
 setProfileBackUrl (string $url)
 
 getProfileBackUrl ()
 
 setFullscreenLink (string $a_fullscreen_link)
 
 getFullscreenLink ()
 
 setSourcecodeDownloadScript (string $script_name)
 
 getSourcecodeDownloadScript ()
 
 readPCId ()
 
 writePCId (string $a_pc_id)
 
 setEnabled (string $value)
 Set Enabled value for page content component. More...
 
 enable ()
 
 disable ()
 
 isEnabled ()
 
 createPageContentNode (bool $a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model as needed for the front-end editor. More...
 

Static Public Member Functions

static getLangVars ()
 
- Static Public Member Functions inherited from ilPageContent
static incEdId (string $ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId (string $ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static sortHierIds (array $a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId (string $a, string $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
static handleCopiedContent (DOMDocument $a_domdoc, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 Handle copied content. More...
 
static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete (ilPageObject $a_page)
 Before page is being deleted. More...
 
static afterRepositoryCopy (ilPageObject $page, array $mapping, int $source_ref_id)
 After repository (container) copy action. More...
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
 After page history entry has been created. More...
 
static deleteHistoryLowerEqualThan (string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
 Overwrite in derived classes, if old history entries are being deleted. More...
 

Data Fields

const ACCORDION_HOR = "HorizontalAccordion"
 
const ACCORDION_VER = "VerticalAccordion"
 
const CAROUSEL = "Carousel"
 
php4DOMElement $tabs_node
 
- Data Fields inherited from ilPageContent
string $hier_id = ""
 
php4DOMElement $node = null
 
php4DOMDocument $dom = null
 
string $page_lang = ""
 

Protected Member Functions

 setTabsAttribute (string $a_attr, string $a_value)
 
- Protected Member Functions inherited from ilPageContent
 setType (string $a_type)
 Set Type. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilPageContent
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Tabbed contents (see ILIAS DTD)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilPCTabs.php.

Member Function Documentation

◆ addTab()

ilPCTabs::addTab ( string  $a_caption)

Definition at line 245 of file class.ilPCTabs.php.

References ilDOMUtil\setFirstOptionalElement().

245  : void
246  {
247  $new_item = $this->dom->create_element("Tab");
248  $new_item = $this->tabs_node->append_child($new_item);
250  $this->dom,
251  $new_item,
252  "TabCaption",
253  array(),
254  $a_caption,
255  array()
256  );
257  }
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...
+ Here is the call graph for this function:

◆ create()

ilPCTabs::create ( ilPageObject  $a_pg_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Definition at line 43 of file class.ilPCTabs.php.

References ilPageContent\createPageContentNode(), IL_INSERT_AFTER, and ilPageObject\insertContent().

47  : void {
48  $this->node = $this->createPageContentNode();
49  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
50  $this->tabs_node = $this->dom->create_element("Tabs");
51  $this->tabs_node = $this->node->append_child($this->tabs_node);
52  }
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
const IL_INSERT_AFTER
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
+ Here is the call graph for this function:

◆ deleteTab()

ilPCTabs::deleteTab ( string  $a_hier_id,
string  $a_pc_id 
)

Definition at line 228 of file class.ilPCTabs.php.

References $i.

231  : void {
232  // File Item
233  $childs = $this->tabs_node->child_nodes();
234  $nodes = array();
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]);
240  }
241  }
242  }
243  }
$i
Definition: metadata.php:41

◆ getAutoTime()

ilPCTabs::getAutoTime ( )

Definition at line 279 of file class.ilPCTabs.php.

279  : ?int
280  {
281  $val = $this->tabs_node->get_attribute("AutoAnimWait");
282  if ($val) {
283  return (int) $val;
284  }
285  return null;
286  }

◆ getBehavior()

ilPCTabs::getBehavior ( )

Definition at line 122 of file class.ilPCTabs.php.

122  : string
123  {
124  return $this->tabs_node->get_attribute("Behavior");
125  }

◆ getCaption()

ilPCTabs::getCaption ( string  $a_hier_id,
string  $a_pc_id 
)

Definition at line 153 of file class.ilPCTabs.php.

References $i.

156  : string {
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();
166  }
167  }
168  }
169  }
170  }
171 
172  return "";
173  }
$i
Definition: metadata.php:41

◆ getCaptions()

ilPCTabs::getCaptions ( )

Definition at line 127 of file class.ilPCTabs.php.

References ilPageContent\$hier_id, and $i.

127  : array
128  {
129  $captions = array();
130  $tab_nodes = $this->tabs_node->child_nodes();
131  $k = 0;
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");
136 
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();
142  }
143  }
144  $captions[] = array("pos" => $k,
145  "caption" => $current_caption, "pc_id" => $pc_id, "hier_id" => $hier_id);
146  $k++;
147  }
148  }
149 
150  return $captions;
151  }
$i
Definition: metadata.php:41

◆ getContentHeight()

ilPCTabs::getContentHeight ( )

Definition at line 102 of file class.ilPCTabs.php.

102  : string
103  {
104  return $this->tabs_node->get_attribute("ContentHeight");
105  }

◆ getContentWidth()

ilPCTabs::getContentWidth ( )

Definition at line 92 of file class.ilPCTabs.php.

92  : string
93  {
94  return $this->tabs_node->get_attribute("ContentWidth");
95  }

◆ getCssFiles()

ilPCTabs::getCssFiles ( string  $a_mode)

Definition at line 303 of file class.ilPCTabs.php.

References ilAccordionGUI\getLocalCssFiles().

303  : array
304  {
306  }
+ Here is the call graph for this function:

◆ getHorizontalAlign()

ilPCTabs::getHorizontalAlign ( )

Definition at line 112 of file class.ilPCTabs.php.

112  : string
113  {
114  return $this->tabs_node->get_attribute("HorizontalAlign");
115  }

◆ getJavascriptFiles()

ilPCTabs::getJavascriptFiles ( string  $a_mode)

Definition at line 298 of file class.ilPCTabs.php.

References ilAccordionGUI\getLocalJavascriptFiles().

298  : array
299  {
301  }
static getLocalJavascriptFiles()
+ Here is the call graph for this function:

◆ getLangVars()

static ilPCTabs::getLangVars ( )
static

Definition at line 269 of file class.ilPCTabs.php.

269  : array
270  {
271  return array("pc_vacc", "pc_hacc", "pc_carousel");
272  }

◆ getRandomStart()

ilPCTabs::getRandomStart ( )

Definition at line 293 of file class.ilPCTabs.php.

293  : bool
294  {
295  return (bool) $this->tabs_node->get_attribute("RandomStart");
296  }

◆ getTabType()

ilPCTabs::getTabType ( )

Definition at line 82 of file class.ilPCTabs.php.

82  : string
83  {
84  return $this->tabs_node->get_attribute("Type");
85  }

◆ getTemplate()

ilPCTabs::getTemplate ( )

Definition at line 264 of file class.ilPCTabs.php.

264  : string
265  {
266  return $this->tabs_node->get_attribute("Template");
267  }

◆ init()

ilPCTabs::init ( )

Definition at line 32 of file class.ilPCTabs.php.

References ilPageContent\setType().

32  : void
33  {
34  $this->setType("tabs");
35  }
setType(string $a_type)
Set Type.
+ Here is the call graph for this function:

◆ saveCaptions()

ilPCTabs::saveCaptions ( array  $a_captions)

Definition at line 202 of file class.ilPCTabs.php.

References ilPageContent\$hier_id, $i, ilDOMUtil\deleteAllChildsByName(), and ilDOMUtil\setFirstOptionalElement().

202  : void
203  {
204  // iterate all tab nodes
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");
210  $k = $hier_id . ":" . $pc_id;
211  // if caption given, set it, otherwise delete caption subitem
212  if ($a_captions[$k] != "") {
214  $this->dom,
215  $tab_nodes[$i],
216  "TabCaption",
217  array(),
218  $a_captions[$k],
219  array()
220  );
221  } else {
222  ilDOMUtil::deleteAllChildsByName($tab_nodes[$i], array("TabCaption"));
223  }
224  }
225  }
226  }
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
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ savePositions()

ilPCTabs::savePositions ( array  $a_pos)

Save positions of tabs.

Definition at line 178 of file class.ilPCTabs.php.

References ilPageContent\$hier_id, and $i.

180  : void {
181  asort($a_pos);
182 
183  // File Item
184  $childs = $this->tabs_node->child_nodes();
185  $nodes = array();
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]);
192  }
193  }
194 
195  foreach ($a_pos as $k => $v) {
196  if (is_object($nodes[$k])) {
197  $nodes[$k] = $this->tabs_node->append_child($nodes[$k]);
198  }
199  }
200  }
$i
Definition: metadata.php:41

◆ setAutoTime()

ilPCTabs::setAutoTime ( ?int  $a_val)

Definition at line 274 of file class.ilPCTabs.php.

References setTabsAttribute().

274  : void
275  {
276  $this->setTabsAttribute("AutoAnimWait", (string) $a_val);
277  }
setTabsAttribute(string $a_attr, string $a_value)
+ Here is the call graph for this function:

◆ setBehavior()

ilPCTabs::setBehavior ( string  $a_val)

Definition at line 117 of file class.ilPCTabs.php.

References setTabsAttribute().

117  : void
118  {
119  $this->setTabsAttribute("Behavior", $a_val);
120  }
setTabsAttribute(string $a_attr, string $a_value)
+ Here is the call graph for this function:

◆ setContentHeight()

ilPCTabs::setContentHeight ( string  $a_val)

Definition at line 97 of file class.ilPCTabs.php.

References setTabsAttribute().

97  : void
98  {
99  $this->setTabsAttribute("ContentHeight", $a_val);
100  }
setTabsAttribute(string $a_attr, string $a_value)
+ Here is the call graph for this function:

◆ setContentWidth()

ilPCTabs::setContentWidth ( string  $a_val)

Definition at line 87 of file class.ilPCTabs.php.

References setTabsAttribute().

87  : void
88  {
89  $this->setTabsAttribute("ContentWidth", $a_val);
90  }
setTabsAttribute(string $a_attr, string $a_value)
+ Here is the call graph for this function:

◆ setHorizontalAlign()

ilPCTabs::setHorizontalAlign ( string  $a_val)

Definition at line 107 of file class.ilPCTabs.php.

References setTabsAttribute().

107  : void
108  {
109  $this->setTabsAttribute("HorizontalAlign", $a_val);
110  }
setTabsAttribute(string $a_attr, string $a_value)
+ Here is the call graph for this function:

◆ setNode()

ilPCTabs::setNode ( php4DOMElement  $a_node)

Definition at line 37 of file class.ilPCTabs.php.

References php4DOMNode\first_child().

37  : void
38  {
39  parent::setNode($a_node); // this is the PageContent node
40  $this->tabs_node = $a_node->first_child(); // this is the Tabs node
41  }
+ Here is the call graph for this function:

◆ setRandomStart()

ilPCTabs::setRandomStart ( bool  $a_val)

Definition at line 288 of file class.ilPCTabs.php.

References setTabsAttribute().

288  : void
289  {
290  $this->setTabsAttribute("RandomStart", $a_val);
291  }
setTabsAttribute(string $a_attr, string $a_value)
+ Here is the call graph for this function:

◆ setTabsAttribute()

ilPCTabs::setTabsAttribute ( string  $a_attr,
string  $a_value 
)
protected

Definition at line 54 of file class.ilPCTabs.php.

Referenced by setAutoTime(), setBehavior(), setContentHeight(), setContentWidth(), setHorizontalAlign(), setRandomStart(), and setTemplate().

57  : void {
58  if (!empty($a_value)) {
59  $this->tabs_node->set_attribute($a_attr, $a_value);
60  } else {
61  if ($this->tabs_node->has_attribute($a_attr)) {
62  $this->tabs_node->remove_attribute($a_attr);
63  }
64  }
65  }
+ Here is the caller graph for this function:

◆ setTabType()

ilPCTabs::setTabType ( string  $a_type = "HorizontalTabs")
Parameters
string$a_type("HorizontalTabs" | "Accordion")

Definition at line 70 of file class.ilPCTabs.php.

References ACCORDION_HOR, ACCORDION_VER, and CAROUSEL.

72  : void {
73  switch ($a_type) {
76  case ilPCTabs::CAROUSEL:
77  $this->tabs_node->set_attribute("Type", $a_type);
78  break;
79  }
80  }
const ACCORDION_HOR
const ACCORDION_VER
const CAROUSEL

◆ setTemplate()

ilPCTabs::setTemplate ( string  $a_template)

Definition at line 259 of file class.ilPCTabs.php.

References setTabsAttribute().

259  : void
260  {
261  $this->setTabsAttribute("Template", $a_template);
262  }
setTabsAttribute(string $a_attr, string $a_value)
+ Here is the call graph for this function:

Field Documentation

◆ $tabs_node

php4DOMElement ilPCTabs::$tabs_node

Definition at line 30 of file class.ilPCTabs.php.

◆ ACCORDION_HOR

const ilPCTabs::ACCORDION_HOR = "HorizontalAccordion"

◆ ACCORDION_VER

const ilPCTabs::ACCORDION_VER = "VerticalAccordion"

◆ CAROUSEL

const ilPCTabs::CAROUSEL = "Carousel"

The documentation for this class was generated from the following file: