/** * Add location fields to form if activated * * @param ilPropertyFormGUI $a_form * @param ilObjUser $a_user */ function addLocationToForm(ilPropertyFormGUI $a_form, ilObjUser $a_user) { global $ilCtrl; // check map activation include_once "./Services/Maps/classes/class.ilMapUtil.php"; if (!ilMapUtil::isActivated()) { return; } // Don't really know if this is still necessary... $this->lng->loadLanguageModule("maps"); // Get user settings $latitude = $a_user->getLatitude(); $longitude = $a_user->getLongitude(); $zoom = $a_user->getLocationZoom(); // Get Default settings, when nothing is set if ($latitude == 0 && $longitude == 0 && $zoom == 0) { $def = ilMapUtil::getDefaultSettings(); $latitude = $def["latitude"]; $longitude = $def["longitude"]; $zoom = $def["zoom"]; } $street = $a_user->getStreet(); if (!$street) { $street = $this->lng->txt("street"); } $city = $a_user->getCity(); if (!$city) { $city = $this->lng->txt("city"); } $country = $a_user->getCountry(); if (!$country) { $country = $this->lng->txt("country"); } // location property $loc_prop = new ilLocationInputGUI($this->lng->txt("location"), "location"); $loc_prop->setLatitude($latitude); $loc_prop->setLongitude($longitude); $loc_prop->setZoom($zoom); $loc_prop->setAddress($street . "," . $city . "," . $country); $a_form->addItem($loc_prop); }