ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 322 of file class.ilPCTabs.php.

323 {
324 $new_item = $this->dom->create_element("Tab");
325 $new_item = $this->tabs_node->append_child($new_item);
327 $this->dom,
328 $new_item,
329 "TabCaption",
330 array(),
331 $a_caption,
332 array()
333 );
334 }
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 304 of file class.ilPCTabs.php.

305 {
306 // File Item
307 $childs = $this->tabs_node->child_nodes();
308 $nodes = array();
309 for ($i=0; $i<count($childs); $i++) {
310 if ($childs[$i]->node_name() == "Tab") {
311 if ($a_pc_id == $childs[$i]->get_attribute("PCID") &&
312 $a_hier_id == $childs[$i]->get_attribute("HierId")) {
313 $childs[$i]->unlink($childs[$i]);
314 }
315 }
316 }
317 }
$i
Definition: disco.tpl.php:19

References $i.

◆ getAutoTime()

ilPCTabs::getAutoTime ( )

Get auto animation waiting time.

Returns
int auto animation time

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

382 {
383 return $this->tabs_node->get_attribute("AutoAnimWait");
384 }

◆ getBehavior()

ilPCTabs::getBehavior ( )

Get behavior.

Returns
string behavior

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

188 {
189 return $this->tabs_node->get_attribute("Behavior");
190 }

◆ getCaption()

ilPCTabs::getCaption (   $a_hier_id,
  $a_pc_id 
)

Get caption.

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

225 {
226 $captions = array();
227 $tab_nodes = $this->tabs_node->child_nodes();
228 $k = 0;
229 for ($i = 0; $i < count($tab_nodes); $i++) {
230 if ($tab_nodes[$i]->node_name() == "Tab") {
231 if ($a_pc_id == $tab_nodes[$i]->get_attribute("PCID") &&
232 ($a_hier_id == $tab_nodes[$i]->get_attribute("HierId"))) {
233 $tab_node_childs = $tab_nodes[$i]->child_nodes();
234 for ($j = 0; $j < count($tab_node_childs); $j++) {
235 if ($tab_node_childs[$j]->node_name() == "TabCaption") {
236 return $tab_node_childs[$j]->get_content();
237 }
238 }
239 }
240 }
241 }
242
243 return "";
244 }

References $i.

◆ getCaptions()

ilPCTabs::getCaptions ( )

Get captions.

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

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

References ilPageContent\$hier_id, and $i.

◆ getContentHeight()

ilPCTabs::getContentHeight ( )

Get content height.

Returns
int content height

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

148 {
149 return $this->tabs_node->get_attribute("ContentHeight");
150 }

◆ getContentWidth()

ilPCTabs::getContentWidth ( )

Get content width.

Returns
int content width

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

128 {
129 return $this->tabs_node->get_attribute("ContentWidth");
130 }

◆ getCssFiles()

ilPCTabs::getCssFiles (   $a_mode)

Get Javascript files.

Reimplemented from ilPageContent.

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

419 {
420 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
422 }

References ilAccordionGUI\getLocalCssFiles().

+ Here is the call graph for this function:

◆ getHorizontalAlign()

ilPCTabs::getHorizontalAlign ( )

Get horizontal align.

Returns
string horizontal align

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

168 {
169 return $this->tabs_node->get_attribute("HorizontalAlign");
170 }

◆ getJavascriptFiles()

ilPCTabs::getJavascriptFiles (   $a_mode)

Get Javascript files.

Reimplemented from ilPageContent.

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

410 {
411 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
413 }
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 360 of file class.ilPCTabs.php.

361 {
362 return array("pc_vacc", "pc_hacc", "pc_carousel");
363 }

◆ getRandomStart()

ilPCTabs::getRandomStart ( )

Get random start.

Returns
bool random start

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

402 {
403 return $this->tabs_node->get_attribute("RandomStart");
404 }

◆ getTabType()

ilPCTabs::getTabType ( )

Get type of tabs.

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

108 {
109 return $this->tabs_node->get_attribute("Type");
110 }

◆ getTemplate()

ilPCTabs::getTemplate ( )

Get template.

Returns
string template

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

352 {
353 return $this->tabs_node->get_attribute("Template");
354 }

◆ 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 275 of file class.ilPCTabs.php.

276 {
277 // iterate all tab nodes
278 $tab_nodes = $this->tabs_node->child_nodes();
279 for ($i = 0; $i < count($tab_nodes); $i++) {
280 if ($tab_nodes[$i]->node_name() == "Tab") {
281 $pc_id = $tab_nodes[$i]->get_attribute("PCID");
282 $hier_id = $tab_nodes[$i]->get_attribute("HierId");
283 $k = $hier_id . ":" . $pc_id;
284 // if caption given, set it, otherwise delete caption subitem
285 if ($a_captions[$k] != "") {
287 $this->dom,
288 $tab_nodes[$i],
289 "TabCaption",
290 array(),
291 $a_captions[$k],
292 array()
293 );
294 } else {
295 ilDOMUtil::deleteAllChildsByName($tab_nodes[$i], array("TabCaption"));
296 }
297 }
298 }
299 }
static deleteAllChildsByName($a_parent, $a_node_names)
delete all childs of a node by names in $a_node_names

References ilPageContent\$hier_id, $i, 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 249 of file class.ilPCTabs.php.

250 {
251 asort($a_pos);
252
253 // File Item
254 $childs = $this->tabs_node->child_nodes();
255 $nodes = array();
256 for ($i=0; $i<count($childs); $i++) {
257 if ($childs[$i]->node_name() == "Tab") {
258 $pc_id = $childs[$i]->get_attribute("PCID");
259 $hier_id = $childs[$i]->get_attribute("HierId");
260 $nodes[$hier_id . ":" . $pc_id] = $childs[$i];
261 $childs[$i]->unlink($childs[$i]);
262 }
263 }
264
265 foreach ($a_pos as $k => $v) {
266 if (is_object($nodes[$k])) {
267 $nodes[$k] = $this->tabs_node->append_child($nodes[$k]);
268 }
269 }
270 }

References ilPageContent\$hier_id, and $i.

◆ setAutoTime()

ilPCTabs::setAutoTime (   $a_val)

Set auto animation waiting time.

Parameters
int$a_valauto animation time

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

372 {
373 $this->setTabsAttribute("AutoAnimWait", $a_val);
374 }
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 177 of file class.ilPCTabs.php.

178 {
179 $this->setTabsAttribute("Behavior", $a_val);
180 }

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setContentHeight()

ilPCTabs::setContentHeight (   $a_val)

Set content height.

Parameters
intcontent height

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

138 {
139 $this->setTabsAttribute("ContentHeight", $a_val);
140 }

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setContentWidth()

ilPCTabs::setContentWidth (   $a_val)

Set content width.

Parameters
intcontent width

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

118 {
119 $this->setTabsAttribute("ContentWidth", $a_val);
120 }

References setTabsAttribute().

+ Here is the call graph for this function:

◆ setHorizontalAlign()

ilPCTabs::setHorizontalAlign (   $a_val)

Set horizontal align.

Parameters
stringhorizontal align

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

158 {
159 $this->setTabsAttribute("HorizontalAlign", $a_val);
160 }

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 391 of file class.ilPCTabs.php.

392 {
393 $this->setTabsAttribute("RandomStart", $a_val);
394 }

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 $this->tabs_node->set_attribute($a_attr, $a_value);
81 } else {
82 if ($this->tabs_node->has_attribute($a_attr)) {
83 $this->tabs_node->remove_attribute($a_attr);
84 }
85 }
86 }

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 93 of file class.ilPCTabs.php.

94 {
95 switch ($a_type) {
99 $this->tabs_node->set_attribute("Type", $a_type);
100 break;
101 }
102 }
const CAROUSEL
const ACCORDION_HOR
const ACCORDION_VER
$a_type
Definition: workflow.php:92

References $a_type, ACCORDION_HOR, ACCORDION_VER, and CAROUSEL.

◆ setTemplate()

ilPCTabs::setTemplate (   $a_template)

Set template.

Parameters
string$a_templatetemplate

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

342 {
343 $this->setTabsAttribute("Template", $a_template);
344 }

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: