ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTLocation Class Reference
+ Inheritance diagram for ilADTLocation:
+ Collaboration diagram for ilADTLocation:

Public Member Functions

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

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.
- Protected Member Functions inherited from ilADT
 setDefinition (ilADTDefinition $a_def)
 Set definition.
 getDefinition ()
 Get definition.
 addValidationError ($a_error_code)
 Add validation error code.

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

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.

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

{
if($this->getDefinition()->isComparableTo($a_adt))
{
return ($this->getLongitude() == $a_adt->getLongitude() &&
$this->getLatitude() == $a_adt->getLatitude());
}
}

+ Here is the call graph for this function:

ilADTLocation::getCheckSum ( )

Get unique checksum.

Returns
string

Reimplemented from ilADT.

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

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

{
if(!$this->isNull())
{
return md5($this->getLongitude().
"#".$this->getLatitude().
"#".$this->getZoom());
}
}

+ Here is the call graph for this function:

ilADTLocation::getLatitude ( )

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

References $latitude.

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

{
}

+ Here is the caller graph for this function:

ilADTLocation::getLongitude ( )

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

References $longitude.

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

{
}

+ Here is the caller graph for this function:

ilADTLocation::getZoom ( )

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

References $zoom.

Referenced by getCheckSum().

{
return $this->zoom;
}

+ Here is the caller graph for this function:

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.

{
// return null?
}
ilADTLocation::isNull ( )

Is currently null.

Returns
bool

Reimplemented from ilADT.

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

References getLatitude(), and getLongitude().

Referenced by getCheckSum().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

{
// return null?
}
ilADTLocation::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented from ilADT.

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

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

{
// zoom?
$long = $this->getLongitude();
$lat = $this->getLatitude();
if($long !== null && $lat !== null)
{
// 0 - (+-)180
if($long < -180 || $long > 180)
{
$this->addValidationError(self::ADT_VALIDATION_ERROR_LONGITUDE);
$valid = false;
}
// 0 - (+-)90
if($lat < -90 || $lat > 90)
{
$this->addValidationError(self::ADT_VALIDATION_ERROR_LATITUDE);
$valid = false;
}
}
return $valid;
}

+ Here is the call graph for this function:

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.

{
return ($a_def instanceof ilADTLocationDefinition);
}
ilADTLocation::reset ( )

Init property defaults.

Reimplemented from ilADT.

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

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

{
$this->setZoom(9);
$this->setLatitude();
$this->setLongitude();
}

+ Here is the call graph for this function:

ilADTLocation::setLatitude (   $a_value = null)

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

Referenced by reset().

{
if($a_value !== null)
{
$a_value = (float)$a_value;
}
$this->latitude = $a_value;
}

+ Here is the caller graph for this function:

ilADTLocation::setLongitude (   $a_value = null)

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

Referenced by reset().

{
if($a_value !== null)
{
$a_value = (float)$a_value;
}
$this->longitude = $a_value;
}

+ Here is the caller graph for this function:

ilADTLocation::setZoom (   $a_value)

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

Referenced by reset().

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

+ Here is the caller graph for this function:

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.

References $lng.

{
global $lng;
// $lng->txt("msg_wrong_format");
switch($a_code)
{
case self::ADT_VALIDATION_ERROR_LONGITUDE:
return $lng->txt("adt_error_longitude");
case self::ADT_VALIDATION_ERROR_LATITUDE:
return $lng->txt("adt_error_latitude");
default:
// all other / unknown "codes"
return parent::translateErrorCode($a_code);
}
}

Field Documentation

ilADTLocation::$latitude
protected

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

Referenced by getLatitude().

ilADTLocation::$longitude
protected

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

Referenced by getLongitude().

ilADTLocation::$zoom
protected

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

Referenced by getZoom().

const ilADTLocation::ADT_VALIDATION_ERROR_LATITUDE = "loc2"

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

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: