ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 (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 ()
 
 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
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 

Protected Member Functions

 getHighlightedNode ()
 
 getVisibleTypes ()
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 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 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 ilRepositorySelectorInputGUI: ilFormPropertyDispatchGUI

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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().

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: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilRepositorySelectorInputGUI::checkInput ( )

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

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

113  : bool
114  {
115  $lng = $this->lng;
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  }
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...
+ Here is the call graph for this function:

◆ getClickableTypes()

ilRepositorySelectorInputGUI::getClickableTypes ( )

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

References $clickable_types.

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

108  : array
109  {
110  return $this->clickable_types;
111  }
+ Here is the caller graph for this function:

◆ getHeaderMessage()

ilRepositorySelectorInputGUI::getHeaderMessage ( )

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

References $hm.

Referenced by showRepositorySelection().

98  : string
99  {
100  return $this->hm;
101  }
+ Here is the caller graph for this function:

◆ getHighlightedNode()

ilRepositorySelectorInputGUI::getHighlightedNode ( )
protected

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

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

Referenced by showRepositorySelection().

256  : int
257  {
258  $tree = $this->tree;
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  }
getParentId(int $a_node_id)
get parent id of given node
static _lookupType(int $id, bool $reference=false)
+ 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.

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

124  : int
125  {
126  return (int) trim($this->str($this->getPostVar()));
127  }
+ Here is the call graph for this function:

◆ getSelectText()

ilRepositorySelectorInputGUI::getSelectText ( )

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

References $select_text.

Referenced by render().

88  : string
89  {
90  return $this->select_text;
91  }
+ 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.

References render().

250  : string
251  {
252  $html = $this->render("table_filter");
253  return $html;
254  }
+ 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().

73  : int
74  {
75  return $this->value;
76  }
+ Here is the caller graph for this function:

◆ getVisibleTypes()

ilRepositorySelectorInputGUI::getVisibleTypes ( )
protected

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

References getClickableTypes().

Referenced by getHighlightedNode(), and showRepositorySelection().

267  : array
268  {
269  return array_merge($this->container_types, $this->getClickableTypes());
270  }
+ 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.

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

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

◆ render()

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

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

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

Referenced by getTableFilterHTML(), and insert().

180  : string
181  {
182  $lng = $this->lng;
183  $ilCtrl = $this->ctrl;
184  $ilObjDataCache = $this->obj_data_cache;
185  $tree = $this->tree;
186  $parent_gui = "";
187 
188  $tpl = new ilTemplate("tpl.prop_rep_select.html", true, true, "components/ILIAS/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  );
210  $tpl->setVariable(
211  "HREF_SELECT",
212  $ilCtrl->getLinkTargetByClass(
213  array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
214  "showRepositorySelection"
215  )
216  );
217  $tpl->setVariable(
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) {
226  $tpl->setVariable(
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  }
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
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...
const ROOT_FOLDER_ID
Definition: constants.php:32
static prepareFormOutput($a_str, bool $a_strip=false)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
$nd
Definition: error.php:30
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
ilFormPropertyGUI $parent_gui
getParentTable()
Get parent table.
+ 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.

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

170  : void
171  {
172  $ilCtrl = $this->ctrl;
173 
174  $this->setValue("");
175  $this->writeToSession();
176 
177  $ilCtrl->returnToParent($this);
178  }
+ Here is the call graph for this function:

◆ selectRepositoryItem()

ilRepositorySelectorInputGUI::selectRepositoryItem ( )

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

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

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  }
+ Here is the call graph for this function:

◆ setClickableTypes()

ilRepositorySelectorInputGUI::setClickableTypes ( array  $a_types)

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

Referenced by __construct().

103  : void
104  {
105  $this->clickable_types = $a_types;
106  }
+ Here is the caller graph for this function:

◆ setHeaderMessage()

ilRepositorySelectorInputGUI::setHeaderMessage ( string  $a_val)

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

Referenced by __construct().

93  : void
94  {
95  $this->hm = $a_val;
96  }
+ Here is the caller graph for this function:

◆ setSelectText()

ilRepositorySelectorInputGUI::setSelectText ( string  $a_val)

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

Referenced by __construct(), ilLPTableBaseGUI\initBaseFilter(), ilMStListCoursesTableGUI\initFilter(), ilMStShowUserCoursesTableGUI\initFilter(), and ilUserTableGUI\initFilter().

83  : void
84  {
85  $this->select_text = $a_val;
86  }
+ 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.

References ilFormPropertyGUI\int().

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

68  : void
69  {
70  $this->value = (int) $a_value;
71  }
+ 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.

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

78  : void
79  {
80  $this->setValue($a_values[$this->getPostVar()] ?? "");
81  }
+ Here is the call graph for this function:

◆ showRepositorySelection()

ilRepositorySelectorInputGUI::showRepositorySelection ( )

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

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

129  : void
130  {
131  $tpl = $this->tpl;
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  }
setContent(string $a_html)
Sets content for standard template.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
+ 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 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: