ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilDclInputException.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once './Services/Exceptions/classes/class.ilException.php';
5 
18 {
19  const TYPE_EXCEPTION = 0;
20  const LENGTH_EXCEPTION = 1;
21  const REGEX_EXCEPTION = 2;
22  const UNIQUE_EXCEPTION = 3;
23  const NOT_URL = 4;
24  const NOT_IMAGE = 5;
25  const WRONG_FILE_TYPE = 6;
26  const CUSTOM_MESSAGE = 7;
28 
29 
33  protected $exception_type;
34 
38  protected $additional_text;
39 
40 
45  {
46  parent::__construct($exception_type);
47  $this->exception_type = $exception_type;
48  $this->additional_text = $additional_text;
49  }
50 
51 
55  public function getExceptionType()
56  {
57  return $this->exception_type;
58  }
59 
60 
64  public function __toString()
65  {
66  global $DIC;
67  $lng = $DIC['lng'];
68 
69  switch ($this->exception_type) {
70  case self::TYPE_EXCEPTION:
71  $message = $lng->txt('dcl_wrong_input_type');
72  break;
73  case self::LENGTH_EXCEPTION:
74  $message = $lng->txt('dcl_wrong_length');
75  break;
76  case self::REGEX_EXCEPTION:
77  $message = $lng->txt('dcl_wrong_regex');
78  break;
79  case self::REGEX_CONFIG_EXCEPTION:
80  $message = $lng->txt('dcl_invalid_regex_config');
81  break;
82  case self::UNIQUE_EXCEPTION:
83  $message = $lng->txt('dcl_unique_exception');
84  break;
85  case self::NOT_URL:
86  $message = $lng->txt('dcl_noturl_exception');
87  break;
88  case self::NOT_IMAGE:
89  $message = $lng->txt('dcl_notimage_exception');
90  break;
91  case self::WRONG_FILE_TYPE:
92  $message = $lng->txt('dcl_not_supported_file_type');
93  break;
94  case self::CUSTOM_MESSAGE:
96  break;
97  default:
98  $message = $lng->txt('dcl_unknown_exception');
99  }
100 
101  if (strlen($this->additional_text) > 0) {
103  }
104 
105  return $message;
106  }
107 }
global $DIC
Definition: saml.php:7
Class ilDclBaseFieldModel.
catch(Exception $e) $message
__construct($exception_type, $additional_text="")
global $lng
Definition: privfeed.php:17