ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilDataCollectionTreePickInputGUI.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 $lng, $tpl;
47  parent::__construct($title, $post_var);
48  $tpl->addJavaScript('./Modules/DataCollection/js/ilDclTreeSearch.js');
49  $this->title_input = new ilTextInputGUI($this->getTitle(), "display_" . $this->getPostVar());
50  $this->title_input->setDisabled(true);
51  $this->title_input->setInfo($lng->txt("dcl_ilias_refere nce_info"));
52  $this->title_input->setInlineStyle('width: 98%; display:inline-block;');
53  $this->search_input = new ilTextInputGUI($this->getTitle(), "search_" . $this->getPostVar());
54  $this->search_input->setDisabled(false);
55  $this->search_input->setInfo($lng->txt('dcl_ilias_reference_info'));
56  $this->search_input->setInlineStyle('width: 98%; margin-top: 5px;');
57  $this->hidden_input = new ilHiddenInputGUI($this->getPostVar());
58  $this->lng = $lng;
59  }
60 
61 
65  public function getHtml() {
66  global $ilCtrl;
67  $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection");
68  $tpl->setVariable("FIELD_ID", $this->getPostVar());
69  $tpl->setVariable("AJAX_LINK", $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", "searchObjects"));
70  $tpl->setVariable("LOADER_PATH", ilUtil::getImagePath("loader.svg"));
71  $out = $this->title_input->getToolbarHTML();
72  $out .= "<a href='#' style='display:inline-block;' id='remove_{$this->getPostVar()}'>" . ilGlyphGUI::get(ilGlyphGUI::REMOVE) . "</a>";
73  $out .= $this->search_input->getTableFilterHTML();
74  $out .= $this->hidden_input->getToolbarHTML();
75  $out .= "<a href='#' id='search_button_" . $this->getPostVar() . "'>" . $this->lng->txt('search') . "</a>";
76  $out .= $tpl->get();
77 
78  return $out;
79  }
80 
81 
85  public function setValueByArray($value) {
87  include_once './Services/Tree/classes/class.ilPathGUI.php';
88  $path = new ilPathGUI();
89  $reference = $value[$this->getPostVar()];
90  if ($reference) {
91  $pathString = $path->getPath(ROOT_FOLDER_ID, $reference);
92  $id = ilObject::_lookupObjId($reference);
93  $this->title_input->setValue($pathString . " > " . ilObject::_lookupTitle($id));
94  $this->hidden_input->setValue($reference);
95  }
96  }
97 }
98 
99 ?>