ILIAS  release_4-3 Revision
 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;
25 
26  private $exception_type;
27 
28  /*
29  * __construct
30  */
31  public function __construct($exception_type)
32  {
34  $this->exception_type = $exception_type;
35  }
36 
37  /*
38  * getExceptionType
39  */
40  public function getExceptionType()
41  {
42  return $this->exception_type;
43  }
44 
45  /*
46  * __toString
47  */
48  public function __toString()
49  {
50  global $lng;
51 
52  switch($this->exception_type)
53  {
54  case self::TYPE_EXCEPTION:
55  return $lng->txt("dcl_wrong_input_type");
56  case self::LENGTH_EXCEPTION:
57  return $lng->txt("dcl_wrong_length");
58  case self::REGEX_EXCEPTION:
59  return $lng->txt("dcl_wrong_regex");
60  case self::UNIQUE_EXCEPTION:
61  return $lng->txt("dcl_unique_exception");
62  case self::NOT_URL:
63  return $lng->txt("dcl_noturl_exception");
64  case self::NOT_IMAGE:
65  return $lng->txt("dcl_notimage_exception");
66  default:
67  return $lng->txt("dcl_unknown_exception");
68  }
69  }
70 
71 }