Public Member Functions | Protected Attributes

ilLocationInputGUI Class Reference
[Services/Form]

This class represents a location property in a property form. More...

Inheritance diagram for ilLocationInputGUI:
Collaboration diagram for ilLocationInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setLatitude ($a_latitude)
 Set Latitude.
 getLatitude ()
 Get Latitude.
 setLongitude ($a_longitude)
 Set Longitude.
 getLongitude ()
 Get Longitude.
 setZoom ($a_zoom)
 Set Zoom.
 getZoom ()
 Get Zoom.
 setValueByArray ($a_values)
 Set value by array.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.

Protected Attributes

 $latitude
 $longitude
 $zoom

Detailed Description

This class represents a location property in a property form.

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

Definition at line 31 of file class.ilLocationInputGUI.php.


Constructor & Destructor Documentation

ilLocationInputGUI::__construct ( a_title = "",
a_postvar = "" 
)

Constructor.

Parameters:
string $a_title Title
string $a_postvar Post Variable

Reimplemented from ilFormPropertyGUI.

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

References ilFormPropertyGUI::setType().

        {
                parent::__construct($a_title, $a_postvar);
                $this->setType("location");
        }

Here is the call graph for this function:


Member Function Documentation

ilLocationInputGUI::checkInput (  ) 

Check input, strip slashes etc.

set alert, if input is not ok.

Returns:
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

Definition at line 126 of file class.ilLocationInputGUI.php.

References $lng, ilFormPropertyGUI::getPostVar(), ilFormPropertyGUI::getRequired(), ilFormPropertyGUI::setAlert(), and ilUtil::stripSlashes().

        {
                global $lng;
                
                $_POST[$this->getPostVar()]["latitude"] = 
                        ilUtil::stripSlashes($_POST[$this->getPostVar()]["latitude"]);
                $_POST[$this->getPostVar()]["longitude"] = 
                        ilUtil::stripSlashes($_POST[$this->getPostVar()]["longitude"]);
                if ($this->getRequired() &&
                        (trim($_POST[$this->getPostVar()]) == "" || trim($_POST[$this->getPostVar()]) == ""))
                {
                        $this->setAlert($lng->txt("msg_input_is_required"));

                        return false;
                }
                return true;
        }

Here is the call graph for this function:

ilLocationInputGUI::getLatitude (  ) 

Get Latitude.

Returns:
real Latitude

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

Referenced by insert().

        {
                return $this->latitude;
        }

Here is the caller graph for this function:

ilLocationInputGUI::getLongitude (  ) 

Get Longitude.

Returns:
real Longitude

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

Referenced by insert().

        {
                return $this->longitude;
        }

Here is the caller graph for this function:

ilLocationInputGUI::getZoom (  ) 

Get Zoom.

Returns:
int Zoom

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

Referenced by insert().

        {
                return $this->zoom;
        }

Here is the caller graph for this function:

ilLocationInputGUI::insert ( &$  a_tpl  ) 

Insert property html.

Definition at line 148 of file class.ilLocationInputGUI.php.

References $lng, $tpl, ilUtil::formSelect(), getLatitude(), getLongitude(), ilFormPropertyGUI::getPostVar(), and getZoom().

        {
                global $tpl, $lng;
                
                $lng->loadLanguageModule("gmaps");
                $a_tpl->setCurrentBlock("prop_location");
                $a_tpl->setVariable("POST_VAR", $this->getPostVar());
                $a_tpl->setVariable("TXT_ZOOM", $lng->txt("gmaps_zoom_level"));
                $a_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;
                $a_tpl->setVariable("PROPERTY_VALUE_LAT", $lat);
                $a_tpl->setVariable("PROPERTY_VALUE_LONG", $long);
                for($i = 0; $i <= 18; $i++)
                {
                        $levels[$i] = $i;
                }
                $a_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()."');")));
                $a_tpl->setVariable("MAP_ID", "map_".$this->getPostVar());
                
                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);
                
                $a_tpl->setVariable("MAP", $map_gui->getHtml());
                
                $a_tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

ilLocationInputGUI::setLatitude ( a_latitude  ) 

Set Latitude.

Parameters:
real $a_latitude Latitude

Definition at line 54 of file class.ilLocationInputGUI.php.

Referenced by setValueByArray().

        {
                $this->latitude = $a_latitude;
        }

Here is the caller graph for this function:

ilLocationInputGUI::setLongitude ( a_longitude  ) 

Set Longitude.

Parameters:
real $a_longitude Longitude

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

Referenced by setValueByArray().

        {
                $this->longitude = $a_longitude;
        }

Here is the caller graph for this function:

ilLocationInputGUI::setValueByArray ( a_values  ) 

Set value by array.

Parameters:
array $a_values value array

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

References ilFormPropertyGUI::getPostVar(), setLatitude(), setLongitude(), and setZoom().

        {
                $this->setLatitude($a_values[$this->getPostVar()]["latitude"]);
                $this->setLongitude($a_values[$this->getPostVar()]["longitude"]);
                $this->setZoom($a_values[$this->getPostVar()]["zoom"]);
        }

Here is the call graph for this function:

ilLocationInputGUI::setZoom ( a_zoom  ) 

Set Zoom.

Parameters:
int $a_zoom Zoom

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

Referenced by setValueByArray().

        {
                $this->zoom = $a_zoom;
        }

Here is the caller graph for this function:


Field Documentation

ilLocationInputGUI::$latitude [protected]

Definition at line 33 of file class.ilLocationInputGUI.php.

ilLocationInputGUI::$longitude [protected]

Definition at line 34 of file class.ilLocationInputGUI.php.

ilLocationInputGUI::$zoom [protected]

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


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