3 require_once
"Services/ADT/classes/Bridges/class.ilADTSearchBridgeSingle.php";
42 include_once(
"./Services/Maps/classes/class.ilMapUtil.php");
44 $adt->setLatitude($def[
"latitude"]);
45 $adt->setLongitude($def[
"longitude"]);
46 $adt->setZoom($def[
"zoom"]);
53 if(!$default && !
$adt->isNull())
55 $optional->setChecked(
true);
60 $loc->setLatitude(
$adt->getLatitude());
61 $loc->setZoom(
$adt->getZoom());
62 $optional->addSubItem($loc);
66 $rad->setSuffix($lng->txt(
"form_location_radius_km"));
67 $rad->setValue($this->radius);
68 $rad->setRequired(
true);
69 $optional->addSubItem($rad);
76 return (
bool)$a_post[
"tgl"];
86 $item->setLongitude($post[
"longitude"]);
87 $item->setLatitude($post[
"latitude"]);
88 $item->setZoom($post[
"zoom"]);
90 $this->radius = (int)$post[
"rad"];
92 $this->
getADT()->setLongitude($post[
"longitude"]);
93 $this->
getADT()->setLatitude($post[
"latitude"]);
94 $this->
getADT()->setZoom($post[
"zoom"]);
99 $this->force_valid =
true;
101 $this->
getADT()->setLongitude(null);
102 $this->
getADT()->setLatitude(null);
103 $this->
getADT()->setZoom(null);
104 $this->radius = null;
110 return (parent::isValid() && ((
int)$this->radius || (
bool)$this->force_valid));
126 $earth_radius = 6371;
129 $max_lat = $a_latitude + rad2deg($a_radius/$earth_radius);
130 $min_lat = $a_latitude - rad2deg($a_radius/$earth_radius);
131 $max_long = $a_longitude + rad2deg($a_radius/$earth_radius/cos(deg2rad($a_latitude)));
132 $min_long = $a_longitude - rad2deg($a_radius/$earth_radius/cos(deg2rad($a_latitude)));
135 "lat" => array(
"min"=>$min_lat,
"max"=>$max_lat)
136 ,
"long" => array(
"min"=>$min_long,
"max"=>$max_long)
152 $res[] = $a_element_id.
"_lat >= ".$ilDB->quote($box[
"lat"][
"min"],
"float");
153 $res[] = $a_element_id.
"_lat <= ".$ilDB->quote($box[
"lat"][
"max"],
"float");
154 $res[] = $a_element_id.
"_long >= ".$ilDB->quote($box[
"long"][
"min"],
"float");
155 $res[] = $a_element_id.
"_long <= ".$ilDB->quote($box[
"long"][
"max"],
"float");
157 return "(".implode(
" AND ",
$res).
")";
168 return serialize(array(
169 "lat" => $this->
getADT()->getLatitude()
170 ,
"long" => $this->
getADT()->getLongitude()
171 ,
"radius" => (
int)$this->radius
178 $a_value = unserialize($a_value);
179 if(is_array($a_value))
181 $this->
getADT()->setLatitude($a_value[
"lat"]);
182 $this->
getADT()->setLongitude($a_value[
"long"]);
183 $this->radius = (int)$a_value[
"radius"];