ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNestedList Class Reference

Nested List. More...

+ Collaboration diagram for ilNestedList:

Public Member Functions

 __constructor ()
 Constructor.
 setItemClass ($a_val)
 Set li class.
 getItemClass ()
 Get li class.
 setListClass ($a_val, $a_depth=0)
 Set list class.
 getListClass ($a_depth=0)
 Get list class.
 addListNode ($a_content, $a_id, $a_parent=0)
 Add list node.
 setAutoNumbering ($a_val)
 Set auto numbering.
 getAutoNumbering ()
 Get auto numbering.
 getNumbers ()
 Get numbers.
 getHTML ()
 Get HTML.
 renderNode ($a_id, $tpl, $depth, &$nr)
 Render node.
 listItemStart ($tpl)
 List item start.
 listItemEnd ($tpl)
 List item end.
 listStart ($tpl, $depth)
 List start.
 listEnd ($tpl)
 List end.

Protected Attributes

 $item_class = "il_Explorer"
 $list_class = array()
 $auto_numbering = false
 $nr = array()

Detailed Description

Nested List.

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

Definition at line 11 of file class.ilNestedList.php.

Member Function Documentation

ilNestedList::__constructor ( )

Constructor.

Parameters
@return

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

{
$this->list_class[0] = "il_Explorer";
$this->childs[0] = array();
}
ilNestedList::addListNode (   $a_content,
  $a_id,
  $a_parent = 0 
)

Add list node.

Parameters
@return

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

{
$this->nodes[$a_id] = $a_content;
$this->childs[$a_parent][] = $a_id;
}
ilNestedList::getAutoNumbering ( )

Get auto numbering.

Returns
bool auto numbering

Definition at line 98 of file class.ilNestedList.php.

References $auto_numbering.

Referenced by renderNode().

{
}

+ Here is the caller graph for this function:

ilNestedList::getHTML ( )

Get HTML.

Parameters
@return

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

References $nr, $tpl, listEnd(), listStart(), and renderNode().

{
$tpl = new ilTemplate("tpl.nested_list.html", true, true, "Services/UIComponent/NestedList");
$nr = array();
$depth = 1;
if (is_array($this->childs[0]) && count($this->childs[0]) > 0)
{
$this->listStart($tpl, $depth);
foreach ($this->childs[0] as $child)
{
$this->renderNode($child, $tpl, $depth, $nr);
}
$this->listEnd($tpl);
}
return $tpl->get();
}

+ Here is the call graph for this function:

ilNestedList::getItemClass ( )

Get li class.

Returns
string li class

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

References $item_class.

Referenced by listItemStart().

{
}

+ Here is the caller graph for this function:

ilNestedList::getListClass (   $a_depth = 0)

Get list class.

Returns
string list class

Definition at line 66 of file class.ilNestedList.php.

Referenced by listStart().

{
return $this->list_class[$a_depth];
}

+ Here is the caller graph for this function:

ilNestedList::getNumbers ( )

Get numbers.

Returns
array number array

Definition at line 108 of file class.ilNestedList.php.

References $nr.

{
return $this->nr;
}
ilNestedList::listEnd (   $tpl)

List end.

Parameters
@return

Definition at line 254 of file class.ilNestedList.php.

References $tpl.

Referenced by getHTML(), and renderNode().

{
//echo "<br>listEnd";
$tpl->touchBlock("list_end");
$tpl->touchBlock("tag");
}

+ Here is the caller graph for this function:

ilNestedList::listItemEnd (   $tpl)

List item end.

Parameters
@return

Definition at line 215 of file class.ilNestedList.php.

References $tpl.

Referenced by renderNode().

{
$tpl->touchBlock("list_item_end");
$tpl->touchBlock("tag");
}

+ Here is the caller graph for this function:

ilNestedList::listItemStart (   $tpl)

List item start.

Parameters
@return

Definition at line 194 of file class.ilNestedList.php.

References $tpl, and getItemClass().

Referenced by renderNode().

{
if ($this->getItemClass() != "")
{
$tpl->setCurrentBlock("list_item_start");
$tpl->setVariable("LI_CLASS", ' class="'.$this->getItemClass().'" ');
$tpl->parseCurrentBlock();
}
else
{
$tpl->touchBlock("list_item_start");
}
$tpl->touchBlock("tag");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNestedList::listStart (   $tpl,
  $depth 
)

List start.

Parameters
@return

Definition at line 227 of file class.ilNestedList.php.

References $tpl, and getListClass().

Referenced by getHTML(), and renderNode().

{
//echo "<br>listStart";
$class = ($this->getListClass($depth) != "")
? $this->getListClass($depth)
: $this->getListClass();
//echo "-$class-";
if ($class != "")
{
$tpl->setCurrentBlock("list_start");
$tpl->setVariable("UL_CLASS", ' class="'.$class.'" ');
$tpl->parseCurrentBlock();
}
else
{
$tpl->touchBlock("list_start");
}
$tpl->touchBlock("tag");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNestedList::renderNode (   $a_id,
  $tpl,
  $depth,
$nr 
)

Render node.

Parameters
@return

Definition at line 145 of file class.ilNestedList.php.

References $nr, $tpl, getAutoNumbering(), listEnd(), listItemEnd(), listItemStart(), and listStart().

Referenced by getHTML().

{
if (!isset($nr[$depth]))
{
$nr[$depth] = 1;
}
else
{
$nr[$depth]++;
}
$nr_str = $sep = "";
if ($this->getAutoNumbering())
{
for($i = 1; $i <= $depth; $i++)
{
$nr_str.= $sep.$nr[$i];
$sep = ".";
}
}
$tpl->setCurrentBlock("content");
$tpl->setVariable("CONTENT", $nr_str." ".$this->nodes[$a_id]);
$this->nr[$a_id] = $nr_str;
//echo "<br>".$this->nodes[$a_id];
$tpl->parseCurrentBlock();
$tpl->touchBlock("tag");
if (is_array($this->childs[$a_id]) && count($this->childs[$a_id]) > 0)
{
$this->listStart($tpl, $depth + 1);
foreach ($this->childs[$a_id] as $child)
{
$this->renderNode($child, $tpl, $depth + 1, $nr);
}
$this->listEnd($tpl);
}
unset($nr[$depth + 1]);
$this->listItemEnd($tpl);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNestedList::setAutoNumbering (   $a_val)

Set auto numbering.

Parameters
bool$a_valauto numbering

Definition at line 88 of file class.ilNestedList.php.

{
$this->auto_numbering = $a_val;
}
ilNestedList::setItemClass (   $a_val)

Set li class.

Parameters
stringli class

Definition at line 35 of file class.ilNestedList.php.

{
$this->item_class = $a_val;
}
ilNestedList::setListClass (   $a_val,
  $a_depth = 0 
)

Set list class.

Parameters
stringlist class

Definition at line 55 of file class.ilNestedList.php.

{
//var_dump($a_val);
$this->list_class[$a_depth] = $a_val;
}

Field Documentation

ilNestedList::$auto_numbering = false
protected

Definition at line 15 of file class.ilNestedList.php.

Referenced by getAutoNumbering().

ilNestedList::$item_class = "il_Explorer"
protected

Definition at line 13 of file class.ilNestedList.php.

Referenced by getItemClass().

ilNestedList::$list_class = array()
protected

Definition at line 14 of file class.ilNestedList.php.

ilNestedList::$nr = array()
protected

Definition at line 16 of file class.ilNestedList.php.

Referenced by getHTML(), getNumbers(), and renderNode().


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