ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclTreePickInputGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Form/classes/class.ilCustomInputGUI.php");
5 include_once("./Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php");
6 include_once('./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php');
7 
23 
27  protected $title_input;
31  protected $search_input;
35  protected $lng;
36 
37 
42  public function __construct($title, $post_var) {
43  global $DIC;
44  $lng = $DIC['lng'];
45  $tpl = $DIC['tpl'];
49  parent::__construct($title, $post_var);
50  $tpl->addJavaScript('./Modules/DataCollection/js/ilDclTreeSearch.js');
51  $this->title_input = new ilTextInputGUI($this->getTitle(), "display_" . $this->getPostVar());
52  $this->title_input->setDisabled(true);
53  $this->title_input->setInfo($lng->txt("dcl_ilias_refere nce_info"));
54  $this->title_input->setInlineStyle('width: 98%; display:inline-block;');
55  $this->search_input = new ilTextInputGUI($this->getTitle(), "search_" . $this->getPostVar());
56  $this->search_input->setDisabled(false);
57  $this->search_input->setInfo($lng->txt('dcl_ilias_reference_info'));
58  $this->search_input->setInlineStyle('width: 98%; margin-top: 5px;');
59  $this->hidden_input = new ilHiddenInputGUI($this->getPostVar());
60  $this->lng = $lng;
61  }
62 
63 
67  public function getHtml() {
68  global $DIC;
69  $ilCtrl = $DIC['ilCtrl'];
70  $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection");
71  $tpl->setVariable("FIELD_ID", $this->getPostVar());
72  $tpl->setVariable("AJAX_LINK", $ilCtrl->getLinkTargetByClass("ildclrecordeditgui", "searchObjects"));
73  $tpl->setVariable("LOADER_PATH", ilUtil::getImagePath("loader.svg"));
74  $out = $this->title_input->getToolbarHTML();
75  $out .= "<a href='#' style='display:inline-block;' id='remove_{$this->getPostVar()}'>" . ilGlyphGUI::get(ilGlyphGUI::REMOVE) . "</a>";
76  $out .= $this->search_input->getTableFilterHTML();
77  $out .= $this->hidden_input->getToolbarHTML();
78  $out .= "<a href='#' id='search_button_" . $this->getPostVar() . "'>" . $this->lng->txt('search') . "</a>";
79  $out .= $tpl->get();
80 
81  return $out;
82  }
83 
84 
88  public function setValueByArray($value) {
89  parent::setValueByArray($value);
90  include_once './Services/Tree/classes/class.ilPathGUI.php';
91  $path = new ilPathGUI();
92  $reference = $value[$this->getPostVar()];
93  if ($reference) {
94  $pathString = $path->getPath(ROOT_FOLDER_ID, $reference);
95  $id = ilObject::_lookupObjId($reference);
96  $this->title_input->setValue($pathString . " > " . ilObject::_lookupTitle($id));
97  $this->hidden_input->setValue($reference);
98  }
99  }
100 }
101 
102 ?>
Creates a path for a start and endnode.
$path
Definition: aliased.php:25
__construct($a_title="", $a_postvar="")
Constructor.
getPostVar()
Get Post Variable.
static get($a_glyph, $a_text="")
Get glyph html.
static _lookupTitle($a_id)
lookup object title
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
This class represents a custom property in a property form.
global $DIC