ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilNestedListInputGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once 'Services/UIComponent/Toolbar/interfaces/interface.ilToolbarItem.php';
6
15{
16 protected $value = "1";
17 protected $checked;
18 protected $list_nodes = array();
19
26 function __construct($a_title = "", $a_postvar = "")
27 {
28 parent::__construct($a_title, $a_postvar);
29 $this->setType("nested_list");
30
31 include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
32 $this->list = new ilNestedList();
33 $this->list->setListClass("il_Explorer");
34 }
35
41 function addListNode($a_id, $a_text, $a_parent = 0, $a_checked = false, $a_disabled = false,
42 $a_img_src = "", $a_img_alt = "", $a_post_var = "")
43 {
44 $this->list_nodes[$a_id] = array("text" => $a_text,
45 "parent" => $a_parent, "checked" => $a_checked, "disabled" => $a_disabled,
46 "img_src" => $a_img_src, "img_alt" => $a_img_alt, "post_var" => $a_post_var);
47 }
48
54 function setValue($a_value)
55 {
56 $this->value = $a_value;
57 }
58
64 function getValue()
65 {
66 return $this->value;
67 }
68
74 function setValueByArray($a_values)
75 {
76// $this->setChecked($a_values[$this->getPostVar()]);
77// foreach($this->getSubItems() as $item)
78// {
79// $item->setValueByArray($a_values);
80// }
81 }
82
88 function checkInput()
89 {
90 global $lng;
91
92 return true;
93 }
94
98 function render()
99 {
100 foreach ($this->list_nodes as $id => $n)
101 {
102 if ($n["post_var"] == "")
103 {
104 $post_var = $this->getPostVar()."[]";
105 $value = $id;
106 }
107 else
108 {
109 $post_var = $n["post_var"];
110 $value = $id;
111 }
112 $item_html = ilUtil::formCheckbox($n["checked"], $post_var, $value,
113 $n["disabled"]);
114 if ($n["img_src"] != "")
115 {
116 $item_html.= ilUtil::img($n["img_src"], $n["img_alt"])." ";
117 }
118 $item_html.= $n["text"];
119
120 $this->list->addListNode($item_html, $id, $n["parent"]);
121 }
122
123 return $this->list->getHTML();
124 }
125
131 function insert(&$a_tpl)
132 {
133 $html = $this->render();
134
135 $a_tpl->setCurrentBlock("prop_generic");
136 $a_tpl->setVariable("PROP_GENERIC", $html);
137 $a_tpl->parseCurrentBlock();
138 }
139
140}
$n
Definition: RandomTest.php:80
This class represents a property in a property form.
setType($a_type)
Set Type.
getPostVar()
Get Post Variable.
This class represents a (nested) list of checkboxes (could be extended for radio items,...
addListNode($a_id, $a_text, $a_parent=0, $a_checked=false, $a_disabled=false, $a_img_src="", $a_img_alt="", $a_post_var="")
Add list node.
insert(&$a_tpl)
Insert property html.
__construct($a_title="", $a_postvar="")
Constructor.
setValueByArray($a_values)
Set value by array.
checkInput()
Check input, strip slashes etc.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$html
Definition: example_001.php:87
global $lng
Definition: privfeed.php:40