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 }
This class represents a selection list property in a property form.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
setAlert($a_alert)
Set Alert Text.
__construct($a_title="", $a_postvar="", ilSelectInputGUI $thresholdUnits)
ilChatroomMessageDeletionThresholdInputGUI constructor.
This class represents a number property in a property form.
Create styles array
The data for the language used.
setValueByArray($a_values)
Set value by array.
$_POST["username"]