19declare(strict_types=1);
50 string $a_postvar =
""
53 $this->
lng = $DIC->language();
57 $this->validationRegexp =
"";
65 if ($this->
getMulti() && is_array($a_value)) {
67 $a_value = array_shift($a_value);
69 $this->value = $a_value;
82 $this->validationFailureMessage = $a_msg;
92 $this->validationRegexp = $a_value;
102 $this->maxlength = $a_maxlength;
112 $this->size = $a_size;
117 $this->style_css = $a_style;
127 $this->css_class = $a_class;
147 $this->suffix = $a_value;
161 $this->input_type = $a_type;
171 $this->submit_form_on_enter = $a_val;
240 string $a_delimiter =
null
242 $this->ajax_datasource = $href;
243 $this->ajax_datasource_delimiter = $a_delimiter;
248 $this->ajax_datasource_commit = $a_stat;
253 return $this->ajax_datasource_commit;
258 $this->ajax_datasource_commit_url = $a_url;
263 return $this->ajax_datasource_commit_url;
268 foreach ($a_values as $idx => $value) {
269 $a_values[$idx] = trim($value);
270 if ($a_values[$idx] ==
"") {
271 unset($a_values[$idx]);
274 parent::setMultiValues($a_values);
277 public function render(
string $a_mode =
""): string
281 $tpl =
new ilTemplate(
"tpl.prop_textinput.html",
true,
true,
"Services/Form");
282 if (strlen((
string) $this->
getValue())) {
283 $tpl->setCurrentBlock(
"prop_text_propval");
288 $tpl->parseCurrentBlock();
290 if (strlen($this->getInlineStyle())) {
291 $tpl->setCurrentBlock(
"stylecss");
296 $tpl->parseCurrentBlock();
298 if (strlen($this->getCssClass())) {
299 $tpl->setCurrentBlock(
"classcss");
301 $tpl->parseCurrentBlock();
303 if ($this->getSubmitFormOnEnter()) {
304 $tpl->touchBlock(
"submit_form_on_enter");
307 switch ($this->getInputType()) {
309 $tpl->setVariable(
'PROP_INPUT_TYPE',
'password');
312 $tpl->setVariable(
'PROP_INPUT_TYPE',
'hidden');
316 $tpl->setVariable(
'PROP_INPUT_TYPE',
'text');
318 $tpl->setVariable(
"ID", $this->getFieldId());
319 $tpl->setVariable(
"SIZE", $this->getSize());
320 if ($this->getMaxLength() !=
null) {
321 $tpl->setVariable(
"MAXLENGTH", $this->getMaxLength());
323 if (strlen($this->getSuffix())) {
324 $tpl->setVariable(
"INPUT_SUFFIX", $this->getSuffix());
327 $postvar = $this->getPostVar();
328 if ($this->getMulti() && substr($postvar, -2) !=
"[]") {
332 $tpl->setVariable(
"POST_VAR", $postvar);
333 if ($this->getDisabled()) {
334 if ($this->getMulti()) {
335 $value = $this->getMultiValues();
337 if (is_array($value)) {
338 foreach ($value as $item) {
339 $hidden .= $this->getHiddenTag($postvar, $item);
343 $hidden = $this->getHiddenTag($postvar, $this->
getValue());
346 $tpl->setVariable(
"HIDDEN_INPUT", $hidden);
348 $tpl->setVariable(
"DISABLED",
" disabled=\"disabled\"");
352 if ($this->getDataSource()) {
356 $jstpl =
new ilTemplate(
"tpl.prop_text_autocomplete.js",
true,
true,
"Services/Form");
358 if ($this->getMulti()) {
359 $jstpl->setCurrentBlock(
"ac_multi");
360 $jstpl->setVariable(
'MURL_AUTOCOMPLETE', $this->getDataSource());
361 $jstpl->setVariable(
'ID_AUTOCOMPLETE', $this->getFieldId());
362 $jstpl->parseCurrentBlock();
365 $sel_auto =
'[id^="' . $this->getFieldId() .
'"]';
368 $sel_auto =
"#" . $this->getFieldId();
371 $jstpl->setCurrentBlock(
"autocomplete_bl");
372 if (!$this->ajax_datasource_delimiter and !$this->getDataSourceSubmitOnSelection()) {
373 $jstpl->setVariable(
'SEL_AUTOCOMPLETE', $sel_auto);
374 $jstpl->setVariable(
'URL_AUTOCOMPLETE', $this->getDataSource());
375 } elseif ($this->getDataSourceSubmitOnSelection()) {
376 $jstpl->setVariable(
'SEL_AUTOCOMPLETE_AUTOSUBMIT', $sel_auto);
377 $jstpl->setVariable(
'URL_AUTOCOMPLETE_AUTOSUBMIT_REQ', $this->getDataSource());
378 $jstpl->setVariable(
'URL_AUTOCOMPLETE_AUTOSUBMIT_RESP', $this->getDataSourceSubmitUrl());
380 $jstpl->setVariable(
'AUTOCOMPLETE_DELIMITER', $this->ajax_datasource_delimiter);
381 $jstpl->setVariable(
'SEL_AUTOCOMPLETE_DELIMITER', $sel_auto);
382 $jstpl->setVariable(
'URL_AUTOCOMPLETE_DELIMITER', $this->getDataSource());
384 $jstpl->parseCurrentBlock();
386 $jstpl->setVariable(
'MORE_TXT',
$lng->txt(
'autocomplete_more'));
387 $this->global_tpl->addOnloadCode($jstpl->get());
390 if ($a_mode ==
"toolbar") {
396 'display: -moz-inline-stack; display:inline-block; zoom: 1; *display:inline;'
399 $tpl->setVariable(
"STYLE_PAR",
'');
402 if ($this->isHtmlAutoCompleteDisabled()) {
403 $tpl->setVariable(
"AUTOCOMPLETE",
"autocomplete=\"off\"");
406 if ($this->getRequired()) {
407 $tpl->setVariable(
"REQUIRED",
"required=\"required\"");
411 if ($this->getMulti() && !$a_mode && !$this->getDisabled()) {
412 $tpl->touchBlock(
"inline_in_bl");
413 $tpl->setVariable(
"MULTI_ICONS", $this->getMultiIconsHTML());
417 if ($this->getInfo() !==
'') {
418 $tpl->setVariable(
'DESCRIBED_BY_FIELD_ID', $this->getFieldId());
426 $html = $this->render();
435 $html = $this->render();
441 $html = $this->render(
"toolbar");
447 $this->autocomplete_disabled = $autocomplete;
452 return $this->autocomplete_disabled;
457 return $this->getInput();
setVariable($variable, $value='')
Sets a variable value.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
This class represents a text property in a property form.
setDataSourceSubmitUrl(string $a_url)
setDataSource(string $href, string $a_delimiter=null)
string $ajax_datasource_commit_url
setCssClass(string $a_class)
setDisableHtmlAutoComplete(bool $autocomplete)
getTableFilterHTML()
Get input item HTML to be inserted into table filters.
getPostValueForComparison()
string $validationFailureMessage
bool $autocomplete_disabled
setInlineStyle(string $a_style)
setMultiValues(array $a_values)
setDataSourceSubmitOnSelection(bool $a_stat)
getToolbarHTML()
Get input item HTML to be inserted into ilToolbarGUI.
bool $submit_form_on_enter
insert(ilTemplate $a_tpl)
setSuffix(string $a_value)
string $ajax_datasource_delimiter
setSubmitFormOnEnter(bool $a_val)
setInputType(string $a_type)
set input type
checkInput()
Check input, strip slashes etc.
getDataSourceSubmitOnSelection()
setMaxLength(?int $a_maxlength)
setValidationRegexp(string $a_value)
getValidationFailureMessage()
__construct(string $a_title="", string $a_postvar="")
bool $ajax_datasource_commit
setValueByArray(array $a_values)
setValidationFailureMessage(string $a_msg)
isHtmlAutoCompleteDisabled()
render(string $a_mode="")
static initjQueryUI(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc