ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclTextInputGUI.php
Go to the documentation of this file.
1<?php
2
3require_once('./Services/Form/classes/class.ilTextInputGUI.php');
4
11{
12
13 function setValueByArray($a_values)
14 {
15 parent::setValueByArray($a_values);
16 foreach ($this->getSubItems() as $item) {
17 $item->setValueByArray($a_values);
18 }
19
20 }
21
22
23 function checkInput() {
24 // validate regex
25 if ($this->getPostVar() == 'prop_' . ilDclBaseFieldModel::PROP_REGEX && $_POST[$this->getPostVar()]) {
26 $regex = $_POST[$this->getPostVar()];
27 if (substr($regex, 0, 1) != "/") {
28 $regex = "/" . $regex;
29 }
30 if (substr($regex, - 1) != "/") {
31 $regex .= "/";
32 }
33 try {
34 preg_match($regex, '');
35 } catch (Exception $e) {
36 global $lng;
37 $this->setAlert($lng->txt('msg_input_does_not_match_regexp'));
38 return false;
39 }
40 }
41
42 return parent::checkInput();
43 }
44}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Class ilDclTextInputGUI.
setValueByArray($a_values)
Set value by array.
checkInput()
Check input, strip slashes etc.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
This class represents a text property in a property form.
global $lng
Definition: privfeed.php:17