3 require_once
"Services/ADT/classes/Bridges/class.ilADTSearchBridgeSingle.php";
20 if ($value !== null) {
41 include_once(
"./Services/Maps/classes/class.ilMapUtil.php");
44 $adt->setLongitude(
$def[
"longitude"]);
53 $optional->setChecked(
true);
58 $loc->setLatitude(
$adt->getLatitude());
59 $loc->setZoom(
$adt->getZoom());
60 $optional->addSubItem($loc);
64 $rad->setSuffix(
$lng->txt(
"form_location_radius_km"));
65 $rad->setValue($this->radius);
66 $rad->setRequired(
true);
67 $optional->addSubItem($rad);
74 return (
bool) $a_post[
"tgl"];
83 $tgl->setChecked(
true);
86 $item->setLongitude(
$post[
"longitude"]);
87 $item->setLatitude(
$post[
"latitude"]);
88 $item->setZoom(
$post[
"zoom"]);
90 $this->radius = (int)
$post[
"rad"];
97 $this->force_valid =
true;
99 $this->
getADT()->setLongitude(null);
100 $this->
getADT()->setLatitude(null);
101 $this->
getADT()->setZoom(null);
102 $this->radius = null;
108 return (parent::isValid() && ((
int) $this->radius || (
bool) $this->force_valid));
124 $earth_radius = 6371;
127 $max_lat = $a_latitude + rad2deg($a_radius / $earth_radius);
128 $min_lat = $a_latitude - rad2deg($a_radius / $earth_radius);
129 $max_long = $a_longitude + rad2deg($a_radius / $earth_radius / cos(deg2rad($a_latitude)));
130 $min_long = $a_longitude - rad2deg($a_radius / $earth_radius / cos(deg2rad($a_latitude)));
133 "lat" => array(
"min" => $min_lat,
"max" => $max_lat)
134 ,
"long" => array(
"min" => $min_long,
"max" => $max_long)
145 $ilDB = $DIC[
'ilDB'];
151 $res[] = $a_element_id .
"_lat >= " .
$ilDB->quote($box[
"lat"][
"min"],
"float");
152 $res[] = $a_element_id .
"_lat <= " .
$ilDB->quote($box[
"lat"][
"max"],
"float");
153 $res[] = $a_element_id .
"_long >= " .
$ilDB->quote($box[
"long"][
"min"],
"float");
154 $res[] = $a_element_id .
"_long <= " .
$ilDB->quote($box[
"long"][
"max"],
"float");
156 return "(" . implode(
" AND ",
$res) .
")";
166 return serialize(array(
167 "lat" => $this->
getADT()->getLatitude()
168 ,
"long" => $this->
getADT()->getLongitude()
169 ,
"zoom" => $this->
getADT()->getZoom()
170 ,
"radius" => (
int) $this->radius
177 $a_value = unserialize($a_value);
178 if (is_array($a_value)) {
179 $this->
getADT()->setLatitude($a_value[
"lat"]);
180 $this->
getADT()->setLongitude($a_value[
"long"]);
181 $this->
getADT()->setZoom($a_value[
"zoom"]);
182 $this->radius = (int) $a_value[
"radius"];
extractPostValues(array $a_post=null)
Extract data from (post) values.
importFromPost(array $a_post=null)
setSerializedValue($a_value)
foreach($_POST as $key=> $value) $res
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)
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.