ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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
Deprecated:
12 This component will be removed with ILIAS 12

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

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 44 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().

47  {
48  global $DIC;
49 
50  $this->lng = $DIC->language();
51  $this->tpl = $DIC["tpl"];
52  $this->ctrl = $DIC->ctrl();
53  $this->tree = $DIC->repositoryTree();
54  $this->user = $DIC->user();
55  $this->obj_data_cache = $DIC["ilObjDataCache"];
56  $lng = $DIC->language();
57 
58  parent::__construct($a_title, $a_postvar);
59  $this->setClickableTypes($this->container_types);
60  $this->setHeaderMessage($lng->txt('search_area_info'));
61  $this->setType("rep_select");
62  $this->setSelectText($lng->txt("select"));
63  }
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:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilRepositorySelectorInputGUI::checkInput ( )

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

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

114  : bool
115  {
116  $lng = $this->lng;
117 
118  if ($this->getRequired() && trim($this->str($this->getPostVar())) == "") {
119  $this->setAlert($lng->txt("msg_input_is_required"));
120  return false;
121  }
122  return true;
123  }
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 109 of file class.ilRepositorySelectorInputGUI.php.

References $clickable_types.

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

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

◆ getHeaderMessage()

ilRepositorySelectorInputGUI::getHeaderMessage ( )

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

References $hm.

Referenced by showRepositorySelection().

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

◆ getHighlightedNode()

ilRepositorySelectorInputGUI::getHighlightedNode ( )
protected

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

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

Referenced by showRepositorySelection().

257  : int
258  {
259  $tree = $this->tree;
260 
261  if (!in_array(ilObject::_lookupType($this->getValue(), true), $this->getVisibleTypes())) {
262  return $tree->getParentId($this->getValue());
263  }
264 
265  return $this->getValue();
266  }
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 125 of file class.ilRepositorySelectorInputGUI.php.

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

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

◆ getSelectText()

ilRepositorySelectorInputGUI::getSelectText ( )

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

References $select_text.

Referenced by render().

89  : string
90  {
91  return $this->select_text;
92  }
+ 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 251 of file class.ilRepositorySelectorInputGUI.php.

References render().

251  : string
252  {
253  $html = $this->render("table_filter");
254  return $html;
255  }
+ Here is the call graph for this function:

◆ getValue()

ilRepositorySelectorInputGUI::getValue ( )

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

References $value.

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

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

◆ getVisibleTypes()

ilRepositorySelectorInputGUI::getVisibleTypes ( )
protected

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

References getClickableTypes().

Referenced by getHighlightedNode(), and showRepositorySelection().

268  : array
269  {
270  return array_merge($this->container_types, $this->getClickableTypes());
271  }
+ 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 244 of file class.ilRepositorySelectorInputGUI.php.

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

244  : void
245  {
246  $a_tpl->setCurrentBlock("prop_generic");
247  $a_tpl->setVariable("PROP_GENERIC", $this->render());
248  $a_tpl->parseCurrentBlock();
249  }
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 181 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().

181  : string
182  {
183  $lng = $this->lng;
184  $ilCtrl = $this->ctrl;
185  $ilObjDataCache = $this->obj_data_cache;
186  $tree = $this->tree;
187  $parent_gui = "";
188 
189  $tpl = new ilTemplate("tpl.prop_rep_select.html", true, true, "components/ILIAS/Form");
190 
191  $tpl->setVariable("POST_VAR", $this->getPostVar());
192  $tpl->setVariable("ID", $this->getFieldId());
193  $tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput((string) $this->getValue()));
194  $tpl->setVariable("TXT_SELECT", $this->getSelectText());
195  $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
196  switch ($a_mode) {
197  case "property_form":
198  $parent_gui = "ilpropertyformgui";
199  break;
200 
201  case "table_filter":
202  $parent_gui = get_class($this->getParentTable());
203  break;
204  }
205 
206  $ilCtrl->setParameterByClass(
207  "ilrepositoryselectorinputgui",
208  "postvar",
209  $this->getPostVar()
210  );
211  $tpl->setVariable(
212  "HREF_SELECT",
213  $ilCtrl->getLinkTargetByClass(
214  array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
215  "showRepositorySelection"
216  )
217  );
218  $tpl->setVariable(
219  "HREF_RESET",
220  $ilCtrl->getLinkTargetByClass(
221  array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
222  "reset"
223  )
224  );
225 
226  if ($this->getValue() > 0 && $this->getValue() != ROOT_FOLDER_ID) {
227  $tpl->setVariable(
228  "TXT_ITEM",
229  $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->getValue()))
230  );
231  } else {
233  $title = $nd["title"];
234  if ($title == "ILIAS") {
235  $title = $lng->txt("repository");
236  }
237  if (in_array($nd["type"], $this->getClickableTypes())) {
238  $tpl->setVariable("TXT_ITEM", $title);
239  }
240  }
241  return $tpl->get();
242  }
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 171 of file class.ilRepositorySelectorInputGUI.php.

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

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

◆ selectRepositoryItem()

ilRepositorySelectorInputGUI::selectRepositoryItem ( )

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

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

161  : void
162  {
163  $ilCtrl = $this->ctrl;
164 
165  $this->setValue((string) $this->int("root_id"));
166  $this->writeToSession();
167 
168  $ilCtrl->returnToParent($this);
169  }
+ Here is the call graph for this function:

◆ setClickableTypes()

ilRepositorySelectorInputGUI::setClickableTypes ( array  $a_types)

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

Referenced by __construct().

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

◆ setHeaderMessage()

ilRepositorySelectorInputGUI::setHeaderMessage ( string  $a_val)

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

Referenced by __construct().

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

◆ setSelectText()

ilRepositorySelectorInputGUI::setSelectText ( string  $a_val)

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

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

84  : void
85  {
86  $this->select_text = $a_val;
87  }
+ Here is the caller graph for this function:

◆ setValue()

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

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

References ilFormPropertyGUI\int().

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

69  : void
70  {
71  $this->value = (int) $a_value;
72  }
+ 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 79 of file class.ilRepositorySelectorInputGUI.php.

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

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

◆ showRepositorySelection()

ilRepositorySelectorInputGUI::showRepositorySelection ( )

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

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

130  : void
131  {
132  $tpl = $this->tpl;
133  $ilCtrl = $this->ctrl;
134 
135  $ilCtrl->setParameter($this, "postvar", $this->getPostVar());
136 
137  $this->tpl->setOnScreenMessage('info', $this->getHeaderMessage());
138 
140  $this,
141  "showRepositorySelection",
142  $this,
143  "selectRepositoryItem",
144  "root_id"
145  );
146  $exp->setTypeWhiteList($this->getVisibleTypes());
147  $exp->setClickableTypes($this->getClickableTypes());
148 
149  if ($this->getValue()) {
150  $exp->setPathOpen($this->getValue());
151  $exp->setHighlightedNode((string) $this->getHighlightedNode());
152  }
153 
154  if ($exp->handleCommand()) {
155  return;
156  }
157  // build html-output
158  $tpl->setContent($exp->getHTML());
159  }
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 33 of file class.ilRepositorySelectorInputGUI.php.

Referenced by getClickableTypes().

◆ $container_types

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

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

◆ $hm

string ilRepositorySelectorInputGUI::$hm = ""
protected

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

Referenced by getHeaderMessage().

◆ $obj_data_cache

ilObjectDataCache ilRepositorySelectorInputGUI::$obj_data_cache
protected

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

Referenced by render().

◆ $options

array ilRepositorySelectorInputGUI::$options = []
protected

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

◆ $select_text

string ilRepositorySelectorInputGUI::$select_text = ""
protected

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

Referenced by getSelectText().

◆ $tpl

ilGlobalTemplateInterface ilRepositorySelectorInputGUI::$tpl
protected

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

Referenced by showRepositorySelection().

◆ $tree

ilTree ilRepositorySelectorInputGUI::$tree
protected

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

Referenced by getHighlightedNode(), and render().

◆ $user

ilObjUser ilRepositorySelectorInputGUI::$user
protected

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

◆ $value

int ilRepositorySelectorInputGUI::$value = 0
protected

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

Referenced by getValue().


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