ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. 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...
 

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

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

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

51 {
52 global $lng;
53
54 parent::__construct($a_title, $a_postvar);
55 $this->setClickableTypes($this->container_types);
56 $this->setHeaderMessage($lng->txt('search_area_info'));
57 $this->setType("rep_select");
58 $this->setSelectText($lng->txt("select"));
59 }
setType($a_type)
Set Type.
setClickableTypes($a_types)
Set clickable types.
global $lng
Definition: privfeed.php:40

References $lng, setClickableTypes(), setHeaderMessage(), setSelectText(), and ilFormPropertyGUI\setType().

+ 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 156 of file class.ilRepositorySelectorInputGUI.php.

157 {
158 global $lng;
159
160 $_POST[$this->getPostVar()] =
162
163 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
164 {
165 $this->setAlert($lng->txt("msg_input_is_required"));
166
167 return false;
168 }
169 return true;
170 }
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']
Definition: cron.php:12

References $_POST, $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 146 of file class.ilRepositorySelectorInputGUI.php.

147 {
148 return $this->clickable_types;
149 }

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

127 {
128 return $this->hm;
129 }

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

319 {
320 global $tree;
321
322 if(!in_array(ilObject::_lookupType($this->getValue(),true), $this->getVisibleTypes()))
323 {
324 return $tree->getParentId($this->getValue());
325 }
326
327 return $this->getValue();
328 }
static _lookupType($a_id, $a_reference=false)
lookup object type
getVisibleTypes()
returns all visible types like container and clickable types

References 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 106 of file class.ilRepositorySelectorInputGUI.php.

107 {
108 return $this->select_text;
109 }

Referenced by render().

+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilRepositorySelectorInputGUI::getTableFilterHTML ( )

Get HTML for table filter.

Implements ilTableFilterItem.

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

308 {
309 $html = $this->render("table_filter");
310 return $html;
311 }
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:

◆ getValue()

ilRepositorySelectorInputGUI::getValue ( )

Get Value.

Returns
int ref id of selected repository item

Definition at line 76 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 335 of file class.ilRepositorySelectorInputGUI.php.

336 {
337 return array_merge((array)$this->container_types, (array)$this->getClickableTypes());
338 }

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

298 {
299 $a_tpl->setCurrentBlock("prop_generic");
300 $a_tpl->setVariable("PROP_GENERIC", $this->render());
301 $a_tpl->parseCurrentBlock();
302 }

References render().

+ Here is the call graph for this function:

◆ render()

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

Render item.

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

241 {
242 global $lng, $ilCtrl, $ilObjDataCache, $tree;
243
244 $tpl = new ilTemplate("tpl.prop_rep_select.html", true, true, "Services/Form");
245
246 $tpl->setVariable("POST_VAR", $this->getPostVar());
247 $tpl->setVariable("ID", $this->getFieldId());
248 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
249 $tpl->setVariable("TXT_SELECT", $this->getSelectText());
250 $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
251 switch ($a_mode)
252 {
253 case "property_form":
254 $parent_gui = "ilpropertyformgui";
255 break;
256
257 case "table_filter":
258 $parent_gui = get_class($this->getParent());
259 break;
260 }
261
262 $ilCtrl->setParameterByClass("ilrepositoryselectorinputgui",
263 "postvar", $this->getPostVar());
264 $tpl->setVariable("HREF_SELECT",
265 $ilCtrl->getLinkTargetByClass(array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
266 "showRepositorySelection"));
267 $tpl->setVariable("HREF_RESET",
268 $ilCtrl->getLinkTargetByClass(array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
269 "reset"));
270
271 if ($this->getValue() > 0 && $this->getValue() != ROOT_FOLDER_ID)
272 {
273 $tpl->setVariable("TXT_ITEM",
274 $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->getValue())));
275 }
276 else
277 {
278 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
279 $title = $nd["title"];
280 if ($title == "ILIAS")
281 {
282 $title = $lng->txt("repository");
283 }
284 if (in_array($nd["type"], $this->getClickableTypes()))
285 {
286 $tpl->setVariable("TXT_ITEM", $title);
287 }
288 }
289 return $tpl->get();
290 }
global $tpl
Definition: ilias.php:8
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:11
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $lng, $nd, ilFormPropertyGUI\$title, $tpl, 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 223 of file class.ilRepositorySelectorInputGUI.php.

224 {
225 global $ilCtrl, $ilUser;
226
227 $anchor = $ilUser->prefs["screen_reader_optimization"]
228 ? $this->getFieldId()."_anchor"
229 : "";
230
231 $this->setValue("");
232 $this->writeToSession();
233
234 $ilCtrl->returnToParent($this, $anchor);
235 }
writeToSession()
Write to session.
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ selectRepositoryItem()

ilRepositorySelectorInputGUI::selectRepositoryItem ( )

Select repository item.

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

207 {
208 global $ilCtrl, $ilUser;
209
210 $anchor = $ilUser->prefs["screen_reader_optimization"]
211 ? $this->getFieldId()."_anchor"
212 : "";
213
214 $this->setValue($_GET["root_id"]);
215 $this->writeToSession();
216
217 $ilCtrl->returnToParent($this, $anchor);
218 }
$_GET["client_id"]

References $_GET, $ilCtrl, $ilUser, 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 136 of file class.ilRepositorySelectorInputGUI.php.

137 {
138 $this->clickable_types = $a_types;
139 }

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

117 {
118 $this->hm = $a_val;
119 }

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

97 {
98 $this->select_text = $a_val;
99 }

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

67 {
68 $this->value = $a_value;
69 }

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

87 {
88 $this->setValue($a_values[$this->getPostVar()]);
89 }

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

+ Here is the call graph for this function:

◆ showRepositorySelection()

ilRepositorySelectorInputGUI::showRepositorySelection ( )

Select Repository Item.

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

176 {
177 global $tpl, $lng, $ilCtrl, $tree, $ilUser;
178
179 include_once 'Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php';
180 $ilCtrl->setParameter($this, "postvar", $this->getPostVar());
181
183
184 $exp = new ilRepositorySelectorExplorerGUI($this, "showRepositorySelection",
185 $this, "selectRepositoryItem", "root_id");
186 $exp->setTypeWhiteList($this->getVisibleTypes());
187 $exp->setClickableTypes($this->getClickableTypes());
188
189 if($this->getValue())
190 {
191 $exp->setPathOpen($this->getValue());
192 $exp->setHighlightedNode($this->getHighlightedNode());
193 }
194
195 if ($exp->handleCommand())
196 {
197 return;
198 }
199 // build html-output
200 $tpl->setContent($exp->getHTML());
201 }
Explorer for selecting repository items.
getHighlightedNode()
Returns the highlighted object.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $ilCtrl, $ilUser, $lng, $tpl, 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 42 of file class.ilRepositorySelectorInputGUI.php.

◆ $options

ilRepositorySelectorInputGUI::$options
protected

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

◆ $value

ilRepositorySelectorInputGUI::$value
protected

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

Referenced by getValue().


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