ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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

 $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
 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

Definition at line 24 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 34 of file class.ilExplorerSelectInputGUI.php.

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

39  {
40  global $DIC;
41 
42  $this->lng = $DIC->language();
43  $this->multi_nodes = $a_multi;
44  $this->explorer_gui = $a_explorer_gui;
45  $this->global_template = $DIC['tpl'];
46 
47  parent::__construct($a_title, $a_postvar);
48  $this->setType("exp_select");
49  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ 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 118 of file class.ilExplorerSelectInputGUI.php.

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

118  : bool
119  {
120  $lng = $this->lng;
121 
122  // check required
123  if ($this->getRequired()) {
124  if ((!$this->multi_nodes && trim($this->getInput()) === "") ||
125  ($this->multi_nodes && count($this->getInput()) === 0)) {
126  $this->setAlert($lng->txt("msg_input_is_required"));
127  return false;
128  }
129  }
130  return true;
131  }
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 54 of file class.ilExplorerSelectInputGUI.php.

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

54  : string
55  {
56  return "handleExplorerCommand";
57  }
+ Here is the caller graph for this function:

◆ getInput()

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

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

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

Referenced by checkInput().

137  {
138  if ($this->multi_nodes) {
139  return $this->strArray($this->getPostVar());
140  } else {
141  return $this->str($this->getPostVar());
142  }
143  }
+ 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 245 of file class.ilExplorerSelectInputGUI.php.

References render().

245  : string
246  {
247  $html = $this->render("table_filter");
248  return $html;
249  }
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 101 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 62 of file class.ilExplorerSelectInputGUI.php.

References getTitleForNodeId(), and getValue().

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

◆ insert()

ilExplorerSelectInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

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

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

235  : void
236  {
237  $a_tpl->setCurrentBlock("prop_generic");
238  $a_tpl->setVariable("PROP_GENERIC", $this->render());
239  $a_tpl->parseCurrentBlock();
240  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
render(string $a_mode="property_form")
Render item.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
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 148 of file class.ilExplorerSelectInputGUI.php.

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

Referenced by getTableFilterHTML(), and insert().

148  : string
149  {
150  $lng = $this->lng;
151 
152  $this->global_tpl->addJavascript("./Services/UIComponent/Explorer2/js/Explorer2.js");
153  $this->global_tpl->addJavascript("./Services/UIComponent/Modal/js/Modal.js");
154  $this->global_tpl->addOnLoadCode(
155  "il.Explorer2.initSelect('" . $this->getFieldId() . "');"
156  );
157 
158  $tpl = new ilTemplate("tpl.prop_expl_select.html", true, true, "Services/UIComponent/Explorer2");
159 
160  if ($a_mode !== "property_form") {
161  $tpl->touchBlock("tiny_presentation");
162  }
163 
164  // set values
165  $val = $this->getValue();
166  if (is_array($val)) {
167  $val_txt = $sep = "";
168  foreach ($val as $v) {
169  $tpl->setCurrentBlock("node_hid");
170  $tpl->setVariable("HID_NAME", $this->getPostVar() . "[]");
171  $tpl->setVariable("HID_VAL", $v);
172  $tpl->parseCurrentBlock();
173  $val_txt .= $sep . $this->getTitleForNodeId($v);
174  $sep = ", ";
175  $this->explorer_gui->setNodeOpen($v);
176  $this->explorer_gui->setNodeSelected($v);
177  }
178  $tpl->setVariable("VAL_TXT", $val_txt);
179  } elseif ($val != "") {
180  $tpl->setCurrentBlock("node_hid");
181  $tpl->setVariable("HID_NAME", $this->getPostVar());
182  $tpl->setVariable("HID_VAL", $val);
183  $tpl->parseCurrentBlock();
184  $tpl->setVariable("VAL_TXT", $this->getTitleForNodeId($val));
185  $this->explorer_gui->setNodeOpen($val);
186  $this->explorer_gui->setNodeSelected($val);
187  }
188 
189  $tpl->setVariable("POST_VAR", $this->getPostVar());
190  $tpl->setVariable("ID", $this->getFieldId());
191  $ol_js = "il.Explorer2.initSelect('" . $this->getFieldId() . "');";
192  $this->global_template->addOnLoadCode($ol_js);
193 
194  // $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
195 
196  //added disabled
197  if (!$this->disabled) {
198  $tpl->setCurrentBlock("txt_select");
199  $tpl->setVariable("TXT_SELECT", $lng->txt("select"));
200  $tpl->setVariable("ID_TXT_SELECT", $this->getFieldId());
201  $tpl->parseCurrentBlock();
202 
203  $tpl->setCurrentBlock("txt_reset");
204  $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
205  $tpl->setVariable("ID_TXT_RESET", $this->getFieldId());
206  $tpl->parseCurrentBlock();
207  }
208 
209  $tpl->setVariable("EXPL", $this->explorer_gui->getHTML());
210 
211  $top_tb = new ilToolbarGUI();
212 
213  $button = ilLinkButton::getInstance();
214  $button->setCaption("select");
215  $button->addCSSClass("ilExplSelectInputButS");
216  $button->setOmitPreventDoubleSubmission(true);
217  $top_tb->addStickyItem($button);
218 
219  $button = ilLinkButton::getInstance();
220  $button->setCaption("cancel");
221  $button->addCSSClass("ilExplSelectInputButC");
222  $button->setOmitPreventDoubleSubmission(true);
223  $top_tb->addStickyItem($button);
224 
225  // :TODO: we should probably clone the buttons properly
226  $tpl->setVariable("TOP_TB", $top_tb->getHTML());
227  $tpl->setVariable("BOT_TB", $top_tb->getHTML());
228 
229  return $tpl->get();
230  }
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
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ 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 85 of file class.ilExplorerSelectInputGUI.php.

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

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

◆ setValueByArray()

ilExplorerSelectInputGUI::setValueByArray ( array  $a_values)

Set value by array.

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

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

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

Field Documentation

◆ $disabled

bool ilExplorerSelectInputGUI::$disabled = false
protected

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

◆ $explorer_gui

ilExplorerBaseGUI ilExplorerSelectInputGUI::$explorer_gui
protected

◆ $multi_nodes

bool ilExplorerSelectInputGUI::$multi_nodes
protected

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

◆ $value

ilExplorerSelectInputGUI::$value
protected

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

Referenced by getValue().


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