Public Member Functions | Protected Attributes

ilGoogleMapGUI Class Reference

User interface class for google maps. More...

Public Member Functions

 ilGoogleMapGUI ()
 setMapId ($a_mapid)
 Set Map ID.
 getMapId ()
 Get Map ID.
 setWidth ($a_width)
 Set Width.
 getWidth ()
 Get Width.
 setHeight ($a_height)
 Set Height.
 getHeight ()
 Get Height.
 setLatitude ($a_latitude)
 Set Latitude.
 getLatitude ()
 Get Latitude.
 setLongitude ($a_longitude)
 Set Longitude.
 getLongitude ()
 Get Longitude.
 setZoom ($a_zoom)
 Set Zoom.
 getZoom ()
 Get Zoom.
 setEnableTypeControl ($a_enabletypecontrol)
 Set Use Map Type Control.
 getEnableTypeControl ()
 Get Use Map Type Control.
 setEnableNavigationControl ($a_enablenavigationcontrol)
 Set Use Navigation Control.
 getEnableNavigationControl ()
 Get Use Navigation Control.
 setEnableUpdateListener ($a_enableupdatelistener)
 Set Activate Update Listener.
 getEnableUpdateListener ()
 Get Activate Update Listener.
 setEnableLargeMapControl ($a_largemapcontrol)
 Set Large Map Control.
 getEnableLargeMapControl ()
 Get Large Map Control.
 setEnableCentralMarker ($a_centralmarker)
 Enable Central Marker.
 getEnableCentralMarker ()
 Get Enable Central Marker.
 addUserMarker ($a_user_id)
 Add user marker.
 getHtml ()
 Get HTML.
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map).

Protected Attributes

 $enabletypecontrol = false
 $enableupdatelistener = false
 $enablenavigationcontrol = false
 $enablelargemapcontrol = false
 $width = "500px"
 $height = "300px"
 $user_marker = array()

Detailed Description

User interface class for google maps.

Author:
Alex Killing <alex.killing@gmx.de>
Version:
$Id$

Definition at line 32 of file class.ilGoogleMapGUI.php.


Member Function Documentation

ilGoogleMapGUI::addUserMarker ( a_user_id  ) 

Add user marker.

Parameters:
int $a_user_id User ID

Definition at line 284 of file class.ilGoogleMapGUI.php.

        {
                return $this->user_marker[] = $a_user_id;
        }

ilGoogleMapGUI::getEnableCentralMarker (  ) 

Get Enable Central Marker.

Returns:
boolean Central Marker

Definition at line 274 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->centralmarker;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getEnableLargeMapControl (  ) 

Get Large Map Control.

Returns:
boolean Large Map Control

Definition at line 254 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->largemapcontrol;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getEnableNavigationControl (  ) 

Get Use Navigation Control.

Returns:
boolean Use Navigation Control

Definition at line 214 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->enablenavigationcontrol;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getEnableTypeControl (  ) 

Get Use Map Type Control.

Returns:
boolean Use Map Type Control

Definition at line 194 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->enabletypecontrol;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getEnableUpdateListener (  ) 

Get Activate Update Listener.

Returns:
boolean Activate Update Listener

Definition at line 234 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->enableupdatelistener;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getHeight (  ) 

Get Height.

Returns:
string Height

Definition at line 114 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->height;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getHtml (  ) 

Get HTML.

Definition at line 292 of file class.ilGoogleMapGUI.php.

References $tpl, $user, ilObject::_exists(), getEnableCentralMarker(), getEnableLargeMapControl(), getEnableNavigationControl(), getEnableTypeControl(), getEnableUpdateListener(), getHeight(), getLatitude(), getLongitude(), getMapId(), getWidth(), and getZoom().

        {
                global $tpl;
                
                $this->tpl = new ilTemplate("tpl.google_map.html",
                        true, true, "Services/GoogleMaps");
                        
                $gm_set = new ilSetting("google_maps");
                if ($gm_set->get("api_key") != "")
                {
                        $tpl->addJavaScript("http://maps.google.com/maps?file=api&amp;v=2&amp;key=".
                                $gm_set->get("api_key"));
                        $tpl->addJavaScript("Services/JavaScript/js/Basic.js");
                        $tpl->addJavaScript("Services/GoogleMaps/js/ServiceGoogleMaps.js");
                        
                        // add user markers
                        $cnt = 0;
                        foreach($this->user_marker as $user_id)
                        {
                                if (ilObject::_exists($user_id))
                                {
                                        $user = new ilObjUser($user_id);
                                        if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
                                                $user->getPref("public_location") == "y")
                                        {
                                                $this->tpl->setCurrentBlock("user_marker");
                                                $this->tpl->setVariable("UMAP_ID",
                                                        $this->getMapId());
                                                $this->tpl->setVariable("CNT", $cnt);

                                                $this->tpl->setVariable("ULAT", $user->getLatitude());
                                                $this->tpl->setVariable("ULONG", $user->getLongitude());
                                                $info = $user->getFirstName()." ".$user->getLastName();
                                                $delim = "<br \/>";
                                                if ($user->getPref("public_institution") == "y")
                                                {
                                                        $info.= $delim.$user->getInstitution();
                                                        $delim = ", ";
                                                }
                                                if ($user->getPref("public_department") == "y")
                                                {
                                                        $info.= $delim.$user->getDepartment();
                                                }
                                                $delim = "<br \/>";
                                                if ($user->getPref("public_street") == "y")
                                                {
                                                        $info.= $delim.$user->getStreet();
                                                }
                                                if ($user->getPref("public_zip") == "y")
                                                {
                                                        $info.= $delim.$user->getZipcode();
                                                        $delim = " ";
                                                }
                                                if ($user->getPref("public_city") == "y")
                                                {
                                                        $info.= $delim.$user->getCity();
                                                }
                                                $delim = "<br \/>";
                                                if ($user->getPref("public_country") == "y")
                                                {
                                                        $info.= $delim.$user->getCountry();
                                                }
                                                $this->tpl->setVariable("USER_INFO",
                                                        $info);
                                                $this->tpl->setVariable("IMG_USER",
                                                        $user->getPersonalPicturePath("xsmall"));
                                                $this->tpl->parseCurrentBlock();
                                                $cnt++;
                                        }
                                }
                        }

                        $this->tpl->setVariable("MAP_ID", $this->getMapId());
                        $lat = is_numeric($this->getLatitude())
                                ? $this->getLatitude()
                                : 0;
                        $long = is_numeric($this->getLongitude())
                                ? $this->getLongitude()
                                : 0;
                        $this->tpl->setVariable("WIDTH", $this->getWidth());
                        $this->tpl->setVariable("HEIGHT", $this->getHeight());
                        $this->tpl->setVariable("LAT", $this->getLatitude());
                        $this->tpl->setVariable("LONG", $this->getLongitude());
                        $this->tpl->setVariable("ZOOM", (int) $this->getZoom());
                        $type_control = $this->getEnableTypeControl()
                                ? "true"
                                : "false";
                        $this->tpl->setVariable("TYPE_CONTROL", $type_control);
                        $nav_control = $this->getEnableNavigationControl()
                                ? "true"
                                : "false";
                        $this->tpl->setVariable("NAV_CONTROL", $nav_control);
                        $update_listener = $this->getEnableUpdateListener()
                                ? "true"
                                : "false";
                        $this->tpl->setVariable("UPDATE_LISTENER", $update_listener);
                        $large_map_control = $this->getEnableLargeMapControl()
                                ? "true"
                                : "false";
                        $this->tpl->setVariable("LARGE_CONTROL", $large_map_control);
                        $central_marker = $this->getEnableCentralMarker()
                                ? "true"
                                : "false";
                        $this->tpl->setVariable("CENTRAL_MARKER", $central_marker);

                        return $this->tpl->get();
                }
                else
                {
                        return "";
                }
        }

Here is the call graph for this function:

ilGoogleMapGUI::getLatitude (  ) 

Get Latitude.

Returns:
string Latitude

Definition at line 134 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->latitude;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getLongitude (  ) 

Get Longitude.

Returns:
string Longitude

Definition at line 154 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->longitude;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getMapId (  ) 

Get Map ID.

Returns:
string Map ID

Definition at line 74 of file class.ilGoogleMapGUI.php.

Referenced by getHtml(), and getUserListHtml().

        {
                return $this->mapid;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getUserListHtml (  ) 

Get User List HTML (to be displayed besides the map).

Definition at line 408 of file class.ilGoogleMapGUI.php.

References $tpl, $user, ilObject::_exists(), and getMapId().

        {
                global $tpl;
                
                $list_tpl = new ilTemplate("tpl.google_map_user_list.html",
                        true, true, "Services/GoogleMaps");
                        
                $cnt = 0;
                foreach($this->user_marker as $user_id)
                {
                        if (ilObject::_exists($user_id))
                        {
                                $user = new ilObjUser($user_id);
                                $this->css_row = ($this->css_row != "tblrow1_mo")
                                        ? "tblrow1_mo"
                                        : "tblrow2_mo";
                                if ($user->getLatitude() != 0 && $user->getLongitude() != 0
                                        && $user->getPref("public_location") == "y")
                                {
                                        $list_tpl->setCurrentBlock("item");
                                        $list_tpl->setVariable("MARKER_CNT", $cnt);
                                        $list_tpl->setVariable("MAP_ID", $this->getMapId());
                                        $cnt++;
                                }
                                else
                                {
                                        $list_tpl->setCurrentBlock("item_no_link");
                                }
                                $list_tpl->setVariable("CSS_ROW", $this->css_row);
                                $list_tpl->setVariable("TXT_USER", $user->getLogin());
                                $list_tpl->setVariable("IMG_USER",
                                        $user->getPersonalPicturePath("xxsmall"));
                                $list_tpl->parseCurrentBlock();
                                $list_tpl->touchBlock("row");
                        }
                }
                
                return $list_tpl->get();
        }

Here is the call graph for this function:

ilGoogleMapGUI::getWidth (  ) 

Get Width.

Returns:
string Width

Definition at line 94 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->width;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::getZoom (  ) 

Get Zoom.

Returns:
int Zoom

Definition at line 174 of file class.ilGoogleMapGUI.php.

Referenced by getHtml().

        {
                return $this->zoom;
        }

Here is the caller graph for this function:

ilGoogleMapGUI::ilGoogleMapGUI (  ) 

Definition at line 43 of file class.ilGoogleMapGUI.php.

References $lng, and $tpl.

        {
                global $lng, $tpl;
                
                $gm_set = new ilSetting("google_maps");
                $lng->loadLanguageModule("gmaps");
                
                if ($gm_set->get("api_key") != "")
                {
                        $tpl->addJavaScript("http://maps.google.com/maps?file=api&amp;v=2&amp;key=".
                                $gm_set->get("api_key"), false);
                        $tpl->addJavaScript("Services/JavaScript/js/Basic.js");
                        $tpl->addJavaScript("Services/GoogleMaps/js/ServiceGoogleMaps.js");
                }
        }

ilGoogleMapGUI::setEnableCentralMarker ( a_centralmarker  ) 

Enable Central Marker.

Parameters:
boolean $a_centralmarker Central Marker

Definition at line 264 of file class.ilGoogleMapGUI.php.

        {
                $this->centralmarker = $a_centralmarker;
        }

ilGoogleMapGUI::setEnableLargeMapControl ( a_largemapcontrol  ) 

Set Large Map Control.

Parameters:
boolean $a_largemapcontrol Large Map Control

Definition at line 244 of file class.ilGoogleMapGUI.php.

        {
                $this->largemapcontrol = $a_largemapcontrol;
        }

ilGoogleMapGUI::setEnableNavigationControl ( a_enablenavigationcontrol  ) 

Set Use Navigation Control.

Parameters:
boolean $a_enablenavigationcontrol Use Navigation Control

Definition at line 204 of file class.ilGoogleMapGUI.php.

        {
                $this->enablenavigationcontrol = $a_enablenavigationcontrol;
        }

ilGoogleMapGUI::setEnableTypeControl ( a_enabletypecontrol  ) 

Set Use Map Type Control.

Parameters:
boolean $a_enabletypecontrol Use Map Type Control

Definition at line 184 of file class.ilGoogleMapGUI.php.

        {
                $this->enabletypecontrol = $a_enabletypecontrol;
        }

ilGoogleMapGUI::setEnableUpdateListener ( a_enableupdatelistener  ) 

Set Activate Update Listener.

Parameters:
boolean $a_enableupdatelistener Activate Update Listener

Definition at line 224 of file class.ilGoogleMapGUI.php.

        {
                $this->enableupdatelistener = $a_enableupdatelistener;
        }

ilGoogleMapGUI::setHeight ( a_height  ) 

Set Height.

Parameters:
string $a_height Height

Definition at line 104 of file class.ilGoogleMapGUI.php.

        {
                $this->height = $a_height;
        }

ilGoogleMapGUI::setLatitude ( a_latitude  ) 

Set Latitude.

Parameters:
string $a_latitude Latitude

Definition at line 124 of file class.ilGoogleMapGUI.php.

        {
                $this->latitude = $a_latitude;
        }

ilGoogleMapGUI::setLongitude ( a_longitude  ) 

Set Longitude.

Parameters:
string $a_longitude Longitude

Definition at line 144 of file class.ilGoogleMapGUI.php.

        {
                $this->longitude = $a_longitude;
        }

ilGoogleMapGUI::setMapId ( a_mapid  ) 

Set Map ID.

Parameters:
string $a_mapid Map ID

Definition at line 64 of file class.ilGoogleMapGUI.php.

        {
                $this->mapid = $a_mapid;
        }

ilGoogleMapGUI::setWidth ( a_width  ) 

Set Width.

Parameters:
string $a_width Width

Definition at line 84 of file class.ilGoogleMapGUI.php.

        {
                $this->width = $a_width;
        }

ilGoogleMapGUI::setZoom ( a_zoom  ) 

Set Zoom.

Parameters:
int $a_zoom Zoom

Definition at line 164 of file class.ilGoogleMapGUI.php.

        {
                $this->zoom = $a_zoom;
        }


Field Documentation

ilGoogleMapGUI::$enablelargemapcontrol = false [protected]

Definition at line 38 of file class.ilGoogleMapGUI.php.

ilGoogleMapGUI::$enablenavigationcontrol = false [protected]

Definition at line 37 of file class.ilGoogleMapGUI.php.

ilGoogleMapGUI::$enabletypecontrol = false [protected]

Definition at line 35 of file class.ilGoogleMapGUI.php.

ilGoogleMapGUI::$enableupdatelistener = false [protected]

Definition at line 36 of file class.ilGoogleMapGUI.php.

ilGoogleMapGUI::$height = "300px" [protected]

Definition at line 40 of file class.ilGoogleMapGUI.php.

ilGoogleMapGUI::$user_marker = array() [protected]

Definition at line 41 of file class.ilGoogleMapGUI.php.

ilGoogleMapGUI::$width = "500px" [protected]

Definition at line 39 of file class.ilGoogleMapGUI.php.


The documentation for this class was generated from the following file: