ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilRepositorySelectorInputGUI Class Reference

This class represents a repository selector in a property form. More...

+ Inheritance diagram for ilRepositorySelectorInputGUI:
+ Collaboration diagram for ilRepositorySelectorInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 setSelectText ($a_val)
 Set select link text. More...
 
 getSelectText ()
 Get select link text. More...
 
 setHeaderMessage ($a_val)
 Set header message. More...
 
 getHeaderMessage ()
 Get header message. More...
 
 setClickableTypes ($a_types)
 Set clickable types. More...
 
 getClickableTypes ()
 Get clickable types. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 showRepositorySelection ()
 Select Repository Item. More...
 
 selectRepositoryItem ()
 Select repository item. More...
 
 reset ()
 Reset. 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
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 

Protected Member Functions

 getHighlightedNode ()
 Returns the highlighted object. More...
 
 getVisibleTypes ()
 returns all visible types like container and clickable types More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Protected Attributes

 $tpl
 
 $tree
 
 $user
 
 $obj_data_cache
 
 $options
 
 $value
 
 $container_types = array("root", "cat", "grp", "fold", "crs")
 
- 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
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 

Detailed Description

This class represents a repository selector in a property form.

The implementation is kind of beta. It looses all other inputs, if the selector link is used.

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

@ilCtrl_IsCalledBy ilRepositorySelectorInputGUI: ilFormPropertyDispatchGUI

Definition at line 38 of file class.ilRepositorySelectorInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilRepositorySelectorInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

71 {
72 global $DIC;
73
74 $this->lng = $DIC->language();
75 $this->tpl = $DIC["tpl"];
76 $this->ctrl = $DIC->ctrl();
77 $this->tree = $DIC->repositoryTree();
78 $this->user = $DIC->user();
79 $this->obj_data_cache = $DIC["ilObjDataCache"];
80 $lng = $DIC->language();
81
82 parent::__construct($a_title, $a_postvar);
83 $this->setClickableTypes($this->container_types);
84 $this->setHeaderMessage($lng->txt('search_area_info'));
85 $this->setType("rep_select");
86 $this->setSelectText($lng->txt("select"));
87 }
user()
Definition: user.php:4
setType($a_type)
Set Type.
setClickableTypes($a_types)
Set clickable types.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46

References $DIC, ilFormPropertyGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), setClickableTypes(), setHeaderMessage(), setSelectText(), ilFormPropertyGUI\setType(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilRepositorySelectorInputGUI::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 184 of file class.ilRepositorySelectorInputGUI.php.

185 {
187
188 $_POST[$this->getPostVar()] =
190
191 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
192 $this->setAlert($lng->txt("msg_input_is_required"));
193
194 return false;
195 }
196 return true;
197 }
$_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, ilFormPropertyGUI\$lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getClickableTypes()

ilRepositorySelectorInputGUI::getClickableTypes ( )

Get clickable types.

Returns
array clickable types

Definition at line 174 of file class.ilRepositorySelectorInputGUI.php.

175 {
176 return $this->clickable_types;
177 }

Referenced by getVisibleTypes(), render(), and showRepositorySelection().

+ Here is the caller graph for this function:

◆ getHeaderMessage()

ilRepositorySelectorInputGUI::getHeaderMessage ( )

Get header message.

Returns
string header message

Definition at line 154 of file class.ilRepositorySelectorInputGUI.php.

155 {
156 return $this->hm;
157 }

Referenced by showRepositorySelection().

+ Here is the caller graph for this function:

◆ getHighlightedNode()

ilRepositorySelectorInputGUI::getHighlightedNode ( )
protected

Returns the highlighted object.

Returns
int ref_id (node)

Definition at line 364 of file class.ilRepositorySelectorInputGUI.php.

365 {
367
368 if (!in_array(ilObject::_lookupType($this->getValue(), true), $this->getVisibleTypes())) {
369 return $tree->getParentId($this->getValue());
370 }
371
372 return $this->getValue();
373 }
static _lookupType($a_id, $a_reference=false)
lookup object type
getVisibleTypes()
returns all visible types like container and clickable types

References $tree, ilObject\_lookupType(), getValue(), and getVisibleTypes().

Referenced by showRepositorySelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectText()

ilRepositorySelectorInputGUI::getSelectText ( )

Get select link text.

Returns
string select link text

Definition at line 134 of file class.ilRepositorySelectorInputGUI.php.

135 {
136 return $this->select_text;
137 }

Referenced by render().

+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilRepositorySelectorInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

Definition at line 353 of file class.ilRepositorySelectorInputGUI.php.

354 {
355 $html = $this->render("table_filter");
356 return $html;
357 }
render($a_mode="property_form")
Render item.

References render().

+ Here is the call graph for this function:

◆ getValue()

ilRepositorySelectorInputGUI::getValue ( )

Get Value.

Returns
int ref id of selected repository item

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

References $value.

Referenced by getHighlightedNode(), render(), and showRepositorySelection().

+ Here is the caller graph for this function:

◆ getVisibleTypes()

ilRepositorySelectorInputGUI::getVisibleTypes ( )
protected

returns all visible types like container and clickable types

Returns
array

Definition at line 380 of file class.ilRepositorySelectorInputGUI.php.

381 {
382 return array_merge((array) $this->container_types, (array) $this->getClickableTypes());
383 }

References getClickableTypes().

Referenced by getHighlightedNode(), and showRepositorySelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilRepositorySelectorInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Definition at line 343 of file class.ilRepositorySelectorInputGUI.php.

344 {
345 $a_tpl->setCurrentBlock("prop_generic");
346 $a_tpl->setVariable("PROP_GENERIC", $this->render());
347 $a_tpl->parseCurrentBlock();
348 }

References render().

+ Here is the call graph for this function:

◆ render()

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

Render item.

Definition at line 276 of file class.ilRepositorySelectorInputGUI.php.

277 {
280 $ilObjDataCache = $this->obj_data_cache;
282
283 $tpl = new ilTemplate("tpl.prop_rep_select.html", true, true, "Services/Form");
284
285 $tpl->setVariable("POST_VAR", $this->getPostVar());
286 $tpl->setVariable("ID", $this->getFieldId());
287 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
288 $tpl->setVariable("TXT_SELECT", $this->getSelectText());
289 $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
290 switch ($a_mode) {
291 case "property_form":
292 $parent_gui = "ilpropertyformgui";
293 break;
294
295 case "table_filter":
296 $parent_gui = get_class($this->getParent());
297 break;
298 }
299
300 $ilCtrl->setParameterByClass(
301 "ilrepositoryselectorinputgui",
302 "postvar",
303 $this->getPostVar()
304 );
305 $tpl->setVariable(
306 "HREF_SELECT",
307 $ilCtrl->getLinkTargetByClass(
308 array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
309 "showRepositorySelection"
310 )
311 );
312 $tpl->setVariable(
313 "HREF_RESET",
314 $ilCtrl->getLinkTargetByClass(
315 array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
316 "reset"
317 )
318 );
319
320 if ($this->getValue() > 0 && $this->getValue() != ROOT_FOLDER_ID) {
321 $tpl->setVariable(
322 "TXT_ITEM",
323 $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->getValue()))
324 );
325 } else {
326 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
327 $title = $nd["title"];
328 if ($title == "ILIAS") {
329 $title = $lng->txt("repository");
330 }
331 if (in_array($nd["type"], $this->getClickableTypes())) {
332 $tpl->setVariable("TXT_ITEM", $title);
333 }
334 }
335 return $tpl->get();
336 }
getFieldId()
Get Post Variable.
getParent()
Get Parent GUI object.
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$nd
Definition: error.php:12
global $ilCtrl
Definition: ilias.php:18

References ilFormPropertyGUI\$ctrl, $ilCtrl, ilFormPropertyGUI\$lng, $nd, $obj_data_cache, ilFormPropertyGUI\$title, $tpl, $tree, getClickableTypes(), ilFormPropertyGUI\getFieldId(), ilFormPropertyGUI\getParent(), ilFormPropertyGUI\getPostVar(), getSelectText(), getValue(), and ilUtil\prepareFormOutput().

Referenced by getTableFilterHTML(), and insert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilRepositorySelectorInputGUI::reset ( )

Reset.

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

259 {
262
263 $anchor = $ilUser->prefs["screen_reader_optimization"]
264 ? $this->getFieldId() . "_anchor"
265 : "";
266
267 $this->setValue("");
268 $this->writeToSession();
269
270 $ilCtrl->returnToParent($this, $anchor);
271 }
writeToSession()
Write to session.
$ilUser
Definition: imgupload.php:18

References ilFormPropertyGUI\$ctrl, $ilCtrl, $ilUser, $user, ilFormPropertyGUI\getFieldId(), setValue(), and ilFormPropertyGUI\writeToSession().

+ Here is the call graph for this function:

◆ selectRepositoryItem()

ilRepositorySelectorInputGUI::selectRepositoryItem ( )

Select repository item.

Definition at line 240 of file class.ilRepositorySelectorInputGUI.php.

241 {
244
245 $anchor = $ilUser->prefs["screen_reader_optimization"]
246 ? $this->getFieldId() . "_anchor"
247 : "";
248
249 $this->setValue($_GET["root_id"]);
250 $this->writeToSession();
251
252 $ilCtrl->returnToParent($this, $anchor);
253 }
$_GET["client_id"]

References $_GET, ilFormPropertyGUI\$ctrl, $ilCtrl, $ilUser, $user, ilFormPropertyGUI\getFieldId(), setValue(), and ilFormPropertyGUI\writeToSession().

+ Here is the call graph for this function:

◆ setClickableTypes()

ilRepositorySelectorInputGUI::setClickableTypes (   $a_types)

Set clickable types.

Parameters
arrayclickable types

Definition at line 164 of file class.ilRepositorySelectorInputGUI.php.

165 {
166 $this->clickable_types = $a_types;
167 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setHeaderMessage()

ilRepositorySelectorInputGUI::setHeaderMessage (   $a_val)

Set header message.

Parameters
stringheader message

Definition at line 144 of file class.ilRepositorySelectorInputGUI.php.

145 {
146 $this->hm = $a_val;
147 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setSelectText()

ilRepositorySelectorInputGUI::setSelectText (   $a_val)

Set select link text.

Parameters
stringselect link text

Definition at line 124 of file class.ilRepositorySelectorInputGUI.php.

125 {
126 $this->select_text = $a_val;
127 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setValue()

ilRepositorySelectorInputGUI::setValue (   $a_value)

Set Value.

Parameters
intref id of selected repository item

Definition at line 94 of file class.ilRepositorySelectorInputGUI.php.

95 {
96 $this->value = $a_value;
97 }

Referenced by reset(), selectRepositoryItem(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilRepositorySelectorInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 114 of file class.ilRepositorySelectorInputGUI.php.

115 {
116 $this->setValue($a_values[$this->getPostVar()]);
117 }

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

+ Here is the call graph for this function:

◆ showRepositorySelection()

ilRepositorySelectorInputGUI::showRepositorySelection ( )

Select Repository Item.

Definition at line 202 of file class.ilRepositorySelectorInputGUI.php.

203 {
209
210 include_once 'Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php';
211 $ilCtrl->setParameter($this, "postvar", $this->getPostVar());
212
214
216 $this,
217 "showRepositorySelection",
218 $this,
219 "selectRepositoryItem",
220 "root_id"
221 );
222 $exp->setTypeWhiteList($this->getVisibleTypes());
223 $exp->setClickableTypes($this->getClickableTypes());
224
225 if ($this->getValue()) {
226 $exp->setPathOpen($this->getValue());
227 $exp->setHighlightedNode($this->getHighlightedNode());
228 }
229
230 if ($exp->handleCommand()) {
231 return;
232 }
233 // build html-output
234 $tpl->setContent($exp->getHTML());
235 }
Explorer for selecting repository items.
getHighlightedNode()
Returns the highlighted object.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References ilFormPropertyGUI\$ctrl, $ilCtrl, $ilUser, ilFormPropertyGUI\$lng, $tpl, $tree, $user, getClickableTypes(), getHeaderMessage(), getHighlightedNode(), ilFormPropertyGUI\getPostVar(), getValue(), getVisibleTypes(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

Field Documentation

◆ $container_types

ilRepositorySelectorInputGUI::$container_types = array("root", "cat", "grp", "fold", "crs")
protected

Definition at line 62 of file class.ilRepositorySelectorInputGUI.php.

◆ $obj_data_cache

ilRepositorySelectorInputGUI::$obj_data_cache
protected

Definition at line 58 of file class.ilRepositorySelectorInputGUI.php.

Referenced by render().

◆ $options

ilRepositorySelectorInputGUI::$options
protected

Definition at line 60 of file class.ilRepositorySelectorInputGUI.php.

◆ $tpl

ilRepositorySelectorInputGUI::$tpl
protected

Definition at line 43 of file class.ilRepositorySelectorInputGUI.php.

Referenced by render(), and showRepositorySelection().

◆ $tree

ilRepositorySelectorInputGUI::$tree
protected

◆ $user

ilRepositorySelectorInputGUI::$user
protected

◆ $value

ilRepositorySelectorInputGUI::$value
protected

Definition at line 61 of file class.ilRepositorySelectorInputGUI.php.

Referenced by getValue().


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