ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
34 return false;
35 }
36
37 $this->setValueByArray((array)$_POST);
38 $this->thresholdUnits->setValueByArray((array)$_POST);
39
40 $unit = $this->thresholdUnits->getValue();
41 switch(true)
42 {
43 case $unit == 'days' && $this->getValue() > 31:
44 $this->setAlert(sprintf(
45 $GLOBALS['DIC']->language()->txt('chat_deletion_ival_max_val'),
46 $GLOBALS['DIC']->language()->txt('days'),
47 31
48 ));
49 return false;
50 break;
51
52 case $unit == 'weeks' && $this->getValue() > 52:
53 $this->setAlert(sprintf(
54 $GLOBALS['DIC']->language()->txt('chat_deletion_ival_max_val'),
55 $GLOBALS['DIC']->language()->txt('weeks'),
56 52
57 ));
58 return false;
59 break;
60
61 case $unit == 'months' && $this->getValue() > 12:
62 $this->setAlert(sprintf(
63 $GLOBALS['DIC']->language()->txt('chat_deletion_ival_max_val'),
64 $GLOBALS['DIC']->language()->txt('months'),
65 12
66 ));
67 return false;
68 break;
69 }
70
71 return true;
72 }
73}
sprintf('%.4f', $callTime)
$_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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.