ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilDataCollectionInputException.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;
28  protected $exception_type;
29 
30 
34  public function __construct($exception_type) {
36  $this->exception_type = $exception_type;
37  }
38 
39 
43  public function getExceptionType() {
44  return $this->exception_type;
45  }
46 
47 
51  public function __toString() {
52  global $lng;
53 
54  switch ($this->exception_type) {
55  case self::TYPE_EXCEPTION:
56  return $lng->txt('dcl_wrong_input_type');
57  case self::LENGTH_EXCEPTION:
58  return $lng->txt('dcl_wrong_length');
59  case self::REGEX_EXCEPTION:
60  return $lng->txt('dcl_wrong_regex');
61  case self::UNIQUE_EXCEPTION:
62  return $lng->txt('dcl_unique_exception');
63  case self::NOT_URL:
64  return $lng->txt('dcl_noturl_exception');
65  case self::NOT_IMAGE:
66  return $lng->txt('dcl_notimage_exception');
67  default:
68  return $lng->txt('dcl_unknown_exception');
69  }
70  }
71 }