ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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"
 
const ADT_VALIDATION_ERROR_INVALID_NODE = 'adt7'
 

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 74 of file class.ilADTLocation.php.

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

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

◆ getCheckSum()

ilADTLocation::getCheckSum ( )

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

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

152  {
153  if (!$this->isNull()) {
154  return md5($this->getLongitude() .
155  "#" . $this->getLatitude() .
156  "#" . $this->getZoom());
157  }
158  }
+ Here is the call graph for this function:

◆ getLatitude()

ilADTLocation::getLatitude ( )

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

References $latitude.

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

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

◆ getLongitude()

ilADTLocation::getLongitude ( )

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

References $longitude.

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

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

◆ getZoom()

ilADTLocation::getZoom ( )

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

References $zoom.

Referenced by getCheckSum().

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

◆ isLarger()

ilADTLocation::isLarger ( ilADT  $a_adt)

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

83  {
84  // return null?
85  }

◆ isNull()

ilADTLocation::isNull ( )

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

References getLatitude(), and getLongitude().

Referenced by getCheckSum().

96  {
97  return ($this->getLongitude() === null && $this->getLatitude() === null);
98  }
+ 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 87 of file class.ilADTLocation.php.

88  {
89  // return null?
90  }

◆ isValid()

ilADTLocation::isValid ( )

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

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

104  {
105  $valid = parent::isValid();
106 
107  // zoom?
108 
109  $long = $this->getLongitude();
110  $lat = $this->getLatitude();
111  if ($long !== null && $lat !== null) {
112  // 0 - (+-)180
113  if ($long < -180 || $long > 180) {
114  $this->addValidationError(self::ADT_VALIDATION_ERROR_LONGITUDE);
115  $valid = false;
116  }
117  // 0 - (+-)90
118  if ($lat < -90 || $lat > 90) {
119  $this->addValidationError(self::ADT_VALIDATION_ERROR_LATITUDE);
120  $valid = false;
121  }
122  }
123 
124  return $valid;
125  }
$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 48 of file class.ilADTLocation.php.

Referenced by reset().

49  {
50  if ($a_value !== null) {
51  $a_value = (float) $a_value;
52  }
53  $this->latitude = $a_value;
54  }
+ 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  $a_value = (float) $a_value;
39  }
40  $this->longitude = $a_value;
41  }
+ Here is the caller graph for this function:

◆ setZoom()

ilADTLocation::setZoom (   $a_value)

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

Referenced by reset().

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

◆ translateErrorCode()

ilADTLocation::translateErrorCode (   $a_code)

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

References $DIC, and $lng.

131  {
132  global $DIC;
133 
134  $lng = $DIC['lng'];
135 
136  // $lng->txt("msg_wrong_format");
137 
138  switch ($a_code) {
139  case self::ADT_VALIDATION_ERROR_LONGITUDE:
140  return $lng->txt("adt_error_longitude");
141 
142  case self::ADT_VALIDATION_ERROR_LATITUDE:
143  return $lng->txt("adt_error_latitude");
144 
145  default:
146  // all other / unknown "codes"
147  return parent::translateErrorCode($a_code);
148  }
149  }
global $DIC
Definition: saml.php:7
$lng

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: