/**
  * Members map
  */
 public function membersMapObject()
 {
     global $tpl;
     $this->setSubTabs('members');
     $this->tabs_gui->setTabActive('members');
     include_once "./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php";
     if (!ilGoogleMapUtil::isActivated() || !$this->object->getEnableGroupMap()) {
         return;
     }
     include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php";
     $map = new ilGoogleMapGUI();
     $map->setMapId("group_map");
     $map->setWidth("700px");
     $map->setHeight("500px");
     $map->setLatitude($this->object->getLatitude());
     $map->setLongitude($this->object->getLongitude());
     $map->setZoom($this->object->getLocationZoom());
     $map->setEnableTypeControl(true);
     $map->setEnableNavigationControl(true);
     $map->setEnableCentralMarker(true);
     $member_ids = $this->object->getGroupMemberIds();
     $admin_ids = $this->object->getGroupAdminIds();
     // fetch all users data in one shot to improve performance
     $members = $this->object->getGroupMemberData($member_ids);
     foreach ($member_ids as $user_id) {
         $map->addUserMarker($user_id);
     }
     $tpl->setContent($map->getHTML());
     $tpl->setLeftContent($map->getUserListHTML());
 }
Ejemplo n.º 2
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;
 }
 /**
  * Members map
  */
 function membersMapObject()
 {
     global $tpl;
     $this->tabs_gui->setTabActive("members");
     $this->setSubTabs('members');
     $this->tabs_gui->setSubTabActive("crs_members_map");
     include_once "./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php";
     if (!ilGoogleMapUtil::isActivated() || !$this->object->getEnableCourseMap()) {
         return;
     }
     include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php";
     $map = new ilGoogleMapGUI();
     $map->setMapId("course_map");
     $map->setWidth("700px");
     $map->setHeight("500px");
     $map->setLatitude($this->object->getLatitude());
     $map->setLongitude($this->object->getLongitude());
     $map->setZoom($this->object->getLocationZoom());
     $map->setEnableTypeControl(true);
     $map->setEnableNavigationControl(true);
     $map->setEnableCentralMarker(true);
     include_once './Modules/Course/classes/class.ilCourseParticipants.php';
     $members = ilCourseParticipants::_getInstanceByObjId($this->object->getId())->getParticipants();
     if (count($members)) {
         foreach ($members as $user_id) {
             $map->addUserMarker($user_id);
         }
     }
     $tpl->setContent($map->getHTML());
     $tpl->setLeftContent($map->getUserListHTML());
 }
 /**
  * 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();
 }