ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilADTLocation Class Reference
+ Inheritance diagram for ilADTLocation:
+ Collaboration diagram for ilADTLocation:

Public Member Functions

 reset ()
 Init property defaults. More...
 
 setLongitude ($a_value=null)
 
 getLongitude ()
 
 setLatitude ($a_value=null)
 
 getLatitude ()
 
 getZoom ()
 
 setZoom ($a_value)
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 Is currently valid. More...
 
 translateErrorCode ($a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
- 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)
 Check if definition is valid for ADT. More...
 
- 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)

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

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

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

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

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTLocation::getCheckSum ( )

Get unique checksum.

Returns
string

Reimplemented from ilADT.

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

150 {
151 if (!$this->isNull()) {
152 return md5($this->getLongitude() .
153 "#" . $this->getLatitude() .
154 "#" . $this->getZoom());
155 }
156 }
isNull()
Is currently null.

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

+ Here is the call graph for this function:

◆ getLatitude()

ilADTLocation::getLatitude ( )

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

57 {
58 return $this->latitude;
59 }

References $latitude.

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

+ Here is the caller graph for this function:

◆ getLongitude()

ilADTLocation::getLongitude ( )

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

44 {
45 return $this->longitude;
46 }

References $longitude.

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

+ Here is the caller graph for this function:

◆ getZoom()

ilADTLocation::getZoom ( )

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

62 {
63 return $this->zoom;
64 }

References $zoom.

Referenced by getCheckSum().

+ Here is the caller graph for this function:

◆ isLarger()

ilADTLocation::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

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

83 {
84 // return null?
85 }

◆ isNull()

ilADTLocation::isNull ( )

Is currently null.

Returns
bool

Reimplemented from ilADT.

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

96 {
97 return ($this->getLongitude() === null && $this->getLatitude() === null);
98 }

References getLatitude(), and getLongitude().

Referenced by getCheckSum().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTLocation::isSmaller ( ilADT  $a_adt)

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

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

88 {
89 // return null?
90 }

◆ isValid()

ilADTLocation::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented from ilADT.

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

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 }
addValidationError($a_error_code)
Add validation error code.
$valid

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

+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTLocation::isValidDefinition ( ilADTDefinition  $a_def)
protected

Check if definition is valid for ADT.

Returns
bool;

Reimplemented from ilADT.

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

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

◆ reset()

ilADTLocation::reset ( )

Init property defaults.

Reimplemented from ilADT.

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

24 {
25 parent::reset();
26
27 $this->setZoom(9);
28 $this->setLatitude();
29 $this->setLongitude();
30 }
setLatitude($a_value=null)
setLongitude($a_value=null)

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

+ Here is the call graph for this function:

◆ setLatitude()

ilADTLocation::setLatitude (   $a_value = null)

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

49 {
50 if ($a_value !== null) {
51 $a_value = (float) $a_value;
52 }
53 $this->latitude = $a_value;
54 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setLongitude()

ilADTLocation::setLongitude (   $a_value = null)

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

36 {
37 if ($a_value !== null) {
38 $a_value = (float) $a_value;
39 }
40 $this->longitude = $a_value;
41 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setZoom()

ilADTLocation::setZoom (   $a_value)

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

67 {
68 $this->zoom = max(1, abs((int) $a_value));
69 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ translateErrorCode()

ilADTLocation::translateErrorCode (   $a_code)

Translate error-code to human-readable message.

Exceptions
Exception
Parameters
int$a_code
Returns
string

Reimplemented from ilADT.

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

131 {
132 global $lng;
133
134 // $lng->txt("msg_wrong_format");
135
136 switch ($a_code) {
138 return $lng->txt("adt_error_longitude");
139
141 return $lng->txt("adt_error_latitude");
142
143 default:
144 // all other / unknown "codes"
145 return parent::translateErrorCode($a_code);
146 }
147 }
const ADT_VALIDATION_ERROR_LONGITUDE
const ADT_VALIDATION_ERROR_LATITUDE
global $lng
Definition: privfeed.php:17

References $lng, ADT_VALIDATION_ERROR_LATITUDE, and ADT_VALIDATION_ERROR_LONGITUDE.

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.

Referenced by translateErrorCode().

◆ ADT_VALIDATION_ERROR_LONGITUDE

const ilADTLocation::ADT_VALIDATION_ERROR_LONGITUDE = "loc1"

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

Referenced by translateErrorCode().


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