ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCTabs Class Reference

Class ilPCTabs. More...

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

Public Member Functions

 init ()
 Init page content component.
 setNode (&$a_node)
 Set content node.
 create (&$a_pg_obj, $a_hier_id, $a_pc_id="")
 Create new Tabs node.
 setTabType ($a_type="HorizontalTabs")
 Set type of tabs.
 getTabType ()
 Get type of tabs.
 setContentWidth ($a_val)
 Set content width.
 getContentWidth ()
 Get content width.
 setContentHeight ($a_val)
 Set content height.
 getContentHeight ()
 Get content height.
 setHorizontalAlign ($a_val)
 Set horizontal align.
 getHorizontalAlign ()
 Get horizontal align.
 setBehavior ($a_val)
 Set behavior.
 getBehavior ()
 Get behavior.
 getCaptions ()
 Get captions.
 getCaption ($a_hier_id, $a_pc_id)
 Get caption.
 savePositions ($a_pos)
 Save positions of tabs.
 saveCaptions ($a_captions)
 Add Tab items.
 deleteTab ($a_hier_id, $a_pc_id)
 Save positions of tabs.
 addTab ($a_caption)
 Add a tab.
 setTemplate ($a_template)
 Set template.
 getTemplate ()
 Get template.
- Public Member Functions inherited from ilPageContent
 __construct ($a_dom)
 Constructor.
 getType ()
 Get type of page content.
getNode ()
 Get xml node of page content.
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure.
 getHierId ()
 Get hierarchical id.
 lookupHierId ()
 Get hierarchical id from dom.
 readHierId ()
 Read PC Id.
 setPcId ($a_pcid)
 Set PC Id.
 getPCId ()
 Get PC Id.
 readPCId ()
 Read PC Id.
 isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b.
 setEnabled ($value)
 Set Enabled value for page content component.
 enable ()
 Enable page content.
 disable ()
 Disable page content.
 isEnabled ()
 Check whether page content is enabled.
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element)

Data Fields

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

Protected Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContent
static incEdId ($ed_id)
 Increases an hierarchical editing id at lowest level (last number)
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number)
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container.
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order.

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

ilPCTabs::addTab (   $a_caption)

Add a tab.

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

References ilDOMUtil\setFirstOptionalElement().

{
$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());
}

+ Here is the call graph for this function:

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

Create new Tabs node.

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

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

{
$this->node = $this->createPageContentNode();
$a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
$this->tabs_node =& $this->dom->create_element("Tabs");
$this->tabs_node =& $this->node->append_child($this->tabs_node);
}

+ Here is the call graph for this function:

ilPCTabs::deleteTab (   $a_hier_id,
  $a_pc_id 
)

Save positions of tabs.

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

{
// File Item
$childs = $this->tabs_node->child_nodes();
$nodes = array();
for ($i=0; $i<count($childs); $i++)
{
if ($childs[$i]->node_name() == "Tab")
{
if ($a_pc_id == $childs[$i]->get_attribute("PCID") &&
$a_hier_id == $childs[$i]->get_attribute("HierId"))
{
$childs[$i]->unlink($childs[$i]);
}
}
}
}
ilPCTabs::getBehavior ( )

Get behavior.

Returns
string behavior

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

{
return $this->tabs_node->get_attribute("Behavior");
}
ilPCTabs::getCaption (   $a_hier_id,
  $a_pc_id 
)

Get caption.

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

{
$captions = array();
$tab_nodes = $this->tabs_node->child_nodes();
$k = 0;
for($i = 0; $i < count($tab_nodes); $i++)
{
if ($tab_nodes[$i]->node_name() == "Tab")
{
if ($a_pc_id == $tab_nodes[$i]->get_attribute("PCID") &&
($a_hier_id == $tab_nodes[$i]->get_attribute("HierId")))
{
$tab_node_childs = $tab_nodes[$i]->child_nodes();
for($j = 0; $j < count($tab_node_childs); $j++)
{
if ($tab_node_childs[$j]->node_name() == "TabCaption")
{
return $tab_node_childs[$j]->get_content();
}
}
}
}
}
return "";
}
ilPCTabs::getCaptions ( )

Get captions.

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

References ilPageContent\$hier_id.

{
$captions = array();
$tab_nodes = $this->tabs_node->child_nodes();
$k = 0;
for($i = 0; $i < count($tab_nodes); $i++)
{
if ($tab_nodes[$i]->node_name() == "Tab")
{
$pc_id = $tab_nodes[$i]->get_attribute("PCID");
$hier_id = $tab_nodes[$i]->get_attribute("HierId");
$tab_node_childs = $tab_nodes[$i]->child_nodes();
$current_caption = "";
for($j = 0; $j < count($tab_node_childs); $j++)
{
if ($tab_node_childs[$j]->node_name() == "TabCaption")
{
$current_caption = $tab_node_childs[$j]->get_content();
}
}
$captions[] = array("pos" => $k,
"caption" => $current_caption, "pc_id" => $pc_id, "hier_id" => $hier_id);
$k++;
}
}
return $captions;
}
ilPCTabs::getContentHeight ( )

Get content height.

Returns
int content height

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

{
return $this->tabs_node->get_attribute("ContentHeight");
}
ilPCTabs::getContentWidth ( )

Get content width.

Returns
int content width

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

{
return $this->tabs_node->get_attribute("ContentWidth");
}
ilPCTabs::getHorizontalAlign ( )

Get horizontal align.

Returns
string horizontal align

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

{
return $this->tabs_node->get_attribute("HorizontalAlign");
}
ilPCTabs::getTabType ( )

Get type of tabs.

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

{
return $this->tabs_node->get_attribute("Type");
}
ilPCTabs::getTemplate ( )

Get template.

Returns
string template

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

{
return $this->tabs_node->get_attribute("Template");
}
ilPCTabs::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

References ilPageContent\setType().

{
$this->setType("tabs");
}

+ Here is the call graph for this function:

ilPCTabs::saveCaptions (   $a_captions)

Add Tab items.

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

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

{
// iterate all tab nodes
$tab_nodes = $this->tabs_node->child_nodes();
for($i = 0; $i < count($tab_nodes); $i++)
{
if ($tab_nodes[$i]->node_name() == "Tab")
{
$pc_id = $tab_nodes[$i]->get_attribute("PCID");
$hier_id = $tab_nodes[$i]->get_attribute("HierId");
$k = $hier_id.":".$pc_id;
// if caption given, set it, otherwise delete caption subitem
if ($a_captions[$k] != "")
{
ilDOMUtil::setFirstOptionalElement($this->dom, $tab_nodes[$i], "TabCaption",
array(), $a_captions[$k], array());
}
else
{
ilDOMUtil::deleteAllChildsByName($tab_nodes[$i], array("TabCaption"));
}
}
}
}

+ Here is the call graph for this function:

ilPCTabs::savePositions (   $a_pos)

Save positions of tabs.

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

References ilPageContent\$hier_id.

{
asort($a_pos);
// File Item
$childs = $this->tabs_node->child_nodes();
$nodes = array();
for ($i=0; $i<count($childs); $i++)
{
if ($childs[$i]->node_name() == "Tab")
{
$pc_id = $childs[$i]->get_attribute("PCID");
$hier_id = $childs[$i]->get_attribute("HierId");
$nodes[$hier_id.":".$pc_id] = $childs[$i];
$childs[$i]->unlink($childs[$i]);
}
}
foreach($a_pos as $k => $v)
{
if (is_object($nodes[$k]))
{
$nodes[$k] = $this->tabs_node->append_child($nodes[$k]);
}
}
}
ilPCTabs::setBehavior (   $a_val)

Set behavior.

Parameters
stringbehavior

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

References setTabsAttribute().

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

+ Here is the call graph for this function:

ilPCTabs::setContentHeight (   $a_val)

Set content height.

Parameters
intcontent height

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

References setTabsAttribute().

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

+ Here is the call graph for this function:

ilPCTabs::setContentWidth (   $a_val)

Set content width.

Parameters
intcontent width

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

References setTabsAttribute().

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

+ Here is the call graph for this function:

ilPCTabs::setHorizontalAlign (   $a_val)

Set horizontal align.

Parameters
stringhorizontal align

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

References setTabsAttribute().

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

+ Here is the call graph for this function:

ilPCTabs::setNode ( $a_node)

Set content node.

Reimplemented from ilPageContent.

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

{
parent::setNode($a_node); // this is the PageContent node
$this->tabs_node =& $a_node->first_child(); // this is the Tabs node
}
ilPCTabs::setTabsAttribute (   $a_attr,
  $a_value 
)
protected

Set attribute of tabs tag.

Parameters
stringattribute name
stringattribute value

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

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

{
if (!empty($a_value))
{
$this->tabs_node->set_attribute($a_attr, $a_value);
}
else
{
if ($this->tabs_node->has_attribute($a_attr))
{
$this->tabs_node->remove_attribute($a_attr);
}
}
}

+ Here is the caller graph for this function:

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

Set type of tabs.

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

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

References ACCORDION_HOR, and ACCORDION_VER.

{
switch ($a_type)
{
$this->tabs_node->set_attribute("Type", $a_type);
break;
}
}
ilPCTabs::setTemplate (   $a_template)

Set template.

Parameters
string$a_templatetemplate

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

References setTabsAttribute().

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

+ Here is the call graph for this function:

Field Documentation

ilPCTabs::$tabs_node

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

const ilPCTabs::ACCORDION_HOR = "HorizontalAccordion"
const ilPCTabs::ACCORDION_VER = "VerticalAccordion"

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