<?php
/**
 * 
 *
 * @package opencimetiere
 * @version SVN : $Id$
 */

require_once "../obj/utils.class.php";
$f = new utils("nohtml");

/**
 * Initialisation des parametres
 */
//
(isset($_GET['plan']) ? $plan = $_GET['plan'] : $plan = "");
//
(isset($_GET['positionx']) ? $positionx = $_GET['positionx'] : $positionx = "");
//
(isset($_GET['positiony']) ? $positiony = $_GET['positiony'] : $positiony = ""); 
//
(isset($_GET['x']) ? $x = $_GET['x'] : $x = 0);
//
(isset($_GET['y']) ? $y = $_GET['y'] : $y = 0);
//
(isset($_GET['form']) ? $form = $_GET['form'] : $form = 'f1');

/**
 *
 */
//
require_once "../obj/plans.class.php";
$plans = new plans($plan, $f->db, NULL);
//
$imageplan = $f->storage->getPath($plans->getVal("fichier"));

/**
 * Verification des parametres
 */
if ($plan == ""
    or $positionx == ""
    or $positiony == ""
    or !file_exists($imageplan)) {
    //
    if ($f->isAjaxRequest() == false) {
        $f->setFlag(NULL);
        $f->display();
    }
    $class = "error";
    $message = _("L'objet est invalide.");
    $f->displayMessage($class, $message);
    die();
}


/**
 * Affichage de la structure HTML
 */
if ($f->isAjaxRequest()) {
    header("Content-type: text/html; charset=".HTTPCHARSET."");
} else {
    //
    $f->setFlag("htmlonly");
    $f->display();
}
//
$f->displayStartContent();
//
$f->setTitle(_("Localisation"));
$f->displayTitle();

/**
 *
 */
//
$f->displayLinkJsCloseWindow();

/**
 *
 */
//
$size = getimagesize($imageplan);
//
echo "<div";
echo " id=\"localisation-wrapper\"";
echo " style=\"";
//
echo "border: 1px solid #cdcdcd; ";
echo "position:relative; ";
echo "width:".$size[0]."px; ";
echo "height:".$size[1]."px; ";
echo "background-image: url('../spg/file.php?obj=plans&champ=fichier&id=".$plan."'); ";
//
echo "\"";
echo ">\n";
//
echo "<img";
echo " id=\"plan-draggable\"";
echo " class=\"".$form.";".$positionx.";".$positiony.";\"";
echo " src=\"../app/img/point_emplacement.png\"";
echo " style=\"position:absolute; margin:0; padding:0; left:".($x)."px; top:".($y)."px; cursor: pointer;\"";
echo " />";
//
echo "\n</div>\n";
//
echo "<div class=\"visualClear\"><!-- --></div>\n";

/**
 *
 */
//
$f->displayLinkJsCloseWindow();

/**
 *
 */
//
$f->displayEndContent();

?>