public function addToForm() { global $lng; $adt = $this->getADT(); $default = false; if ($adt->isNull()) { // see ilPersonalProfileGUI::addLocationToForm() // use installation default include_once "./Services/Maps/classes/class.ilMapUtil.php"; $def = ilMapUtil::getDefaultSettings(); $adt->setLatitude($def["latitude"]); $adt->setLongitude($def["longitude"]); $adt->setZoom($def["zoom"]); $default = true; } // :TODO: title? $title = $this->isRequired() ? $this->getTitle() : $lng->txt("location"); $loc = new ilLocationInputGUI($title, $this->getElementId()); $loc->setLongitude($adt->getLongitude()); $loc->setLatitude($adt->getLatitude()); $loc->setZoom($adt->getZoom()); $this->addBasicFieldProperties($loc, $adt->getCopyOfDefinition()); if (!$this->isRequired()) { $optional = new ilCheckboxInputGUI($this->getTitle(), $this->getElementId() . "_tgl"); $optional->addSubItem($loc); $this->addToParentElement($optional); if (!$default && !$adt->isNull()) { $optional->setChecked(true); } } else { $this->addToParentElement($loc); } }
public function addToForm() { global $lng; $adt = $this->getADT(); $default = false; if ($adt->isNull()) { // see ilPersonalProfileGUI::addLocationToForm() // use installation default include_once "./Services/Maps/classes/class.ilMapUtil.php"; $def = ilMapUtil::getDefaultSettings(); $adt->setLatitude($def["latitude"]); $adt->setLongitude($def["longitude"]); $adt->setZoom($def["zoom"]); $default = true; } $optional = new ilCheckboxInputGUI($this->getTitle(), $this->addToElementId("tgl")); if (!$default && !$adt->isNull()) { $optional->setChecked(true); } $loc = new ilLocationInputGUI($lng->txt("location"), $this->getElementId()); $loc->setLongitude($adt->getLongitude()); $loc->setLatitude($adt->getLatitude()); $loc->setZoom($adt->getZoom()); $optional->addSubItem($loc); $rad = new ilNumberInputGUI($lng->txt("form_location_radius"), $this->addToElementId("rad")); $rad->setSize(4); $rad->setSuffix($lng->txt("form_location_radius_km")); $rad->setValue($this->radius); $rad->setRequired(true); $optional->addSubItem($rad); $this->addToParentElement($optional); }
/** * Configure google maps settings * * @access public */ function editGoogleMapsObject() { global $ilAccess, $lng, $ilCtrl, $tpl; $gm_set = new ilSetting("google_maps"); if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } $this->__initSubTabs("editGoogleMaps"); $std_latitude = $gm_set->get("std_latitude"); $std_longitude = $gm_set->get("std_longitude"); $std_zoom = $gm_set->get("std_zoom"); $api_url = "http://www.google.com/apis/maps/signup.html"; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($lng->txt("gmaps_settings")); // Enable Google Maps $enable = new ilCheckboxInputGUI($lng->txt("gmaps_enable_gmaps"), "enable"); $enable->setChecked($gm_set->get("enable")); $enable->setInfo($lng->txt("gmaps_enable_gmaps_info")); $form->addItem($enable); // location property $loc_prop = new ilLocationInputGUI($lng->txt("gmaps_std_location"), "std_location"); $loc_prop->setLatitude($std_latitude); $loc_prop->setLongitude($std_longitude); $loc_prop->setZoom($std_zoom); $form->addItem($loc_prop); $form->addCommandButton("saveGoogleMaps", $lng->txt("save")); $form->addCommandButton("view", $lng->txt("cancel")); $tpl->setVariable("ADM_CONTENT", $form->getHTML()); }
/** * Configure maps settings * * @access public */ function editMapsObject() { require_once "Services/Maps/classes/class.ilMapUtil.php"; global $ilAccess, $lng, $ilCtrl, $tpl; if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } $this->__initSubTabs("editMaps"); $std_latitude = ilMapUtil::getStdLatitude(); $std_longitude = ilMapUtil::getStdLongitude(); $std_zoom = ilMapUtil::getStdZoom(); $type = ilMapUtil::getType(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($lng->txt("maps_settings")); // Enable Maps $enable = new ilCheckboxInputGUI($lng->txt("maps_enable_maps"), "enable"); $enable->setChecked(ilMapUtil::isActivated()); $enable->setInfo($lng->txt("maps_enable_maps_info")); $form->addItem($enable); // Select type $types = new ilSelectInputGUI($lng->txt("maps_map_type"), "type"); $types->setOptions(ilMapUtil::getAvailableMapTypes()); $types->setValue($type); $form->addItem($types); // location property $loc_prop = new ilLocationInputGUI($lng->txt("maps_std_location"), "std_location"); $loc_prop->setLatitude($std_latitude); $loc_prop->setLongitude($std_longitude); $loc_prop->setZoom($std_zoom); $form->addItem($loc_prop); $form->addCommandButton("saveMaps", $lng->txt("save")); $form->addCommandButton("view", $lng->txt("cancel")); $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 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); }
/** * Edit Map Settings */ function editMapSettingsObject() { global $ilUser, $ilCtrl, $ilUser, $ilAccess; $this->setSubTabs("properties"); $this->tabs_gui->setTabActive('settings'); if (!ilMapUtil::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 = ilMapUtil::getDefaultSettings(); $latitude = $def["latitude"]; $longitude = $def["longitude"]; $zoom = $def["zoom"]; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($this->lng->txt("crs_map_settings")); // enable map $public = new ilCheckboxInputGUI($this->lng->txt("crs_enable_map"), "enable_map"); $public->setValue("1"); $public->setChecked($this->object->getEnableCourseMap()); $form->addItem($public); // map location $loc_prop = new ilLocationInputGUI($this->lng->txt("crs_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()); //$this->tpl->show(); }