3 require_once
"Services/ADT/classes/Bridges/class.ilADTSearchBridgeSingle.php";
41 include_once(
"./Services/Maps/classes/class.ilMapUtil.php");
43 $adt->setLatitude($def[
"latitude"]);
44 $adt->setLongitude($def[
"longitude"]);
45 $adt->setZoom($def[
"zoom"]);
52 if(!$default && !
$adt->isNull())
54 $optional->setChecked(
true);
59 $loc->setLatitude(
$adt->getLatitude());
60 $loc->setZoom(
$adt->getZoom());
61 $optional->addSubItem($loc);
65 $rad->setSuffix($lng->txt(
"form_location_radius_km"));
66 $rad->setValue($this->radius);
67 $rad->setRequired(
true);
68 $optional->addSubItem($rad);
75 return (
bool)$a_post[
"tgl"];
85 $tgl->setChecked(
true);
88 $item->setLongitude($post[
"longitude"]);
89 $item->setLatitude($post[
"latitude"]);
90 $item->setZoom($post[
"zoom"]);
92 $this->radius = (int)$post[
"rad"];
94 $this->
getADT()->setLongitude($post[
"longitude"]);
95 $this->
getADT()->setLatitude($post[
"latitude"]);
96 $this->
getADT()->setZoom($post[
"zoom"]);
101 $this->force_valid =
true;
103 $this->
getADT()->setLongitude(null);
104 $this->
getADT()->setLatitude(null);
105 $this->
getADT()->setZoom(null);
106 $this->radius = null;
112 return (parent::isValid() && ((
int)$this->radius || (
bool)$this->force_valid));
128 $earth_radius = 6371;
131 $max_lat = $a_latitude + rad2deg($a_radius/$earth_radius);
132 $min_lat = $a_latitude - rad2deg($a_radius/$earth_radius);
133 $max_long = $a_longitude + rad2deg($a_radius/$earth_radius/cos(deg2rad($a_latitude)));
134 $min_long = $a_longitude - rad2deg($a_radius/$earth_radius/cos(deg2rad($a_latitude)));
137 "lat" =>
array(
"min"=>$min_lat,
"max"=>$max_lat)
138 ,
"long" =>
array(
"min"=>$min_long,
"max"=>$max_long)
154 $res[] = $a_element_id.
"_lat >= ".$ilDB->quote($box[
"lat"][
"min"],
"float");
155 $res[] = $a_element_id.
"_lat <= ".$ilDB->quote($box[
"lat"][
"max"],
"float");
156 $res[] = $a_element_id.
"_long >= ".$ilDB->quote($box[
"long"][
"min"],
"float");
157 $res[] = $a_element_id.
"_long <= ".$ilDB->quote($box[
"long"][
"max"],
"float");
159 return "(".implode(
" AND ",
$res).
")";
170 return serialize(
array(
171 "lat" => $this->
getADT()->getLatitude()
172 ,
"long" => $this->
getADT()->getLongitude()
173 ,
"zoom" => $this->
getADT()->getZoom()
174 ,
"radius" => (
int)$this->radius
181 $a_value = unserialize($a_value);
182 if(is_array($a_value))
184 $this->
getADT()->setLatitude($a_value[
"lat"]);
185 $this->
getADT()->setLongitude($a_value[
"long"]);
186 $this->
getADT()->setZoom($a_value[
"zoom"]);
187 $this->radius = (int)$a_value[
"radius"];
extractPostValues(array $a_post=null)
Extract data from (post) values.
importFromPost(array $a_post=null)
setSerializedValue($a_value)
readFilter()
Load value(s) from filter store (in session)
shouldBeImportedFromPost($a_post)
static getDefaultSettings()
Get default longitude, latitude and zoom.
isValidADTDefinition(ilADTDefinition $a_adt_def)
Create styles array
The data for the language used.
getSQLCondition($a_element_id)
getBoundingBox($a_latitude, $a_longitude, $a_radius)
Get bounding box for location circum search.
ADT definition base class.
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
addToElementId($a_add)
Add sub-element.