ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilExplorerSelectInputGUI Class Reference

Select explorer tree nodes input GUI. More...

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

Public Member Functions

 __construct ($a_title, $a_postvar, $a_explorer_gui, $a_multi=false)
 Constructor. More...
 
 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)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ($a_mode="property_form")
 Render item. More...
 
 insert (&$a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. 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...
 

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

Detailed Description

Select explorer tree nodes input GUI.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References $DIC, ilFormPropertyGUI\$lng, and ilFormPropertyGUI\setType().

25  {
26  global $DIC;
27 
28  $this->lng = $DIC->language();
29  $lng = $DIC->language();
30 
31  $this->multi_nodes = $a_multi;
32  $this->explorer_gui = $a_explorer_gui;
33 
34  parent::__construct($a_title, $a_postvar);
35  $this->setType("exp_select");
36  }
global $DIC
Definition: saml.php:7
setType($a_type)
Set Type.
+ 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
boolean Input ok, true/false

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

References $_POST, ilFormPropertyGUI\$lng, array, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

109  {
110  $lng = $this->lng;
111 
112  // sanitize
113  if ($this->multi_nodes) {
114  if (!is_array($_POST[$this->getPostVar()])) {
115  $_POST[$this->getPostVar()] = array();
116  }
117 
118  foreach ($_POST[$this->getPostVar()] as $k => $v) {
119  $_POST[$this->getPostVar()][$k] = ilUtil::stripSlashes($v);
120  }
121  } else {
122  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
123  }
124 
125  // check required
126  if ($this->getRequired()) {
127  if ((!$this->multi_nodes && trim($_POST[$this->getPostVar()]) == "") ||
128  ($this->multi_nodes && count($_POST[$this->getPostVar()]) == 0)) {
129  $this->setAlert($lng->txt("msg_input_is_required"));
130  return false;
131  }
132  }
133  return true;
134  }
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ getExplHandleCmd()

ilExplorerSelectInputGUI::getExplHandleCmd ( )

Get explorer handle command function.

Parameters

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

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

45  {
46  return "handleExplorerCommand";
47  }
+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilExplorerSelectInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

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

References $html, and render().

259  {
260  $html = $this->render("table_filter");
261  return $html;
262  }
render($a_mode="property_form")
Render item.
$html
Definition: example_001.php:87
+ 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.

Parameters

Referenced by handleExplorerCommand(), and render().

+ Here is the caller graph for this function:

◆ getValue()

ilExplorerSelectInputGUI::getValue ( )

Get Value.

Returns
mixed tax node id or array of node ids (multi mode)

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

Referenced by render().

89  {
90  return $this->value;
91  }
+ Here is the caller graph for this function:

◆ handleExplorerCommand()

ilExplorerSelectInputGUI::handleExplorerCommand ( )

Handle explorer command.

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

References getTitleForNodeId().

53  {
54  $this->explorer_gui->handleCommand();
55  }
+ Here is the call graph for this function:

◆ insert()

ilExplorerSelectInputGUI::insert ( $a_tpl)

Insert property html.

Parameters
ilTemplate

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

References render().

249  {
250  $a_tpl->setCurrentBlock("prop_generic");
251  $a_tpl->setVariable("PROP_GENERIC", $this->render());
252  $a_tpl->parseCurrentBlock();
253  }
render($a_mode="property_form")
Render item.
+ Here is the call graph for this function:

◆ render()

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

Render item.

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

References $GLOBALS, ilFormPropertyGUI\$lng, $tpl, ilFormPropertyGUI\getFieldId(), ilLinkButton\getInstance(), ilFormPropertyGUI\getPostVar(), getTitleForNodeId(), getValue(), and ilYuiUtil\initPanel().

Referenced by getTableFilterHTML(), and insert().

141  {
142  $lng = $this->lng;
143 
144  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
146  $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/Explorer2/js/Explorer2.js");
147 
148  $tpl = new ilTemplate("tpl.prop_expl_select.html", true, true, "Services/UIComponent/Explorer2");
149 
150  if ($a_mode != "property_form") {
151  $tpl->touchBlock("tiny_presentation");
152  }
153 
154  // set values
155  $val = $this->getValue();
156  if (is_array($val)) {
157  $val_txt = $sep = "";
158  foreach ($val as $v) {
159  $tpl->setCurrentBlock("node_hid");
160  $tpl->setVariable("HID_NAME", $this->getPostVar() . "[]");
161  $tpl->setVariable("HID_VAL", $v);
162  $tpl->parseCurrentBlock();
163  $val_txt.= $sep . $this->getTitleForNodeId($v);
164  $sep = ", ";
165  $this->explorer_gui->setNodeOpen($v);
166  $this->explorer_gui->setNodeSelected($v);
167  }
168  $tpl->setVariable("VAL_TXT", $val_txt);
169  } elseif ($val != "") {
170  $tpl->setCurrentBlock("node_hid");
171  $tpl->setVariable("HID_NAME", $this->getPostVar());
172  $tpl->setVariable("HID_VAL", $val);
173  $tpl->parseCurrentBlock();
174  $tpl->setVariable("VAL_TXT", $this->getTitleForNodeId($val));
175  $this->explorer_gui->setNodeOpen($val);
176  $this->explorer_gui->setNodeSelected($val);
177  }
178 
179  $tpl->setVariable("POST_VAR", $this->getPostVar());
180  $tpl->setVariable("ID", $this->getFieldId());
181  // $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
182 
183  //added disabled
184  if (!$this->disabled) {
185  $tpl->setCurrentBlock("txt_select");
186  $tpl->setVariable("TXT_SELECT", $lng->txt("select"));
187  $tpl->setVariable("ID_TXT_SELECT", $this->getFieldId());
188  $tpl->parseCurrentBlock();
189 
190  $tpl->setCurrentBlock("txt_reset");
191  $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
192  $tpl->setVariable("ID_TXT_RESET", $this->getFieldId());
193  $tpl->parseCurrentBlock();
194  }
195 
196  $tpl->setVariable("EXPL", $this->explorer_gui->getHTML());
197 
198  $top_tb = new ilToolbarGUI();
199 
200  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
201 
202  $button = ilLinkButton::getInstance();
203  $button->setCaption("select");
204  $button->addCSSClass("ilExplSelectInputButS");
205  $button->setOmitPreventDoubleSubmission(true);
206  $top_tb->addButtonInstance($button);
207 
208  $button = ilLinkButton::getInstance();
209  $button->setCaption("cancel");
210  $button->addCSSClass("ilExplSelectInputButC");
211  $button->setOmitPreventDoubleSubmission(true);
212  $top_tb->addButtonInstance($button);
213 
214  // :TODO: we should probably clone the buttons properly
215  $tpl->setVariable("TOP_TB", $top_tb->getHTML());
216  $tpl->setVariable("BOT_TB", $top_tb->getHTML());
217 
218  //$tpl->setVariable("HREF_SELECT",
219  // $ilCtrl->getLinkTargetByClass(array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
220  // "showRepositorySelection"));
221 
222  /*if ($this->getValue() > 0 && $this->getValue() != ROOT_FOLDER_ID)
223  {
224  $tpl->setVariable("TXT_ITEM",
225  $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->getValue())));
226  }
227  else
228  {
229  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
230  $title = $nd["title"];
231  if ($title == "ILIAS")
232  {
233  $title = $lng->txt("repository");
234  }
235  if (in_array($nd["type"], $this->getClickableTypes()))
236  {
237  $tpl->setVariable("TXT_ITEM", $title);
238  }
239  }*/
240 
241  return $tpl->get();
242  }
$tpl
Definition: ilias.php:10
getPostVar()
Get Post Variable.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getTitleForNodeId($a_id)
Get title for node id (needs to be overwritten, if explorer is not a tree eplorer.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
static initPanel($a_resize=false, ilTemplate $a_main_tpl=null)
Init yui panel.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValue()

ilExplorerSelectInputGUI::setValue (   $a_value)

Set Value.

Parameters
mixedtax node id or array of node ids (multi mode)

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

References array.

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

71  {
72  if ($this->multi_nodes && !is_array($a_value)) {
73  if ($a_value !== false) {
74  $this->value = array($a_value);
75  } else {
76  $this->value = array();
77  }
78  } else {
79  $this->value = $a_value;
80  }
81  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setValueByArray()

ilExplorerSelectInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

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

99  {
100  $this->setValue($a_values[$this->getPostVar()]);
101  }
getPostVar()
Get Post Variable.
+ Here is the call graph for this function:

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