ILIAS  release_7 Revision v7.30-3-g800a261c036
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
19{
20
24 protected $title_input;
28 protected $search_input;
32 protected $lng;
33
34
39 public function __construct($title, $post_var)
40 {
41 global $DIC;
42 $lng = $DIC['lng'];
43 $tpl = $DIC['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 {
67 global $DIC;
68 $ilCtrl = $DIC['ilCtrl'];
69 $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection");
70 $tpl->setVariable("FIELD_ID", $this->getPostVar());
71 $tpl->setVariable("AJAX_LINK", $ilCtrl->getLinkTargetByClass("ildclrecordeditgui", "searchObjects"));
72 $tpl->setVariable("LOADER_PATH", ilUtil::getImagePath("loader.svg"));
73 $out = $this->title_input->getToolbarHTML();
74 $out .= "<a href='#' style='display:inline-block;' id='remove_{$this->getPostVar()}'>" . ilGlyphGUI::get(ilGlyphGUI::REMOVE) . "</a>";
75 $out .= $this->search_input->getTableFilterHTML();
76 $out .= $this->hidden_input->getToolbarHTML();
77 $out .= "<a href='#' id='search_button_" . $this->getPostVar() . "'>" . $this->lng->txt('search') . "</a>";
78 $out .= $tpl->get();
79
80 return $out;
81 }
82
83
87 public function setValueByArray($value)
88 {
89 parent::setValueByArray($value);
90 $path = new ilPathGUI();
91 $reference = $value[$this->getPostVar()];
92 if ($reference) {
93 $pathString = $path->getPath(ROOT_FOLDER_ID, $reference);
94 $id = ilObject::_lookupObjId($reference);
95 $this->title_input->setValue($pathString . " > " . ilObject::_lookupTitle($id));
96 $this->hidden_input->setValue($reference);
97 }
98 }
99}
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)
const ROOT_FOLDER_ID
Definition: constants.php:30
global $DIC
Definition: goto.php:24
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc