Esempio n. 1
0
 /**
  * Modify page content after xsl
  *
  * @param string $a_output
  * @return string
  */
 function modifyPageContentPostXsl($a_html, $a_mode)
 {
     $c_pos = 0;
     $start = strpos($a_html, "[[[[[Map;");
     if (is_int($start)) {
         $end = strpos($a_html, "]]]]]", $start);
     }
     $i = 1;
     while ($end > 0) {
         $param = substr($a_html, $start + 9, $end - $start - 9);
         $param = explode(";", $param);
         if (is_numeric($param[0]) && is_numeric($param[1]) && is_numeric($param[2])) {
             include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php";
             $map_gui = new ilGoogleMapGUI();
             $map_gui->setMapId("map_" . $i);
             $map_gui->setLatitude($param[0]);
             $map_gui->setLongitude($param[1]);
             $map_gui->setZoom($param[2]);
             $map_gui->setWidth($param[3] . "px");
             $map_gui->setHeight($param[4] . "px");
             $map_gui->setEnableTypeControl(true);
             $map_gui->setEnableNavigationControl(true);
             $map_gui->setEnableCentralMarker(true);
             $h2 = substr($a_html, 0, $start) . $map_gui->getHtml() . substr($a_html, $end + 5);
             $a_html = $h2;
             $i++;
         }
         $start = strpos($a_html, "[[[[[Map;", $start + 5);
         $end = 0;
         if (is_int($start)) {
             $end = strpos($a_html, "]]]]]", $start);
         }
     }
     return $a_html;
 }
 /**
  * Insert property html
  *
  */
 function insert(&$a_tpl)
 {
     global $lng;
     $lng->loadLanguageModule("gmaps");
     $tpl = new ilTemplate("tpl.prop_location.html", true, true, "Services/Form");
     $tpl->setVariable("POST_VAR", $this->getPostVar());
     $tpl->setVariable("TXT_ZOOM", $lng->txt("gmaps_zoom_level"));
     $tpl->setVariable("TXT_LATITUDE", $lng->txt("gmaps_latitude"));
     $tpl->setVariable("TXT_LONGITUDE", $lng->txt("gmaps_longitude"));
     $tpl->setVariable("TXT_ADDR", $lng->txt("address"));
     $tpl->setVariable("LOC_DESCRIPTION", $lng->txt("gmaps_std_location_desc"));
     $lat = is_numeric($this->getLatitude()) ? $this->getLatitude() : 0;
     $long = is_numeric($this->getLongitude()) ? $this->getLongitude() : 0;
     $tpl->setVariable("PROPERTY_VALUE_LAT", $lat);
     $tpl->setVariable("PROPERTY_VALUE_LONG", $long);
     for ($i = 0; $i <= 18; $i++) {
         $levels[$i] = $i;
     }
     $tpl->setVariable("ZOOM_SELECT", ilUtil::formSelect($this->getZoom(), $this->getPostVar() . "[zoom]", $levels, false, true, 0, "", array("id" => "map_" . $this->getPostVar() . "_zoom", "onchange" => "ilUpdateMap('" . "map_" . $this->getPostVar() . "');")));
     $tpl->setVariable("MAP_ID", "map_" . $this->getPostVar());
     $tpl->setVariable("ID", $this->getPostVar());
     $tpl->setVariable("TXT_LOOKUP", $lng->txt("gmaps_lookup_address"));
     $tpl->setVariable("TXT_ADDRESS", $this->getAddress());
     include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php";
     $map_gui = new ilGoogleMapGUI();
     $map_gui->setMapId("map_" . $this->getPostVar());
     $map_gui->setLatitude($lat);
     $map_gui->setLongitude($long);
     $map_gui->setZoom($this->getZoom());
     $map_gui->setEnableTypeControl(true);
     $map_gui->setEnableLargeMapControl(true);
     $map_gui->setEnableUpdateListener(true);
     $map_gui->setEnableCentralMarker(true);
     $tpl->setVariable("MAP", $map_gui->getHtml());
     $a_tpl->setCurrentBlock("prop_generic");
     $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
     $a_tpl->parseCurrentBlock();
 }