ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. 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
 $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

Reimplemented in ilRepositorySelector2InputGUI.

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

25 {
26 global $lng;
27
28 $this->multi_nodes = $a_multi;
29 $this->explorer_gui = $a_explorer_gui;
30
31 parent::__construct($a_title, $a_postvar);
32 $this->setType("exp_select");
33 }
setType($a_type)
Set Type.
global $lng
Definition: privfeed.php:17

References $lng, and ilFormPropertyGUI\setType().

+ 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

Reimplemented from ilFormPropertyGUI.

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

112 {
113 global $lng;
114
115 // sanitize
116 if ($this->multi_nodes)
117 {
118 if (!is_array($_POST[$this->getPostVar()]))
119 {
120 $_POST[$this->getPostVar()] = array();
121 }
122
123 foreach ($_POST[$this->getPostVar()] as $k => $v)
124 {
125 $_POST[$this->getPostVar()][$k] = ilUtil::stripSlashes($v);
126 }
127 }
128 else
129 {
131 }
132
133 // check required
134 if ($this->getRequired())
135 {
136 if ((!$this->multi_nodes && trim($_POST[$this->getPostVar()]) == "") ||
137 ($this->multi_nodes && count($_POST[$this->getPostVar()]) == 0))
138 {
139 $this->setAlert($lng->txt("msg_input_is_required"));
140 return false;
141 }
142 }
143 return true;
144 }
$_POST["username"]
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

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

+ Here is the call graph for this function:

◆ getExplHandleCmd()

ilExplorerSelectInputGUI::getExplHandleCmd ( )

Get explorer handle command function.

Parameters

return

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

42 {
43 return "handleExplorerCommand";
44 }

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

+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilExplorerSelectInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

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

274 {
275 $html = $this->render("table_filter");
276 return $html;
277 }
render($a_mode="property_form")
Render item.
$html
Definition: example_001.php:87

References $html, and render().

+ 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

return

Reimplemented in ilRepositorySelector2InputGUI, and ilTaxSelectInputGUI.

Referenced by 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 91 of file class.ilExplorerSelectInputGUI.php.

92 {
93 return $this->value;
94 }

Referenced by render().

+ Here is the caller graph for this function:

◆ handleExplorerCommand()

ilExplorerSelectInputGUI::handleExplorerCommand ( )

Handle explorer command.

Reimplemented in ilRepositorySelector2InputGUI.

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

50 {
51 $this->explorer_gui->handleCommand();
52 }

◆ insert()

ilExplorerSelectInputGUI::insert ( $a_tpl)

Insert property html.

Parameters
ilTemplate

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

264 {
265 $a_tpl->setCurrentBlock("prop_generic");
266 $a_tpl->setVariable("PROP_GENERIC", $this->render());
267 $a_tpl->parseCurrentBlock();
268 }

References render().

+ Here is the call graph for this function:

◆ render()

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

Render item.

Reimplemented in ilRepositorySelector2InputGUI.

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

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

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

Referenced by getTableFilterHTML(), and insert().

+ 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 67 of file class.ilExplorerSelectInputGUI.php.

68 {
69 if ($this->multi_nodes && !is_array($a_value))
70 {
71 if ($a_value !== false)
72 {
73 $this->value = array($a_value);
74 }
75 else
76 {
77 $this->value = array();
78 }
79 }
80 else
81 {
82 $this->value = $a_value;
83 }
84 }

Referenced by setValueByArray().

+ 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 101 of file class.ilExplorerSelectInputGUI.php.

102 {
103 $this->setValue($a_values[$this->getPostVar()]);
104 }

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

+ Here is the call graph for this function:

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