ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilADTLocation Class Reference
+ Inheritance diagram for ilADTLocation:
+ Collaboration diagram for ilADTLocation:

Public Member Functions

 reset ()
 
 setLongitude ($a_value=null)
 
 getLongitude ()
 
 setLatitude ($a_value=null)
 
 getLatitude ()
 
 getZoom ()
 
 setZoom ($a_value)
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 isValid ()
 
 translateErrorCode ($a_code)
 
 getCheckSum ()
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 Constructor. More...
 
 getType ()
 Get type (from class/instance) More...
 
 getCopyOfDefinition ()
 Get copy of definition. More...
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isLargerOrEqual (ilADT $a_adt)
 Check if given ADT is larger or equal than self. More...
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isSmallerOrEqual (ilADT $a_adt)
 Check if given ADT is smaller or equal than self. More...
 
 isInbetween (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (exclusive) More...
 
 isInbetweenOrEqual (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (inclusive) More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 Is currently valid. More...
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode ($a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 

Data Fields

const ADT_VALIDATION_ERROR_LONGITUDE = "loc1"
 
const ADT_VALIDATION_ERROR_LATITUDE = "loc2"
 
- Data Fields inherited from ilADT
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"
 
const ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"
 
const ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"
 
const ADT_VALIDATION_ERROR_MIN = "adt4"
 
const ADT_VALIDATION_ERROR_MAX = "adt5"
 
const ADT_VALIDATION_DATE = "adt6"
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 
- Protected Member Functions inherited from ilADT
 reset ()
 Init property defaults. More...
 
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError ($a_error_code)
 Add validation error code. More...
 

Protected Attributes

 $longitude
 
 $latitude
 
 $zoom
 
- Protected Attributes inherited from ilADT
 $definition
 
 $validation_errors
 

Detailed Description

Definition at line 3 of file class.ilADTLocation.php.

Member Function Documentation

◆ equals()

ilADTLocation::equals ( ilADT  $a_adt)

Definition at line 76 of file class.ilADTLocation.php.

References ilADT\getDefinition(), getLatitude(), and getLongitude().

77  {
78  if($this->getDefinition()->isComparableTo($a_adt))
79  {
80  return ($this->getLongitude() == $a_adt->getLongitude() &&
81  $this->getLatitude() == $a_adt->getLatitude());
82  }
83  }
getDefinition()
Get definition.
Definition: class.ilADT.php:99
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTLocation::getCheckSum ( )

Definition at line 156 of file class.ilADTLocation.php.

References getLatitude(), getLongitude(), getZoom(), and isNull().

157  {
158  if(!$this->isNull())
159  {
160  return md5($this->getLongitude().
161  "#".$this->getLatitude().
162  "#".$this->getZoom());
163  }
164  }
+ Here is the call graph for this function:

◆ getLatitude()

ilADTLocation::getLatitude ( )

Definition at line 58 of file class.ilADTLocation.php.

References $latitude.

Referenced by equals(), getCheckSum(), isNull(), and isValid().

59  {
60  return $this->latitude;
61  }
+ Here is the caller graph for this function:

◆ getLongitude()

ilADTLocation::getLongitude ( )

Definition at line 44 of file class.ilADTLocation.php.

References $longitude.

Referenced by equals(), getCheckSum(), isNull(), and isValid().

45  {
46  return $this->longitude;
47  }
+ Here is the caller graph for this function:

◆ getZoom()

ilADTLocation::getZoom ( )

Definition at line 63 of file class.ilADTLocation.php.

References $zoom.

Referenced by getCheckSum().

64  {
65  return $this->zoom;
66  }
+ Here is the caller graph for this function:

◆ isLarger()

ilADTLocation::isLarger ( ilADT  $a_adt)

Definition at line 85 of file class.ilADTLocation.php.

86  {
87  // return null?
88  }

◆ isNull()

ilADTLocation::isNull ( )

Definition at line 98 of file class.ilADTLocation.php.

References getLatitude(), and getLongitude().

Referenced by getCheckSum().

99  {
100  return ($this->getLongitude() === null && $this->getLatitude() === null);
101  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTLocation::isSmaller ( ilADT  $a_adt)

Definition at line 90 of file class.ilADTLocation.php.

91  {
92  // return null?
93  }

◆ isValid()

ilADTLocation::isValid ( )

Definition at line 106 of file class.ilADTLocation.php.

References $valid, ilADT\addValidationError(), getLatitude(), and getLongitude().

107  {
108  $valid = parent::isValid();
109 
110  // zoom?
111 
112  $long = $this->getLongitude();
113  $lat = $this->getLatitude();
114  if($long !== null && $lat !== null)
115  {
116  // 0 - (+-)180
117  if($long < -180 || $long > 180)
118  {
119  $this->addValidationError(self::ADT_VALIDATION_ERROR_LONGITUDE);
120  $valid = false;
121  }
122  // 0 - (+-)90
123  if($lat < -90 || $lat > 90)
124  {
125  $this->addValidationError(self::ADT_VALIDATION_ERROR_LATITUDE);
126  $valid = false;
127  }
128  }
129 
130  return $valid;
131  }
$valid
addValidationError($a_error_code)
Add validation error code.
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTLocation::isValidDefinition ( ilADTDefinition  $a_def)
protected

Definition at line 15 of file class.ilADTLocation.php.

16  {
17  return ($a_def instanceof ilADTLocationDefinition);
18  }

◆ reset()

ilADTLocation::reset ( )

Definition at line 23 of file class.ilADTLocation.php.

References setLatitude(), setLongitude(), and setZoom().

24  {
25  parent::reset();
26 
27  $this->setZoom(9);
28  $this->setLatitude();
29  $this->setLongitude();
30  }
setLongitude($a_value=null)
setLatitude($a_value=null)
+ Here is the call graph for this function:

◆ setLatitude()

ilADTLocation::setLatitude (   $a_value = null)

Definition at line 49 of file class.ilADTLocation.php.

Referenced by reset().

50  {
51  if($a_value !== null)
52  {
53  $a_value = (float)$a_value;
54  }
55  $this->latitude = $a_value;
56  }
+ Here is the caller graph for this function:

◆ setLongitude()

ilADTLocation::setLongitude (   $a_value = null)

Definition at line 35 of file class.ilADTLocation.php.

Referenced by reset().

36  {
37  if($a_value !== null)
38  {
39  $a_value = (float)$a_value;
40  }
41  $this->longitude = $a_value;
42  }
+ Here is the caller graph for this function:

◆ setZoom()

ilADTLocation::setZoom (   $a_value)

Definition at line 68 of file class.ilADTLocation.php.

Referenced by reset().

69  {
70  $this->zoom = max(1, abs((int)$a_value));
71  }
+ Here is the caller graph for this function:

◆ translateErrorCode()

ilADTLocation::translateErrorCode (   $a_code)

Definition at line 136 of file class.ilADTLocation.php.

References $lng.

137  {
138  global $lng;
139 
140  // $lng->txt("msg_wrong_format");
141 
142  switch($a_code)
143  {
144  case self::ADT_VALIDATION_ERROR_LONGITUDE:
145  return $lng->txt("adt_error_longitude");
146 
147  case self::ADT_VALIDATION_ERROR_LATITUDE:
148  return $lng->txt("adt_error_latitude");
149 
150  default:
151  // all other / unknown "codes"
152  return parent::translateErrorCode($a_code);
153  }
154  }
global $lng
Definition: privfeed.php:17

Field Documentation

◆ $latitude

ilADTLocation::$latitude
protected

Definition at line 6 of file class.ilADTLocation.php.

Referenced by getLatitude().

◆ $longitude

ilADTLocation::$longitude
protected

Definition at line 5 of file class.ilADTLocation.php.

Referenced by getLongitude().

◆ $zoom

ilADTLocation::$zoom
protected

Definition at line 7 of file class.ilADTLocation.php.

Referenced by getZoom().

◆ ADT_VALIDATION_ERROR_LATITUDE

const ilADTLocation::ADT_VALIDATION_ERROR_LATITUDE = "loc2"

Definition at line 10 of file class.ilADTLocation.php.

◆ ADT_VALIDATION_ERROR_LONGITUDE

const ilADTLocation::ADT_VALIDATION_ERROR_LONGITUDE = "loc1"

Definition at line 9 of file class.ilADTLocation.php.


The documentation for this class was generated from the following file: