ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilRepositorySelector2InputGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/UIComponent/Explorer2/classes/class.ilExplorerSelectInputGUI.php");
6 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
7 
17 {
21  protected $title_modifier = null;
22 
29  function __construct($a_title, $a_postvar, $a_multi = false, $form = ilPropertyFormGUI::class)
30  {
31  global $ilCtrl;
32 
33  $this->multi_nodes = $a_multi;
34  $this->postvar = $a_postvar;
35 
36  include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
37  $this->explorer_gui = new ilRepositorySelectorExplorerGUI([$form, ilFormPropertyDispatchGUI::class, ilRepositorySelector2InputGUI::class],
38  $this->getExplHandleCmd(), $this, "selectRepositoryItem", "root_id", "rep_exp_sel_".$a_postvar);
39 // $this->explorer_gui->setTypeWhiteList($this->getVisibleTypes());
40 // $this->explorer_gui->setClickableTypes($this->getClickableTypes());
41  $this->explorer_gui->setSelectMode($a_postvar."_sel", $this->multi_nodes);
42  //$this->explorer_gui = new ilTaxonomyExplorerGUI(array("ilformpropertydispatchgui", "iltaxselectinputgui"), $this->getExplHandleCmd(), $a_taxonomy_id, "", "",
43  // "tax_expl_".$a_postvar);
44 
45  parent::__construct($a_title, $a_postvar, $this->explorer_gui, $this->multi_nodes);
46  $this->setType("rep_select");
47  }
48 
54  function setTitleModifier(callable $a_val)
55  {
56  $this->title_modifier = $a_val;
57  if ($a_val != null)
58  {
59  $this->explorer_gui->setNodeContentModifier(function ($a_node) use ($a_val) {
60  return $a_val($a_node["child"]);
61  });
62  }
63  else
64  {
65  $this->explorer_gui->setNodeContentModifier(null);
66  }
67  }
68 
74  function getTitleModifier()
75  {
76  return $this->title_modifier;
77  }
78 
85  function getTitleForNodeId($a_id)
86  {
87  $c = $this->getTitleModifier();
88  if (is_callable($c))
89  {
90  return $c($a_id);
91  }
93  }
94 
99  {
100  if ($this->explorer_gui->handleCommand())
101  {
102 // exit;
103  }
104  }
105 
109  function getExplorerGUI()
110  {
111  return $this->explorer_gui;
112  }
113 
120  function getHTML()
121  {
122  global $ilCtrl;
123  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $this->postvar);
124  $html = parent::getHTML();
125  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $_REQUEST["postvar"]);
126  return $html;
127  }
128 
132  function render($a_mode = "property_form")
133  {
134  global $ilCtrl;
135  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $this->postvar);
136  return parent::render($a_mode);
137  $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $_REQUEST["postvar"]);
138  }
139 }
setTitleModifier(callable $a_val)
Set title modifier.
Explorer for selecting repository items.
static _lookupTitle($a_id)
lookup object title
getTitleForNodeId($a_id)
Get title for node id (needs to be overwritten, if explorer is not a tree eplorer.
global $ilCtrl
Definition: ilias.php:18
setType($a_type)
Set Type.
getExplHandleCmd()
Get explorer handle command function.
render($a_mode="property_form")
Render item.
static _lookupObjId($a_id)
__construct($a_title, $a_postvar, $a_multi=false, $form=ilPropertyFormGUI::class)
Constructor.
Select explorer tree nodes input GUI.
$html
Definition: example_001.php:87