ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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"
 

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

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

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

157 {
158 if(!$this->isNull())
159 {
160 return md5($this->getLongitude().
161 "#".$this->getLatitude().
162 "#".$this->getZoom());
163 }
164 }
isNull()
Is currently null.

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

+ Here is the call graph for this function:

◆ getLatitude()

ilADTLocation::getLatitude ( )

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

59 {
60 return $this->latitude;
61 }

References $latitude.

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

+ Here is the caller graph for this function:

◆ getLongitude()

ilADTLocation::getLongitude ( )

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

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

References $longitude.

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

+ Here is the caller graph for this function:

◆ getZoom()

ilADTLocation::getZoom ( )

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

64 {
65 return $this->zoom;
66 }

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

86 {
87 // return null?
88 }

◆ isNull()

ilADTLocation::isNull ( )

Is currently null.

Returns
bool

Reimplemented from ilADT.

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

99 {
100 return ($this->getLongitude() === null && $this->getLatitude() === null);
101 }

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

91 {
92 // return null?
93 }

◆ isValid()

ilADTLocation::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented from ilADT.

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

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

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

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 {
39 $a_value = (float)$a_value;
40 }
41 $this->longitude = $a_value;
42 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setZoom()

ilADTLocation::setZoom (   $a_value)

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

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

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

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

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: