ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 $ctrl
 
 $lng
 
 $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 $DIC, and ilFormPropertyGUI\setType().

27  {
28  global $DIC;
29 
30  $this->lng = $DIC->language();
31  parent::__construct($a_title, $a_postvar);
32  $this->setType("nested_list");
33 
34  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
35  $this->list = new ilNestedList();
36  $this->list->setListClass("il_Explorer");
37  }
global $DIC
Definition: saml.php:7
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 44 of file class.ilNestedListInputGUI.php.

References array.

53  {
54  $this->list_nodes[$a_id] = array("text" => $a_text,
55  "parent" => $a_parent, "checked" => $a_checked, "disabled" => $a_disabled,
56  "img_src" => $a_img_src, "img_alt" => $a_img_alt, "post_var" => $a_post_var);
57  }
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 98 of file class.ilNestedListInputGUI.php.

References ilFormPropertyGUI\$lng.

99  {
100  $lng = $this->lng;
101 
102  return true;
103  }

◆ getValue()

ilNestedListInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

◆ insert()

ilNestedListInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

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

References $html, and render().

141  {
142  $html = $this->render();
143 
144  $a_tpl->setCurrentBlock("prop_generic");
145  $a_tpl->setVariable("PROP_GENERIC", $html);
146  $a_tpl->parseCurrentBlock();
147  }
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ render()

ilNestedListInputGUI::render ( )

Render item.

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

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

Referenced by insert().

109  {
110  foreach ($this->list_nodes as $id => $n) {
111  if ($n["post_var"] == "") {
112  $post_var = $this->getPostVar() . "[]";
113  $value = $id;
114  } else {
115  $post_var = $n["post_var"];
116  $value = $id;
117  }
118  $item_html = ilUtil::formCheckbox(
119  $n["checked"],
120  $post_var,
121  $value,
122  $n["disabled"]
123  );
124  if ($n["img_src"] != "") {
125  $item_html.= ilUtil::img($n["img_src"], $n["img_alt"]) . " ";
126  }
127  $item_html.= $n["text"];
128 
129  $this->list->addListNode($item_html, $id, $n["parent"]);
130  }
131 
132  return $this->list->getHTML();
133  }
getPostVar()
Get Post Variable.
if(!array_key_exists('StateId', $_REQUEST)) $id
$n
Definition: RandomTest.php:85
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 64 of file class.ilNestedListInputGUI.php.

65  {
66  $this->value = $a_value;
67  }

◆ setValueByArray()

ilNestedListInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
object$a_itemItem

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

85  {
86  // $this->setChecked($a_values[$this->getPostVar()]);
87 // foreach($this->getSubItems() as $item)
88 // {
89 // $item->setValueByArray($a_values);
90 // }
91  }

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: