ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilExplorerSelectInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilExplorerSelectInputGUI:
+ Collaboration diagram for ilExplorerSelectInputGUI:

Public Member Functions

 __construct (string $a_title, string $a_postvar, ilExplorerBaseGUI $a_explorer_gui, bool $a_multi=false)
 
 getExplHandleCmd ()
 Get explorer handle command function. More...
 
 handleExplorerCommand ()
 Handle explorer command. More...
 
 getTitleForNodeId ($a_id)
 Get title for node id (needs to be overwritten, if explorer is not a tree eplorer. More...
 
 setValue ($a_value)
 
 getValue ()
 
 setValueByArray (array $a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 render (string $a_mode="property_form")
 Render item. More...
 
 insert (ilTemplate $a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
- 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...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 

Protected Attributes

ilGlobalTemplateInterface $global_template
 
 $value
 
bool $multi_nodes
 
ilExplorerBaseGUI $explorer_gui
 
bool $disabled = false
 
- 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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Select explorer tree nodes input GUI

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
10

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

Constructor & Destructor Documentation

◆ __construct()

ilExplorerSelectInputGUI::__construct ( string  $a_title,
string  $a_postvar,
ilExplorerBaseGUI  $a_explorer_gui,
bool  $a_multi = false 
)

Definition at line 37 of file class.ilExplorerSelectInputGUI.php.

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setType().

42  {
43  global $DIC;
44 
45  $this->lng = $DIC->language();
46  $this->multi_nodes = $a_multi;
47  $this->explorer_gui = $a_explorer_gui;
48  $this->global_template = $DIC->ui()->mainTemplate();
49 
50  parent::__construct($a_title, $a_postvar);
51  $this->setType("exp_select");
52  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilExplorerSelectInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
bool Input ok, true/false

Definition at line 121 of file class.ilExplorerSelectInputGUI.php.

References ilFormPropertyGUI\$lng, getInput(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilLanguage\txt().

121  : bool
122  {
123  $lng = $this->lng;
124 
125  // check required
126  if ($this->getRequired()) {
127  if ((!$this->multi_nodes && trim($this->getInput()) === "") ||
128  ($this->multi_nodes && count($this->getInput()) === 0)) {
129  $this->setAlert($lng->txt("msg_input_is_required"));
130  return false;
131  }
132  }
133  return true;
134  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ getExplHandleCmd()

ilExplorerSelectInputGUI::getExplHandleCmd ( )

Get explorer handle command function.

Definition at line 57 of file class.ilExplorerSelectInputGUI.php.

Referenced by ilTaxSelectInputGUI\__construct(), and ilRepositorySelector2InputGUI\__construct().

57  : string
58  {
59  return "handleExplorerCommand";
60  }
+ Here is the caller graph for this function:

◆ getInput()

ilExplorerSelectInputGUI::getInput ( )
Returns
string|string[]

Definition at line 139 of file class.ilExplorerSelectInputGUI.php.

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

Referenced by checkInput().

140  {
141  if ($this->multi_nodes) {
142  return $this->strArray($this->getPostVar());
143  } else {
144  return $this->str($this->getPostVar());
145  }
146  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilExplorerSelectInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

Definition at line 248 of file class.ilExplorerSelectInputGUI.php.

References render().

248  : string
249  {
250  $html = $this->render("table_filter");
251  return $html;
252  }
render(string $a_mode="property_form")
Render item.
+ Here is the call graph for this function:

◆ getTitleForNodeId()

ilExplorerSelectInputGUI::getTitleForNodeId (   $a_id)
abstract

Get title for node id (needs to be overwritten, if explorer is not a tree eplorer.

Referenced by handleExplorerCommand(), and render().

+ Here is the caller graph for this function:

◆ getValue()

ilExplorerSelectInputGUI::getValue ( )
Returns
string|int|array node id or array of node ids (multi mode)

Definition at line 104 of file class.ilExplorerSelectInputGUI.php.

References $value.

Referenced by handleExplorerCommand(), and render().

+ Here is the caller graph for this function:

◆ handleExplorerCommand()

ilExplorerSelectInputGUI::handleExplorerCommand ( )

Handle explorer command.

Definition at line 65 of file class.ilExplorerSelectInputGUI.php.

References getTitleForNodeId(), and getValue().

65  : void
66  {
67  $val = $this->getValue();
68  if (is_array($val)) {
69  foreach ($val as $v) {
70  $this->explorer_gui->setNodeOpen($v);
71  $this->explorer_gui->setNodeSelected($v);
72  }
73  } elseif ($val != "") {
74  $this->explorer_gui->setNodeOpen($val);
75  $this->explorer_gui->setNodeSelected($val);
76  }
77  $this->explorer_gui->handleCommand();
78  }
+ Here is the call graph for this function:

◆ insert()

ilExplorerSelectInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Definition at line 238 of file class.ilExplorerSelectInputGUI.php.

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

238  : void
239  {
240  $a_tpl->setCurrentBlock("prop_generic");
241  $a_tpl->setVariable("PROP_GENERIC", $this->render());
242  $a_tpl->parseCurrentBlock();
243  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
render(string $a_mode="property_form")
Render item.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ render()

ilExplorerSelectInputGUI::render ( string  $a_mode = "property_form")

Render item.

Definition at line 151 of file class.ilExplorerSelectInputGUI.php.

References ilFormPropertyGUI\$lng, ILIAS\UI\examples\Input\Field\Checkbox\disabled(), ilFormPropertyGUI\getFieldId(), ilLinkButton\getInstance(), ilFormPropertyGUI\getPostVar(), getTitleForNodeId(), getValue(), and ilLanguage\txt().

Referenced by getTableFilterHTML(), and insert().

151  : string
152  {
153  $lng = $this->lng;
154 
155  $this->global_tpl->addJavascript("./Services/UIComponent/Explorer2/js/Explorer2.js");
156  $this->global_tpl->addJavascript("./Services/UIComponent/Modal/js/Modal.js");
157  $this->global_tpl->addOnLoadCode(
158  "il.Explorer2.initSelect('" . $this->getFieldId() . "');"
159  );
160 
161  $tpl = new ilTemplate("tpl.prop_expl_select.html", true, true, "Services/UIComponent/Explorer2");
162 
163  if ($a_mode !== "property_form") {
164  $tpl->touchBlock("tiny_presentation");
165  }
166 
167  // set values
168  $val = $this->getValue();
169  if (is_array($val)) {
170  $val_txt = $sep = "";
171  foreach ($val as $v) {
172  $tpl->setCurrentBlock("node_hid");
173  $tpl->setVariable("HID_NAME", $this->getPostVar() . "[]");
174  $tpl->setVariable("HID_VAL", $v);
175  $tpl->parseCurrentBlock();
176  $val_txt .= $sep . $this->getTitleForNodeId($v);
177  $sep = ", ";
178  $this->explorer_gui->setNodeOpen($v);
179  $this->explorer_gui->setNodeSelected($v);
180  }
181  $tpl->setVariable("VAL_TXT", $val_txt);
182  } elseif ($val != "") {
183  $tpl->setCurrentBlock("node_hid");
184  $tpl->setVariable("HID_NAME", $this->getPostVar());
185  $tpl->setVariable("HID_VAL", $val);
186  $tpl->parseCurrentBlock();
187  $tpl->setVariable("VAL_TXT", $this->getTitleForNodeId($val));
188  $this->explorer_gui->setNodeOpen($val);
189  $this->explorer_gui->setNodeSelected($val);
190  }
191 
192  $tpl->setVariable("POST_VAR", $this->getPostVar());
193  $tpl->setVariable("ID", $this->getFieldId());
194  $ol_js = "il.Explorer2.initSelect('" . $this->getFieldId() . "');";
195  $this->global_template->addOnLoadCode($ol_js);
196 
197  // $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
198 
199  //added disabled
200  if (!$this->disabled) {
201  $tpl->setCurrentBlock("txt_select");
202  $tpl->setVariable("TXT_SELECT", $lng->txt("select"));
203  $tpl->setVariable("ID_TXT_SELECT", $this->getFieldId());
204  $tpl->parseCurrentBlock();
205 
206  $tpl->setCurrentBlock("txt_reset");
207  $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
208  $tpl->setVariable("ID_TXT_RESET", $this->getFieldId());
209  $tpl->parseCurrentBlock();
210  }
211 
212  $tpl->setVariable("EXPL", $this->explorer_gui->getHTML());
213 
214  $top_tb = new ilToolbarGUI();
215 
216  $button = ilLinkButton::getInstance();
217  $button->setCaption("select");
218  $button->addCSSClass("ilExplSelectInputButS");
219  $button->setOmitPreventDoubleSubmission(true);
220  $top_tb->addStickyItem($button);
221 
222  $button = ilLinkButton::getInstance();
223  $button->setCaption("cancel");
224  $button->addCSSClass("ilExplSelectInputButC");
225  $button->setOmitPreventDoubleSubmission(true);
226  $top_tb->addStickyItem($button);
227 
228  // :TODO: we should probably clone the buttons properly
229  $tpl->setVariable("TOP_TB", $top_tb->getHTML());
230  $tpl->setVariable("BOT_TB", $top_tb->getHTML());
231 
232  return $tpl->get();
233  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getTitleForNodeId($a_id)
Get title for node id (needs to be overwritten, if explorer is not a tree eplorer.
disabled()
Example showing how to plug a disabled checkbox into a form.
Definition: disabled.php:10
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValue()

ilExplorerSelectInputGUI::setValue (   $a_value)
Parameters
string|int|arraynode id or array of node ids (multi mode)

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

Referenced by ilCronOerHarvester\addCustomSettingsToForm(), ilAdvancedMDSettingsGUI\initForm(), and setValueByArray().

88  : void
89  {
90  if ($this->multi_nodes && !is_array($a_value)) {
91  if ($a_value !== false) {
92  $this->value = array($a_value);
93  } else {
94  $this->value = array();
95  }
96  } else {
97  $this->value = $a_value;
98  }
99  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilExplorerSelectInputGUI::setValueByArray ( array  $a_values)

Set value by array.

Definition at line 112 of file class.ilExplorerSelectInputGUI.php.

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

112  : void
113  {
114  $this->setValue($a_values[$this->getPostVar()] ?? "");
115  }
+ Here is the call graph for this function:

Field Documentation

◆ $disabled

bool ilExplorerSelectInputGUI::$disabled = false
protected

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

◆ $explorer_gui

ilExplorerBaseGUI ilExplorerSelectInputGUI::$explorer_gui
protected

◆ $global_template

ilGlobalTemplateInterface ilExplorerSelectInputGUI::$global_template
protected

Definition at line 28 of file class.ilExplorerSelectInputGUI.php.

◆ $multi_nodes

bool ilExplorerSelectInputGUI::$multi_nodes
protected

Definition at line 33 of file class.ilExplorerSelectInputGUI.php.

◆ $value

ilExplorerSelectInputGUI::$value
protected

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

Referenced by getValue().


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