ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPCTabs Class Reference

Class ilPCTabs. More...

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

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set content node. More...
 
 create (&$a_pg_obj, $a_hier_id, $a_pc_id="")
 Create new Tabs node. More...
 
 setTabType ($a_type="HorizontalTabs")
 Set type of tabs. More...
 
 getTabType ()
 Get type of tabs. More...
 
 setContentWidth ($a_val)
 Set content width. More...
 
 getContentWidth ()
 Get content width. More...
 
 setContentHeight ($a_val)
 Set content height. More...
 
 getContentHeight ()
 Get content height. More...
 
 setHorizontalAlign ($a_val)
 Set horizontal align. More...
 
 getHorizontalAlign ()
 Get horizontal align. More...
 
 setBehavior ($a_val)
 Set behavior. More...
 
 getBehavior ()
 Get behavior. More...
 
 getCaptions ()
 Get captions. More...
 
 getCaption ($a_hier_id, $a_pc_id)
 Get caption. More...
 
 savePositions ($a_pos)
 Save positions of tabs. More...
 
 saveCaptions ($a_captions)
 Add Tab items. More...
 
 deleteTab ($a_hier_id, $a_pc_id)
 Save positions of tabs. More...
 
 addTab ($a_caption)
 Add a tab. More...
 
 setTemplate ($a_template)
 Set template. More...
 
 getTemplate ()
 Get template. More...
 
 setAutoTime ($a_val)
 Set auto animation waiting time. More...
 
 getAutoTime ()
 Get auto animation waiting time. More...
 
 setRandomStart ($a_val)
 Set random start. More...
 
 getRandomStart ()
 Get random start. More...
 
 getJavascriptFiles ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get Javascript files. More...
 
- Public Member Functions inherited from ilPageContent
 __construct ($a_pg_obj)
 Constructor. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 init ()
 Init object. More...
 
 getType ()
 Get type of page content. More...
 
 setNode ($a_node)
 Set xml node of page content. More...
 
getNode ()
 Get xml node of page content. More...
 
 getJavascriptFiles ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
 getOnloadCode ($a_mode)
 Get on load code. More...
 
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure. More...
 
 getHierId ()
 Get hierarchical id. More...
 
 lookupHierId ()
 Get hierarchical id from dom. More...
 
 readHierId ()
 Read PC Id. More...
 
 setPcId ($a_pcid)
 Set PC Id. More...
 
 getPCId ()
 Get PC Id. More...
 
 setFileDownloadLink ($a_download_link)
 Set file download link. More...
 
 getFileDownloadLink ()
 Get file download link. More...
 
 setFullscreenLink ($a_fullscreen_link)
 Set fullscreen link. More...
 
 getFullscreenLink ()
 Get fullscreen link. More...
 
 setSourcecodeDownloadScript ($script_name)
 Set sourcecode download script. More...
 
 getSourcecodeDownloadScript ()
 Get sourcecode download script. More...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. More...
 
 setEnabled ($value)
 Set Enabled value for page content component. More...
 
 enable ()
 Enable page content. More...
 
 disable ()
 Disable page content. More...
 
 isEnabled ()
 Check whether page content is enabled. More...
 
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl ($a_output, $a_mode)
 Modify page content after xsl. More...
 

Static Public Member Functions

static getLangVars ()
 Get lang vars needed for editing. More...
 
- Static Public Member Functions inherited from ilPageContent
static incEdId ($ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container. More...
 
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId ($a, $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, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content. More...
 
static afterPageUpdate ($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete ($a_page)
 Before page is being deleted. More...
 
static afterPageHistoryEntry ($a_page, DOMDocument $a_old_domdoc, $a_old_xml, $a_old_nr)
 After page history entry has been created. More...
 

Data Fields

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

Protected Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from ilPageContent
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

Detailed Description

Class ilPCTabs.

Tabbed contents (see ILIAS DTD)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ addTab()

ilPCTabs::addTab (   $a_caption)

Add a tab.

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

343 {
344 $new_item = $this->dom->create_element("Tab");
345 $new_item = $this->tabs_node->append_child($new_item);
346 ilDOMUtil::setFirstOptionalElement($this->dom, $new_item, "TabCaption",
347 array(), $a_caption, array());
348 }
static setFirstOptionalElement($doc, $parent_node, $a_node_name, $a_successors, $a_content, $a_attributes, $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found,...

References ilDOMUtil\setFirstOptionalElement().

+ Here is the call graph for this function:

◆ create()

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

Create new Tabs node.

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

64 {
65 $this->node = $this->createPageContentNode();
66 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
67 $this->tabs_node = $this->dom->create_element("Tabs");
68 $this->tabs_node = $this->node->append_child($this->tabs_node);
69 }
const IL_INSERT_AFTER
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element)

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

+ Here is the call graph for this function:

◆ deleteTab()

ilPCTabs::deleteTab (   $a_hier_id,
  $a_pc_id 
)

Save positions of tabs.

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

322 {
323 // File Item
324 $childs = $this->tabs_node->child_nodes();
325 $nodes = array();
326 for ($i=0; $i<count($childs); $i++)
327 {
328 if ($childs[$i]->node_name() == "Tab")
329 {
330 if ($a_pc_id == $childs[$i]->get_attribute("PCID") &&
331 $a_hier_id == $childs[$i]->get_attribute("HierId"))
332 {
333 $childs[$i]->unlink($childs[$i]);
334 }
335 }
336 }
337 }

◆ getAutoTime()

ilPCTabs::getAutoTime ( )

Get auto animation waiting time.

Returns
int auto animation time

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

396 {
397 return $this->tabs_node->get_attribute("AutoAnimWait");
398 }

◆ getBehavior()

ilPCTabs::getBehavior ( )

Get behavior.

Returns
string behavior

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

193 {
194 return $this->tabs_node->get_attribute("Behavior");
195 }

◆ getCaption()

ilPCTabs::getCaption (   $a_hier_id,
  $a_pc_id 
)

Get caption.

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

234 {
235 $captions = array();
236 $tab_nodes = $this->tabs_node->child_nodes();
237 $k = 0;
238 for($i = 0; $i < count($tab_nodes); $i++)
239 {
240 if ($tab_nodes[$i]->node_name() == "Tab")
241 {
242 if ($a_pc_id == $tab_nodes[$i]->get_attribute("PCID") &&
243 ($a_hier_id == $tab_nodes[$i]->get_attribute("HierId")))
244 {
245 $tab_node_childs = $tab_nodes[$i]->child_nodes();
246 for($j = 0; $j < count($tab_node_childs); $j++)
247 {
248 if ($tab_node_childs[$j]->node_name() == "TabCaption")
249 {
250 return $tab_node_childs[$j]->get_content();
251 }
252 }
253 }
254 }
255 }
256
257 return "";
258 }

◆ getCaptions()

ilPCTabs::getCaptions ( )

Get captions.

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

201 {
202 $captions = array();
203 $tab_nodes = $this->tabs_node->child_nodes();
204 $k = 0;
205 for($i = 0; $i < count($tab_nodes); $i++)
206 {
207 if ($tab_nodes[$i]->node_name() == "Tab")
208 {
209 $pc_id = $tab_nodes[$i]->get_attribute("PCID");
210 $hier_id = $tab_nodes[$i]->get_attribute("HierId");
211
212 $tab_node_childs = $tab_nodes[$i]->child_nodes();
213 $current_caption = "";
214 for($j = 0; $j < count($tab_node_childs); $j++)
215 {
216 if ($tab_node_childs[$j]->node_name() == "TabCaption")
217 {
218 $current_caption = $tab_node_childs[$j]->get_content();
219 }
220 }
221 $captions[] = array("pos" => $k,
222 "caption" => $current_caption, "pc_id" => $pc_id, "hier_id" => $hier_id);
223 $k++;
224 }
225 }
226
227 return $captions;
228 }

References ilPageContent\$hier_id.

◆ getContentHeight()

ilPCTabs::getContentHeight ( )

Get content height.

Returns
int content height

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

153 {
154 return $this->tabs_node->get_attribute("ContentHeight");
155 }

◆ getContentWidth()

ilPCTabs::getContentWidth ( )

Get content width.

Returns
int content width

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

133 {
134 return $this->tabs_node->get_attribute("ContentWidth");
135 }

◆ getCssFiles()

ilPCTabs::getCssFiles (   $a_mode)

Get Javascript files.

Reimplemented from ilPageContent.

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

433 {
434 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
436 }

References ilAccordionGUI\getLocalCssFiles().

+ Here is the call graph for this function:

◆ getHorizontalAlign()

ilPCTabs::getHorizontalAlign ( )

Get horizontal align.

Returns
string horizontal align

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

173 {
174 return $this->tabs_node->get_attribute("HorizontalAlign");
175 }

◆ getJavascriptFiles()

ilPCTabs::getJavascriptFiles (   $a_mode)

Get Javascript files.

Reimplemented from ilPageContent.

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

424 {
425 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
427 }
static getLocalJavascriptFiles()

References ilAccordionGUI\getLocalJavascriptFiles().

+ Here is the call graph for this function:

◆ getLangVars()

static ilPCTabs::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

Reimplemented from ilPageContent.

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

375 {
376 return array("pc_vacc", "pc_hacc", "pc_carousel");
377 }

◆ getRandomStart()

ilPCTabs::getRandomStart ( )

Get random start.

Returns
bool random start

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

416 {
417 return $this->tabs_node->get_attribute("RandomStart");
418 }

◆ getTabType()

ilPCTabs::getTabType ( )

Get type of tabs.

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

113 {
114 return $this->tabs_node->get_attribute("Type");
115 }

◆ getTemplate()

ilPCTabs::getTemplate ( )

Get template.

Returns
string template

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

366 {
367 return $this->tabs_node->get_attribute("Template");
368 }

◆ init()

ilPCTabs::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

47 {
48 $this->setType("tabs");
49 }
setType($a_type)
Set Type.

References ilPageContent\setType().

+ Here is the call graph for this function:

◆ saveCaptions()

ilPCTabs::saveCaptions (   $a_captions)

Add Tab items.

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

294 {
295 // iterate all tab nodes
296 $tab_nodes = $this->tabs_node->child_nodes();
297 for($i = 0; $i < count($tab_nodes); $i++)
298 {
299 if ($tab_nodes[$i]->node_name() == "Tab")
300 {
301 $pc_id = $tab_nodes[$i]->get_attribute("PCID");
302 $hier_id = $tab_nodes[$i]->get_attribute("HierId");
303 $k = $hier_id.":".$pc_id;
304 // if caption given, set it, otherwise delete caption subitem
305 if ($a_captions[$k] != "")
306 {
307 ilDOMUtil::setFirstOptionalElement($this->dom, $tab_nodes[$i], "TabCaption",
308 array(), $a_captions[$k], array());
309 }
310 else
311 {
312 ilDOMUtil::deleteAllChildsByName($tab_nodes[$i], array("TabCaption"));
313 }
314 }
315 }
316 }
static deleteAllChildsByName($a_parent, $a_node_names)
delete all childs of a node by names in $a_node_names

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

+ Here is the call graph for this function:

◆ savePositions()

ilPCTabs::savePositions (   $a_pos)

Save positions of tabs.

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

264 {
265 asort($a_pos);
266
267 // File Item
268 $childs = $this->tabs_node->child_nodes();
269 $nodes = array();
270 for ($i=0; $i<count($childs); $i++)
271 {
272 if ($childs[$i]->node_name() == "Tab")
273 {
274 $pc_id = $childs[$i]->get_attribute("PCID");
275 $hier_id = $childs[$i]->get_attribute("HierId");
276 $nodes[$hier_id.":".$pc_id] = $childs[$i];
277 $childs[$i]->unlink($childs[$i]);
278 }
279 }
280
281 foreach($a_pos as $k => $v)
282 {
283 if (is_object($nodes[$k]))
284 {
285 $nodes[$k] = $this->tabs_node->append_child($nodes[$k]);
286 }
287 }
288 }

References ilPageContent\$hier_id.

◆ setAutoTime()

ilPCTabs::setAutoTime (   $a_val)

Set auto animation waiting time.

Parameters
int$a_valauto animation time

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

386 {
387 $this->setTabsAttribute("AutoAnimWait", $a_val);
388 }
setTabsAttribute($a_attr, $a_value)
Set attribute of tabs tag.

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setBehavior()

ilPCTabs::setBehavior (   $a_val)

Set behavior.

Parameters
stringbehavior

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

183 {
184 $this->setTabsAttribute("Behavior", $a_val);
185 }

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setContentHeight()

ilPCTabs::setContentHeight (   $a_val)

Set content height.

Parameters
intcontent height

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

143 {
144 $this->setTabsAttribute("ContentHeight", $a_val);
145 }

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setContentWidth()

ilPCTabs::setContentWidth (   $a_val)

Set content width.

Parameters
intcontent width

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

123 {
124 $this->setTabsAttribute("ContentWidth", $a_val);
125 }

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setHorizontalAlign()

ilPCTabs::setHorizontalAlign (   $a_val)

Set horizontal align.

Parameters
stringhorizontal align

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

163 {
164 $this->setTabsAttribute("HorizontalAlign", $a_val);
165 }

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setNode()

ilPCTabs::setNode (   $a_node)

Set content node.

Reimplemented from ilPageContent.

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

55 {
56 parent::setNode($a_node); // this is the PageContent node
57 $this->tabs_node = $a_node->first_child(); // this is the Tabs node
58 }

◆ setRandomStart()

ilPCTabs::setRandomStart (   $a_val)

Set random start.

Parameters
bool$a_valrandom start

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

406 {
407 $this->setTabsAttribute("RandomStart", $a_val);
408 }

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setTabsAttribute()

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

Set attribute of tabs tag.

Parameters
stringattribute name
stringattribute value

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

78 {
79 if (!empty($a_value))
80 {
81 $this->tabs_node->set_attribute($a_attr, $a_value);
82 }
83 else
84 {
85 if ($this->tabs_node->has_attribute($a_attr))
86 {
87 $this->tabs_node->remove_attribute($a_attr);
88 }
89 }
90 }

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

+ Here is the caller graph for this function:

◆ setTabType()

ilPCTabs::setTabType (   $a_type = "HorizontalTabs")

Set type of tabs.

Parameters
string$a_type("HorizontalTabs" | "Accordion")

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

98 {
99 switch ($a_type)
100 {
104 $this->tabs_node->set_attribute("Type", $a_type);
105 break;
106 }
107 }
const CAROUSEL
const ACCORDION_HOR
const ACCORDION_VER
$a_type
Definition: workflow.php:93

References $a_type, ACCORDION_HOR, ACCORDION_VER, and CAROUSEL.

◆ setTemplate()

ilPCTabs::setTemplate (   $a_template)

Set template.

Parameters
string$a_templatetemplate

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

356 {
357 $this->setTabsAttribute("Template", $a_template);
358 }

References setTabsAttribute().

+ Here is the call graph for this function:

Field Documentation

◆ $tabs_node

ilPCTabs::$tabs_node

Definition at line 38 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: