ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 }
This class represents a selection list property in a property form.
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.
setValueByArray($a_values)
Set value by array.
$_POST["username"]
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.