ILIAS  release_8 Revision v8.24
ilRepositorySelectorInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setValue ($a_value)
 
 getValue ()
 
 setValueByArray (array $a_values)
 
 setSelectText (string $a_val)
 
 getSelectText ()
 
 setHeaderMessage (string $a_val)
 
 getHeaderMessage ()
 
 setClickableTypes (array $a_types)
 
 getClickableTypes ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 showRepositorySelection ()
 
 selectRepositoryItem ()
 
 reset ()
 
 render ($a_mode="property_form")
 
 insert (ilTemplate $a_tpl)
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $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...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. 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 ()
 
 getVisibleTypes ()
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Protected Attributes

array $clickable_types = []
 
string $hm = ""
 
string $select_text = ""
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilObjUser $user
 
ilObjectDataCache $obj_data_cache
 
array $options = []
 
int $value = 0
 
array $container_types = array("root", "cat", "grp", "fold", "crs")
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

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

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de @ilCtrl_IsCalledBy ilRepositorySelectorInputGUI: ilFormPropertyDispatchGUI

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

46 {
47 global $DIC;
48
49 $this->lng = $DIC->language();
50 $this->tpl = $DIC["tpl"];
51 $this->ctrl = $DIC->ctrl();
52 $this->tree = $DIC->repositoryTree();
53 $this->user = $DIC->user();
54 $this->obj_data_cache = $DIC["ilObjDataCache"];
55 $lng = $DIC->language();
56
57 parent::__construct($a_title, $a_postvar);
58 $this->setClickableTypes($this->container_types);
59 $this->setHeaderMessage($lng->txt('search_area_info'));
60 $this->setType("rep_select");
61 $this->setSelectText($lng->txt("select"));
62 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ilFormPropertyGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), setClickableTypes(), setHeaderMessage(), setSelectText(), ilFormPropertyGUI\setType(), ilLanguage\txt(), and ILIAS\Repository\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.

Reimplemented from ilFormPropertyGUI.

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

113 : bool
114 {
116
117 if ($this->getRequired() && trim($this->str($this->getPostVar())) == "") {
118 $this->setAlert($lng->txt("msg_input_is_required"));
119 return false;
120 }
121 return true;
122 }

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), ilFormPropertyGUI\str(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getClickableTypes()

ilRepositorySelectorInputGUI::getClickableTypes ( )

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

108 : array
109 {
111 }

References $clickable_types.

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

+ Here is the caller graph for this function:

◆ getHeaderMessage()

ilRepositorySelectorInputGUI::getHeaderMessage ( )

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

98 : string
99 {
100 return $this->hm;
101 }

References $hm.

Referenced by showRepositorySelection().

+ Here is the caller graph for this function:

◆ getHighlightedNode()

ilRepositorySelectorInputGUI::getHighlightedNode ( )
protected

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

256 : int
257 {
259
260 if (!in_array(ilObject::_lookupType($this->getValue(), true), $this->getVisibleTypes())) {
261 return $tree->getParentId($this->getValue());
262 }
263
264 return $this->getValue();
265 }
static _lookupType(int $id, bool $reference=false)
getParentId(int $a_node_id)
get parent id of given node

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

Referenced by showRepositorySelection().

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

◆ getInput()

ilRepositorySelectorInputGUI::getInput ( )

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

124 : int
125 {
126 return (int) trim($this->str($this->getPostVar()));
127 }

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

+ Here is the call graph for this function:

◆ getSelectText()

ilRepositorySelectorInputGUI::getSelectText ( )

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

88 : string
89 {
90 return $this->select_text;
91 }

References $select_text.

Referenced by render().

+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilRepositorySelectorInputGUI::getTableFilterHTML ( )

Get input item HTML to be inserted into table filters.

Implements ilTableFilterItem.

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

250 : string
251 {
252 $html = $this->render("table_filter");
253 return $html;
254 }

References render().

+ Here is the call graph for this function:

◆ getValue()

ilRepositorySelectorInputGUI::getValue ( )

Definition at line 73 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

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

267 : array
268 {
269 return array_merge($this->container_types, $this->getClickableTypes());
270 }

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 ( ilTemplate  $a_tpl)

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

243 : void
244 {
245 $a_tpl->setCurrentBlock("prop_generic");
246 $a_tpl->setVariable("PROP_GENERIC", $this->render());
247 $a_tpl->parseCurrentBlock();
248 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilTemplate\parseCurrentBlock(), render(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ render()

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

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

180 : string
181 {
183 $ilCtrl = $this->ctrl;
184 $ilObjDataCache = $this->obj_data_cache;
186 $parent_gui = "";
187
188 $tpl = new ilTemplate("tpl.prop_rep_select.html", true, true, "Services/Form");
189
190 $tpl->setVariable("POST_VAR", $this->getPostVar());
191 $tpl->setVariable("ID", $this->getFieldId());
192 $tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput((string) $this->getValue()));
193 $tpl->setVariable("TXT_SELECT", $this->getSelectText());
194 $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
195 switch ($a_mode) {
196 case "property_form":
197 $parent_gui = "ilpropertyformgui";
198 break;
199
200 case "table_filter":
201 $parent_gui = get_class($this->getParentTable());
202 break;
203 }
204
205 $ilCtrl->setParameterByClass(
206 "ilrepositoryselectorinputgui",
207 "postvar",
208 $this->getPostVar()
209 );
211 "HREF_SELECT",
212 $ilCtrl->getLinkTargetByClass(
213 array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
214 "showRepositorySelection"
215 )
216 );
218 "HREF_RESET",
219 $ilCtrl->getLinkTargetByClass(
220 array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
221 "reset"
222 )
223 );
224
225 if ($this->getValue() > 0 && $this->getValue() != ROOT_FOLDER_ID) {
227 "TXT_ITEM",
228 $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->getValue()))
229 );
230 } else {
232 $title = $nd["title"];
233 if ($title == "ILIAS") {
234 $title = $lng->txt("repository");
235 }
236 if (in_array($nd["type"], $this->getClickableTypes())) {
237 $tpl->setVariable("TXT_ITEM", $title);
238 }
239 }
240 return $tpl->get();
241 }
ilFormPropertyGUI $parent_gui
getParentTable()
Get parent table.
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
const ROOT_FOLDER_ID
Definition: constants.php:32
$nd
Definition: error.php:12
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References ilFormPropertyGUI\$ctrl, ilFormPropertyGUI\$lng, $nd, $obj_data_cache, ilFormPropertyGUI\$parent_gui, ilFormPropertyGUI\$title, $tpl, $tree, ilGlobalTemplateInterface\get(), getClickableTypes(), ilFormPropertyGUI\getFieldId(), ilTree\getNodeData(), ilFormPropertyGUI\getParentTable(), ilFormPropertyGUI\getPostVar(), getSelectText(), getValue(), ilLegacyFormElementsUtil\prepareFormOutput(), ROOT_FOLDER_ID, ilGlobalTemplateInterface\setVariable(), and ilLanguage\txt().

Referenced by getTableFilterHTML(), and insert().

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

◆ reset()

ilRepositorySelectorInputGUI::reset ( )

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

170 : void
171 {
172 $ilCtrl = $this->ctrl;
173
174 $this->setValue("");
175 $this->writeToSession();
176
177 $ilCtrl->returnToParent($this);
178 }

References ilFormPropertyGUI\$ctrl, setValue(), and ilFormPropertyGUI\writeToSession().

+ Here is the call graph for this function:

◆ selectRepositoryItem()

ilRepositorySelectorInputGUI::selectRepositoryItem ( )

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

160 : void
161 {
162 $ilCtrl = $this->ctrl;
163
164 $this->setValue((string) $this->int("root_id"));
165 $this->writeToSession();
166
167 $ilCtrl->returnToParent($this);
168 }

References ilFormPropertyGUI\$ctrl, setValue(), and ilFormPropertyGUI\writeToSession().

+ Here is the call graph for this function:

◆ setClickableTypes()

ilRepositorySelectorInputGUI::setClickableTypes ( array  $a_types)

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

103 : void
104 {
105 $this->clickable_types = $a_types;
106 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setHeaderMessage()

ilRepositorySelectorInputGUI::setHeaderMessage ( string  $a_val)

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

93 : void
94 {
95 $this->hm = $a_val;
96 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setSelectText()

ilRepositorySelectorInputGUI::setSelectText ( string  $a_val)

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

83 : void
84 {
85 $this->select_text = $a_val;
86 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setValue()

ilRepositorySelectorInputGUI::setValue (   $a_value)
Parameters
int | string$a_value
Returns
void

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

68 : void
69 {
70 $this->value = (int) $a_value;
71 }

References ilFormPropertyGUI\int().

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

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

◆ setValueByArray()

ilRepositorySelectorInputGUI::setValueByArray ( array  $a_values)

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

78 : void
79 {
80 $this->setValue($a_values[$this->getPostVar()] ?? "");
81 }

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

+ Here is the call graph for this function:

◆ showRepositorySelection()

ilRepositorySelectorInputGUI::showRepositorySelection ( )

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

129 : void
130 {
132 $ilCtrl = $this->ctrl;
133
134 $ilCtrl->setParameter($this, "postvar", $this->getPostVar());
135
136 $this->tpl->setOnScreenMessage('info', $this->getHeaderMessage());
137
139 $this,
140 "showRepositorySelection",
141 $this,
142 "selectRepositoryItem",
143 "root_id"
144 );
145 $exp->setTypeWhiteList($this->getVisibleTypes());
146 $exp->setClickableTypes($this->getClickableTypes());
147
148 if ($this->getValue()) {
149 $exp->setPathOpen($this->getValue());
150 $exp->setHighlightedNode((string) $this->getHighlightedNode());
151 }
152
153 if ($exp->handleCommand()) {
154 return;
155 }
156 // build html-output
157 $tpl->setContent($exp->getHTML());
158 }
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
Explorer for selecting repository items.
setContent(string $a_html)
Sets content for standard template.

References ilFormPropertyGUI\$ctrl, $tpl, getClickableTypes(), getHeaderMessage(), getHighlightedNode(), ilFormPropertyGUI\getPostVar(), getValue(), getVisibleTypes(), ilGlobalTemplateInterface\setContent(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

Field Documentation

◆ $clickable_types

array ilRepositorySelectorInputGUI::$clickable_types = []
protected

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

Referenced by getClickableTypes().

◆ $container_types

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

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

◆ $hm

string ilRepositorySelectorInputGUI::$hm = ""
protected

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

Referenced by getHeaderMessage().

◆ $obj_data_cache

ilObjectDataCache ilRepositorySelectorInputGUI::$obj_data_cache
protected

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

Referenced by render().

◆ $options

array ilRepositorySelectorInputGUI::$options = []
protected

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

◆ $select_text

string ilRepositorySelectorInputGUI::$select_text = ""
protected

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

Referenced by getSelectText().

◆ $tpl

ilGlobalTemplateInterface ilRepositorySelectorInputGUI::$tpl
protected

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

Referenced by render(), and showRepositorySelection().

◆ $tree

ilTree ilRepositorySelectorInputGUI::$tree
protected

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

Referenced by getHighlightedNode(), and render().

◆ $user

ilObjUser ilRepositorySelectorInputGUI::$user
protected

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

◆ $value

int ilRepositorySelectorInputGUI::$value = 0
protected

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

Referenced by getValue().


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