Commit 78366f31 authored by Feu's avatar Feu
Browse files

fix

parent 533d8961
......@@ -43,6 +43,44 @@ class geopoint extends stdentity
var $type;
var $nom;
/**
*
*
*
*/
static function autoload_by_id ( $db, $id, $type=null )
{
global $topdir;
if ( is_null($type) )
{
$req = new requete($db,
"SELECT type_geopoint ".
"FROM `geopoint` ".
"WHERE `id_geopoint` = '" . mysql_real_escape_string($id) . "' ".
"LIMIT 1");
if ( $req->lines != 1 )
return null;
list($type) = $req->get_row();
}
if ( !class_exists($type)
&& isset($GLOBALS["entitiescatalog"][$type][5])
&& $GLOBALS["entitiescatalog"][$type][5] )
require_once($topdir."include/entities/".$GLOBALS["entitiescatalog"][$type][5]);
if ( class_exists($type) )
$item = new $type($db);
else
return null;
$item->load_by_id($id);
return $item;
}
/**
* Charge les données du point geographique depuis une ligne SQL
* @param $row Ligne SQL
......@@ -257,6 +295,19 @@ class geopoint extends stdentity
return true;
}
function get_kml_placemark()
{
$buffer .= "<Placemark id=\"ae_utbm_fr_geopoint_".$this->id_geopoint."\">";
$buffer .= "<name>".htmlspecialchars($this->nom)."</name>";
$buffer .= "<description>".htmlspecialchars($this->get_html_extended_info())."</description>";
$buffer .= "<Point>";
$buffer .= "<coordinates>".sprintf("%.12F",$this->long*360/2/M_PI).",".
sprintf("%.12F",$this->lat*360/2/M_PI)."</coordinates>";
$buffer .= "</Point>";
$buffer .= "</Placemark>";
return $buffer;
}
}
......
......@@ -428,8 +428,8 @@ class utilisateur extends stdentity
$this->taille_tshirt = $row["taille_tshirt_utl"];
$this->permis_conduire = $row["permis_conduire_utl"];
if ( $this->permis_conduire )
$this->date_permis_conduire = $row["date_permis_conduire_utl"];
if ( !is_null($row["date_permis_conduire_utl"]) )
$this->date_permis_conduire = strtotime($row["date_permis_conduire_utl"]);
else
$this->date_permis_conduire = null;
......
......@@ -222,24 +222,16 @@ if ( $lieu->is_valid() )
{
if ( $_REQUEST["action"] == "kml" )
{
$geo = geopoint::autoload_by_id($lieu->db,$lieu->id,$lieu->type);
header("Content-type: application/vnd.google-earth.kml+xml");
header("Content-Disposition: filename=ae_utbm_".$lieu->id.".kml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<kml xmlns=\"http://earth.google.com/kml/2.1\">";
echo "<Placemark id=\"ae_utbm_fr_geopoint_".$lieu->id_geopoint."\">";
echo "<name>".htmlspecialchars($lieu->nom)."</name>";
echo "<description>".htmlspecialchars($lieu->get_html_extended_info())."</description>";
echo "<Point>";
echo "<coordinates>".sprintf("%.12F",$lieu->long*360/2/M_PI).",".
sprintf("%.12F",$lieu->lat*360/2/M_PI)."</coordinates>";
echo "</Point>";
echo "</Placemark>";
echo $geo->get_kml_placemark();
echo "</kml>";
exit();
}
$lieu_parent = new lieu($site->db);
$lieu_parent->load_by_id($lieu->id_lieu_parent);
$path = $lieu->get_html_link();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment