3 require_once
"Services/ADT/classes/Bridges/class.ilADTSearchBridgeSingle.php";
20 if ($value !== null) {
39 include_once(
"./Services/Maps/classes/class.ilMapUtil.php");
42 $adt->setLongitude(
$def[
"longitude"]);
50 if (!$default && !
$adt->isNull()) {
51 $optional->setChecked(
true);
56 $loc->setLatitude(
$adt->getLatitude());
57 $loc->setZoom(
$adt->getZoom());
58 $optional->addSubItem($loc);
62 $rad->setSuffix($lng->txt(
"form_location_radius_km"));
63 $rad->setValue($this->radius);
64 $rad->setRequired(
true);
65 $optional->addSubItem($rad);
72 return (
bool) $a_post[
"tgl"];
81 $tgl->setChecked(
true);
84 $item->setLongitude(
$post[
"longitude"]);
85 $item->setLatitude(
$post[
"latitude"]);
86 $item->setZoom(
$post[
"zoom"]);
88 $this->radius = (int)
$post[
"rad"];
95 $this->force_valid =
true;
97 $this->
getADT()->setLongitude(null);
98 $this->
getADT()->setLatitude(null);
99 $this->
getADT()->setZoom(null);
100 $this->radius = null;
106 return (parent::isValid() && ((
int) $this->radius || (
bool) $this->force_valid));
122 $earth_radius = 6371;
125 $max_lat = $a_latitude + rad2deg($a_radius/$earth_radius);
126 $min_lat = $a_latitude - rad2deg($a_radius/$earth_radius);
127 $max_long = $a_longitude + rad2deg($a_radius/$earth_radius/cos(deg2rad($a_latitude)));
128 $min_long = $a_longitude - rad2deg($a_radius/$earth_radius/cos(deg2rad($a_latitude)));
131 "lat" =>
array(
"min"=>$min_lat,
"max"=>$max_lat)
132 ,
"long" =>
array(
"min"=>$min_long,
"max"=>$max_long)
147 $res[] = $a_element_id .
"_lat >= " . $ilDB->quote($box[
"lat"][
"min"],
"float");
148 $res[] = $a_element_id .
"_lat <= " . $ilDB->quote($box[
"lat"][
"max"],
"float");
149 $res[] = $a_element_id .
"_long >= " . $ilDB->quote($box[
"long"][
"min"],
"float");
150 $res[] = $a_element_id .
"_long <= " . $ilDB->quote($box[
"long"][
"max"],
"float");
152 return "(" . implode(
" AND ",
$res) .
")";
162 return serialize(
array(
163 "lat" => $this->
getADT()->getLatitude()
164 ,
"long" => $this->
getADT()->getLongitude()
165 ,
"zoom" => $this->
getADT()->getZoom()
166 ,
"radius" => (
int) $this->radius
173 $a_value = unserialize($a_value);
174 if (is_array($a_value)) {
175 $this->
getADT()->setLatitude($a_value[
"lat"]);
176 $this->
getADT()->setLongitude($a_value[
"long"]);
177 $this->
getADT()->setZoom($a_value[
"zoom"]);
178 $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)
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.