ILIAS  Release_4_4_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 
22 
23  private $customHTML;
27  private $title_input;
31  private $search_input;
35  protected $lng;
36 
37 
42  public function __construct($title, $post_var) {
43  global $lng, $tpl;
44  parent::__construct($title, $post_var);
45  $tpl->addJavaScript('./Modules/DataCollection/js/ilDclTreeSearch.js');
46  $this->title_input = new ilTextInputGUI($this->getTitle(), "display_" . $this->getPostVar());
47  $this->title_input->setDisabled(true);
48  $this->title_input->setInfo($lng->txt("dcl_ilias_refere nce_info"));
49  $this->search_input = new ilTextInputGUI($this->getTitle(), "search_" . $this->getPostVar());
50  $this->search_input->setDisabled(false);
51  $this->search_input->setInfo($lng->txt('dcl_ilias_reference_info'));
52  $this->hidden_input = new ilHiddenInputGUI($this->getPostVar());
53  $this->lng = $lng;
54  }
55 
56 
60  public function getHtml() {
61  global $ilCtrl;
62  $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection");
63  $tpl->setVariable("FIELD_ID", $this->getPostVar());
64  $tpl->setVariable("AJAX_LINK", $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", "searchObjects"));
65  $tpl->setVariable("LOADER_PATH", ilUtil::getImagePath("loader.gif"));
66 
67  return
68  $this->title_input->getToolbarHTML() . "" . $this->search_input->getTableFilterHTML() . $this->hidden_input->getToolbarHTML()
69  . " <a href='#' id='search_button_" . $this->getPostVar() . "'>" . $this->lng->txt('search') . "</a>" . $tpl->get();
70  }
71 
72 
76  public function setValueByArray($value) {
78  include_once './Services/Tree/classes/class.ilPathGUI.php';
79  $path = new ilPathGUI();
80  $reference = $value[$this->getPostVar()];
81  if ($reference) {
82  $pathString = $path->getPath(ROOT_FOLDER_ID, $reference);
83  $id = ilObject::_lookupObjId($reference);
84  $this->title_input->setValue($pathString . " > " . ilObject::_lookupTitle($id));
85  $this->hidden_input->setValue($reference);
86  }
87  }
88 }
89 
90 ?>