ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilDclTextInputGUI.php
Go to the documentation of this file.
1 <?php
2 
20 {
21  public function setValueByArray(array $a_values): void
22  {
23  parent::setValueByArray($a_values);
24  foreach ($this->getSubItems() as $item) {
25  $item->setValueByArray($a_values);
26  }
27  }
28 
29  public function checkInput(): bool
30  {
31  // validate regex
32  $has_postvar = $this->http->wrapper()->post()->has($this->getPostVar());
33  if ($this->getPostVar() == 'prop_' . ilDclBaseFieldModel::PROP_REGEX && $has_postvar) {
34  $regex = $this->http->wrapper()->post()->retrieve(
35  $this->getPostVar(),
36  $this->refinery->kindlyTo()->string()
37  );
38  if (substr($regex, 0, 1) != "/") {
39  $regex = "/" . $regex;
40  }
41  if (substr($regex, -1) != "/" || $regex == "/") {
42  $regex .= "/";
43  }
44 
45  try {
46  preg_match($regex, '');
47  } catch (Exception $e) {
48  global $DIC;
49  $lng = $DIC['lng'];
50  $this->setAlert($lng->txt('msg_input_does_not_match_regexp'));
51 
52  return false;
53  }
54  }
55 
56  return parent::checkInput();
57  }
58 }
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...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
setValueByArray(array $a_values)