ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilDclTextInputGUI.php
Go to the documentation of this file.
1 <?php
2 
3 
10 {
11  public function setValueByArray($a_values)
12  {
13  parent::setValueByArray($a_values);
14  foreach ($this->getSubItems() as $item) {
15  $item->setValueByArray($a_values);
16  }
17  }
18 
19 
20  public function checkInput()
21  {
22  // validate regex
23  if ($this->getPostVar() == 'prop_' . ilDclBaseFieldModel::PROP_REGEX && $_POST[$this->getPostVar()]) {
24  $regex = $_POST[$this->getPostVar()];
25  if (substr($regex, 0, 1) != "/") {
26  $regex = "/" . $regex;
27  }
28  if (substr($regex, -1) != "/") {
29  $regex .= "/";
30  }
31  try {
32  preg_match($regex, '');
33  } catch (Exception $e) {
34  global $DIC;
35  $lng = $DIC['lng'];
36  $this->setAlert($lng->txt('msg_input_does_not_match_regexp'));
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"]