ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (string $a_title="", string $a_postvar="")
 
 addListNode (string $a_id, string $a_text, string $a_parent="0", bool $a_checked=false, bool $a_disabled=false, string $a_img_src="", string $a_img_alt="", string $a_post_var="")
 
 setValue (string $a_value)
 
 getValue ()
 
 setValueByArray (array $a_values)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 render ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 

Protected Attributes

string $value = "1"
 
array $checked = []
 
array $list_nodes = []
 
ilNestedList $list
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Detailed Description

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

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
12 This component will be removed with ILIAS 12

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

37 {
38 global $DIC;
39
40 $this->lng = $DIC->language();
41 parent::__construct($a_title, $a_postvar);
42 $this->setType("nested_list");
43
44 $this->list = new ilNestedList();
45 $this->list->setListClass("il_Explorer");
46 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ addListNode()

ilNestedListInputGUI::addListNode ( string  $a_id,
string  $a_text,
string  $a_parent = "0",
bool  $a_checked = false,
bool  $a_disabled = false,
string  $a_img_src = "",
string  $a_img_alt = "",
string  $a_post_var = "" 
)

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

57 {
58 $this->list_nodes[$a_id] = array("text" => $a_text,
59 "parent" => $a_parent, "checked" => $a_checked, "disabled" => $a_disabled,
60 "img_src" => $a_img_src, "img_alt" => $a_img_alt, "post_var" => $a_post_var);
61 }

◆ checkInput()

ilNestedListInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

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

82 : bool
83 {
84 return true;
85 }

◆ getInput()

ilNestedListInputGUI::getInput ( )

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

87 : array
88 {
89 return $this->strArray($this->getPostVar());
90 }

References ilFormPropertyGUI\getPostVar(), and ilFormPropertyGUI\strArray().

+ Here is the call graph for this function:

◆ getValue()

ilNestedListInputGUI::getValue ( )

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

68 : string
69 {
70 return $this->value;
71 }

References $value.

◆ insert()

ilNestedListInputGUI::insert ( ilTemplate  $a_tpl)

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

126 : void
127 {
128 $html = $this->render();
129
130 $a_tpl->setCurrentBlock("prop_generic");
131 $a_tpl->setVariable("PROP_GENERIC", $html);
132 $a_tpl->parseCurrentBlock();
133 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilTemplate\parseCurrentBlock(), render(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ render()

ilNestedListInputGUI::render ( )

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

92 : string
93 {
94 foreach ($this->list_nodes as $id => $n) {
95 if ($n["post_var"] == "") {
96 $post_var = $this->getPostVar() . "[]";
97 } else {
98 $post_var = $n["post_var"];
99 }
100 $value = $id;
102 $n["checked"],
103 $post_var,
104 (string) $value,
105 $n["disabled"]
106 );
107 if ($n["img_src"] != "") {
108 $item_html .= ilUtil::img(
109 $n["img_src"],
110 $n["img_alt"],
111 "",
112 "",
113 0,
114 "",
115 "ilIcon"
116 ) . " ";
117 }
118 $item_html .= $n["text"];
119
120 $this->list->addListNode($item_html, (string) $id, $n["parent"]);
121 }
122
123 return $this->list->getHTML();
124 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.

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

Referenced by insert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValue()

ilNestedListInputGUI::setValue ( string  $a_value)

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

63 : void
64 {
65 $this->value = $a_value;
66 }

◆ setValueByArray()

ilNestedListInputGUI::setValueByArray ( array  $a_values)

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

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

Field Documentation

◆ $checked

array ilNestedListInputGUI::$checked = []
protected

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

◆ $list

ilNestedList ilNestedListInputGUI::$list
protected

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

◆ $list_nodes

array ilNestedListInputGUI::$list_nodes = []
protected

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

◆ $value

string ilNestedListInputGUI::$value = "1"
protected

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

Referenced by getValue(), and render().


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