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

This class represents a (nested) list of checkboxes (could be extended for radio items, too) More...

+ Inheritance diagram for ilNestedListInputGUI:
+ Collaboration diagram for ilNestedListInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 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. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ()
 Render item. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Protected Attributes

 $value = "1"
 
 $checked
 
 $list_nodes = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a (nested) list of checkboxes (could be extended for radio items, too)

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

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

Constructor & Destructor Documentation

◆ __construct()

ilNestedListInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 26 of file class.ilNestedListInputGUI.php.

References ilFormPropertyGUI\setType().

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  }
Nested List.
setType($a_type)
Set Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ addListNode()

ilNestedListInputGUI::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.

Parameters

Definition at line 41 of file class.ilNestedListInputGUI.php.

References array.

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  }
Create styles array
The data for the language used.

◆ checkInput()

ilNestedListInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

References $lng.

89  {
90  global $lng;
91 
92  return true;
93  }
global $lng
Definition: privfeed.php:17

◆ getValue()

ilNestedListInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 64 of file class.ilNestedListInputGUI.php.

References $value.

◆ insert()

ilNestedListInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 131 of file class.ilNestedListInputGUI.php.

References $html, and render().

132  {
133  $html = $this->render();
134 
135  $a_tpl->setCurrentBlock("prop_generic");
136  $a_tpl->setVariable("PROP_GENERIC", $html);
137  $a_tpl->parseCurrentBlock();
138  }
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ render()

ilNestedListInputGUI::render ( )

Render item.

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

References $n, $value, ilUtil\formCheckbox(), ilFormPropertyGUI\getPostVar(), and ilUtil\img().

Referenced by insert().

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  }
getPostVar()
Get Post Variable.
$n
Definition: RandomTest.php:80
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValue()

ilNestedListInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

55  {
56  $this->value = $a_value;
57  }

◆ setValueByArray()

ilNestedListInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
object$a_itemItem

Definition at line 74 of file class.ilNestedListInputGUI.php.

75  {
76 // $this->setChecked($a_values[$this->getPostVar()]);
77 // foreach($this->getSubItems() as $item)
78 // {
79 // $item->setValueByArray($a_values);
80 // }
81  }

Field Documentation

◆ $checked

ilNestedListInputGUI::$checked
protected

Definition at line 17 of file class.ilNestedListInputGUI.php.

◆ $list_nodes

ilNestedListInputGUI::$list_nodes = array()
protected

Definition at line 18 of file class.ilNestedListInputGUI.php.

◆ $value

ilNestedListInputGUI::$value = "1"
protected

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

Referenced by getValue(), and render().


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