ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterLabelFor ()
 Get label "for" attribute value. 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, ILIAS\GlobalScreen\Provider\__construct(), 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  }
setType($a_type)
Set Type.
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ 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 118 of file class.ilExplorerSelectInputGUI.php.

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

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

References render().

270  {
271  $html = $this->render("table_filter");
272  return $html;
273  }
render($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.

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

Referenced by handleExplorerCommand(), and render().

99  {
100  return $this->value;
101  }
+ 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(), and getValue().

53  {
54  $val = $this->getValue();
55  if (is_array($val)) {
56  foreach ($val as $v) {
57  $this->explorer_gui->setNodeOpen($v);
58  $this->explorer_gui->setNodeSelected($v);
59  }
60  } elseif ($val != "") {
61  $this->explorer_gui->setNodeOpen($val);
62  $this->explorer_gui->setNodeSelected($val);
63  }
64  $this->explorer_gui->handleCommand();
65  }
+ Here is the call graph for this function:

◆ insert()

ilExplorerSelectInputGUI::insert ( $a_tpl)

Insert property html.

Parameters
ilTemplate

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

References render().

260  {
261  $a_tpl->setCurrentBlock("prop_generic");
262  $a_tpl->setVariable("PROP_GENERIC", $this->render());
263  $a_tpl->parseCurrentBlock();
264  }
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 150 of file class.ilExplorerSelectInputGUI.php.

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

Referenced by getTableFilterHTML(), and insert().

151  {
152  $lng = $this->lng;
153 
154  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
156  $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/Explorer2/js/Explorer2.js");
157  $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/Modal/js/Modal.js");
158 
159  $tpl = new ilTemplate("tpl.prop_expl_select.html", true, true, "Services/UIComponent/Explorer2");
160 
161  if ($a_mode != "property_form") {
162  $tpl->touchBlock("tiny_presentation");
163  }
164 
165  // set values
166  $val = $this->getValue();
167  if (is_array($val)) {
168  $val_txt = $sep = "";
169  foreach ($val as $v) {
170  $tpl->setCurrentBlock("node_hid");
171  $tpl->setVariable("HID_NAME", $this->getPostVar() . "[]");
172  $tpl->setVariable("HID_VAL", $v);
173  $tpl->parseCurrentBlock();
174  $val_txt .= $sep . $this->getTitleForNodeId($v);
175  $sep = ", ";
176  $this->explorer_gui->setNodeOpen($v);
177  $this->explorer_gui->setNodeSelected($v);
178  }
179  $tpl->setVariable("VAL_TXT", $val_txt);
180  } elseif ($val != "") {
181  $tpl->setCurrentBlock("node_hid");
182  $tpl->setVariable("HID_NAME", $this->getPostVar());
183  $tpl->setVariable("HID_VAL", $val);
184  $tpl->parseCurrentBlock();
185  $tpl->setVariable("VAL_TXT", $this->getTitleForNodeId($val));
186  $this->explorer_gui->setNodeOpen($val);
187  $this->explorer_gui->setNodeSelected($val);
188  }
189 
190  $tpl->setVariable("POST_VAR", $this->getPostVar());
191  $tpl->setVariable("ID", $this->getFieldId());
192  // $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
193 
194  //added disabled
195  if (!$this->disabled) {
196  $tpl->setCurrentBlock("txt_select");
197  $tpl->setVariable("TXT_SELECT", $lng->txt("select"));
198  $tpl->setVariable("ID_TXT_SELECT", $this->getFieldId());
199  $tpl->parseCurrentBlock();
200 
201  $tpl->setCurrentBlock("txt_reset");
202  $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
203  $tpl->setVariable("ID_TXT_RESET", $this->getFieldId());
204  $tpl->parseCurrentBlock();
205  }
206 
207  $tpl->setVariable("EXPL", $this->explorer_gui->getHTML());
208 
209  $top_tb = new ilToolbarGUI();
210 
211  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
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  //$tpl->setVariable("HREF_SELECT",
230  // $ilCtrl->getLinkTargetByClass(array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
231  // "showRepositorySelection"));
232 
233  /*if ($this->getValue() > 0 && $this->getValue() != ROOT_FOLDER_ID)
234  {
235  $tpl->setVariable("TXT_ITEM",
236  $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->getValue())));
237  }
238  else
239  {
240  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
241  $title = $nd["title"];
242  if ($title == "ILIAS")
243  {
244  $title = $lng->txt("repository");
245  }
246  if (in_array($nd["type"], $this->getClickableTypes()))
247  {
248  $tpl->setVariable("TXT_ITEM", $title);
249  }
250  }*/
251 
252  return $tpl->get();
253  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
getPostVar()
Get Post Variable.
static initPanel($a_resize=false, ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel.
getTitleForNodeId($a_id)
Get title for node id (needs to be overwritten, if explorer is not a tree eplorer.
getFieldId()
Get Post Variable.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
disabled()
Example showing how to plug a disabled checkbox into a form.
Definition: disabled.php:5
+ 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 80 of file class.ilExplorerSelectInputGUI.php.

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

81  {
82  if ($this->multi_nodes && !is_array($a_value)) {
83  if ($a_value !== false) {
84  $this->value = array($a_value);
85  } else {
86  $this->value = array();
87  }
88  } else {
89  $this->value = $a_value;
90  }
91  }
+ 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 108 of file class.ilExplorerSelectInputGUI.php.

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

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

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