ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4include_once("./Services/Form/classes/class.ilCustomInputGUI.php");
5include_once("./Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php");
6include_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) {
86 parent::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?>
global $tpl
Definition: ilias.php:8
This class represents a custom property in a property form.
__construct($a_title="", $a_postvar="")
Constructor.
getPostVar()
Get Post Variable.
static get($a_glyph, $a_text="")
Get glyph html.
This class represents a hidden form property in a property form.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
Creates a path for a start and endnode.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
$path
Definition: index.php:22