ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilChatroomMessageDeletionThresholdInputGUI.php
Go to the documentation of this file.
1<?php
2
7{
11 protected $thresholdUnits;
12
19 public function __construct($a_title = "", $a_postvar = "", ilSelectInputGUI $thresholdUnits)
20 {
21 parent::__construct($a_title, $a_postvar);
22 $this->thresholdUnits = $thresholdUnits;
23 }
24
28 public function checkInput()
29 {
30 $isValid = parent::checkInput();
31
32 if (!$isValid) {
33 return false;
34 }
35
36 $this->setValueByArray((array) $_POST);
37 $this->thresholdUnits->setValueByArray((array) $_POST);
38
39 $unit = $this->thresholdUnits->getValue();
40 switch (true) {
41 case $unit == 'days' && $this->getValue() > 31:
42 $this->setAlert(sprintf(
43 $GLOBALS['DIC']->language()->txt('chat_deletion_ival_max_val'),
44 $GLOBALS['DIC']->language()->txt('days'),
45 31
46 ));
47 return false;
48 break;
49
50 case $unit == 'weeks' && $this->getValue() > 52:
51 $this->setAlert(sprintf(
52 $GLOBALS['DIC']->language()->txt('chat_deletion_ival_max_val'),
53 $GLOBALS['DIC']->language()->txt('weeks'),
54 52
55 ));
56 return false;
57 break;
58
59 case $unit == 'months' && $this->getValue() > 12:
60 $this->setAlert(sprintf(
61 $GLOBALS['DIC']->language()->txt('chat_deletion_ival_max_val'),
62 $GLOBALS['DIC']->language()->txt('months'),
63 12
64 ));
65 return false;
66 break;
67 }
68
69 return true;
70 }
71}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
__construct($a_title="", $a_postvar="", ilSelectInputGUI $thresholdUnits)
ilChatroomMessageDeletionThresholdInputGUI constructor.
checkInput()
Check input, strip slashes etc.set alert, if input is not ok.boolean Input ok, true/false
setAlert($a_alert)
Set Alert Text.
This class represents a number property in a property form.
setValueByArray($a_values)
Set value by array.
This class represents a selection list property in a property form.
language()
Definition: language.php:2
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc