ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
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{
24
28 protected $title_input;
32 protected $search_input;
36 protected $lng;
37
38
43 public function __construct($title, $post_var)
44 {
45 global $DIC;
46 $lng = $DIC['lng'];
47 $tpl = $DIC['tpl'];
51 parent::__construct($title, $post_var);
52 $tpl->addJavaScript('./Modules/DataCollection/js/ilDclTreeSearch.js');
53 $this->title_input = new ilTextInputGUI($this->getTitle(), "display_" . $this->getPostVar());
54 $this->title_input->setDisabled(true);
55 $this->title_input->setInfo($lng->txt("dcl_ilias_refere nce_info"));
56 $this->title_input->setInlineStyle('width: 98%; display:inline-block;');
57 $this->search_input = new ilTextInputGUI($this->getTitle(), "search_" . $this->getPostVar());
58 $this->search_input->setDisabled(false);
59 $this->search_input->setInfo($lng->txt('dcl_ilias_reference_info'));
60 $this->search_input->setInlineStyle('width: 98%; margin-top: 5px;');
61 $this->hidden_input = new ilHiddenInputGUI($this->getPostVar());
62 $this->lng = $lng;
63 }
64
65
69 public function getHtml()
70 {
71 global $DIC;
72 $ilCtrl = $DIC['ilCtrl'];
73 $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection");
74 $tpl->setVariable("FIELD_ID", $this->getPostVar());
75 $tpl->setVariable("AJAX_LINK", $ilCtrl->getLinkTargetByClass("ildclrecordeditgui", "searchObjects"));
76 $tpl->setVariable("LOADER_PATH", ilUtil::getImagePath("loader.svg"));
77 $out = $this->title_input->getToolbarHTML();
78 $out .= "<a href='#' style='display:inline-block;' id='remove_{$this->getPostVar()}'>" . ilGlyphGUI::get(ilGlyphGUI::REMOVE) . "</a>";
79 $out .= $this->search_input->getTableFilterHTML();
80 $out .= $this->hidden_input->getToolbarHTML();
81 $out .= "<a href='#' id='search_button_" . $this->getPostVar() . "'>" . $this->lng->txt('search') . "</a>";
82 $out .= $tpl->get();
83
84 return $out;
85 }
86
87
91 public function setValueByArray($value)
92 {
93 parent::setValueByArray($value);
94 include_once './Services/Tree/classes/class.ilPathGUI.php';
95 $path = new ilPathGUI();
96 $reference = $value[$this->getPostVar()];
97 if ($reference) {
98 $pathString = $path->getPath(ROOT_FOLDER_ID, $reference);
99 $id = ilObject::_lookupObjId($reference);
100 $this->title_input->setValue($pathString . " > " . ilObject::_lookupTitle($id));
101 $this->hidden_input->setValue($reference);
102 }
103 }
104}
$tpl
Definition: ilias.php:10
$path
Definition: aliased.php:25
An exception for terminatinating execution or to throw for unit testing.
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)
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7