/** * Edit Map Settings */ public function editMapSettingsObject() { global $ilUser, $ilCtrl, $ilUser, $ilAccess; $this->setSubTabs("settings"); $this->tabs_gui->setTabActive('settings'); $this->tabs_gui->setSubTabActive('grp_map_settings'); include_once './Services/GoogleMaps/classes/class.ilGoogleMapUtil.php'; if (!ilGoogleMapUtil::isActivated() || !$ilAccess->checkAccess("write", "", $this->object->getRefId())) { return; } $latitude = $this->object->getLatitude(); $longitude = $this->object->getLongitude(); $zoom = $this->object->getLocationZoom(); // Get Default settings, when nothing is set if ($latitude == 0 && $longitude == 0 && $zoom == 0) { $def = ilGoogleMapUtil::getDefaultSettings(); $latitude = $def["latitude"]; $longitude = $def["longitude"]; $zoom = $def["zoom"]; } //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"), $this->lng->txt("personal_desktop")); //$this->tpl->setVariable("HEADER", $this->lng->txt("personal_desktop")); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($this->lng->txt("grp_map_settings")); // enable map $public = new ilCheckboxInputGUI($this->lng->txt("grp_enable_map"), "enable_map"); $public->setValue("1"); $public->setChecked($this->object->getEnableGroupMap()); $form->addItem($public); // map location $loc_prop = new ilLocationInputGUI($this->lng->txt("grp_map_location"), "location"); $loc_prop->setLatitude($latitude); $loc_prop->setLongitude($longitude); $loc_prop->setZoom($zoom); $form->addItem($loc_prop); $form->addCommandButton("saveMapSettings", $this->lng->txt("save")); $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); }
/** * 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 google map activation include_once "./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php"; if (!ilGoogleMapUtil::isActivated()) { return; } $this->lng->loadLanguageModule("gmaps"); // 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 = ilGoogleMapUtil::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); }