ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclTextInputGUI.php
Go to the documentation of this file.
1 <?php
2 
9 {
10  public function setValueByArray($a_values)
11  {
12  parent::setValueByArray($a_values);
13  foreach ($this->getSubItems() as $item) {
14  $item->setValueByArray($a_values);
15  }
16  }
17 
18 
19  public function checkInput()
20  {
21  // validate regex
22  if ($this->getPostVar() == 'prop_' . ilDclBaseFieldModel::PROP_REGEX && $_POST[$this->getPostVar()]) {
23  $regex = $_POST[$this->getPostVar()];
24  if (substr($regex, 0, 1) != "/") {
25  $regex = "/" . $regex;
26  }
27  if (substr($regex, -1) != "/") {
28  $regex .= "/";
29  }
30  try {
31  preg_match($regex, '');
32  } catch (Exception $e) {
33  global $DIC;
34  $lng = $DIC['lng'];
35  $this->setAlert($lng->txt('msg_input_does_not_match_regexp'));
36 
37  return false;
38  }
39  }
40 
41  return parent::checkInput();
42  }
43 }
global $DIC
Definition: saml.php:7
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
Class ilDclTextInputGUI.
This class represents a text property in a property form.
$_POST["username"]