<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.2
 *
 * Copyright (C) 2006-2015  Sylvain FATOME
 * This program is free software; you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program
 * (in the directory docs);
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Contact : galawa@free.fr
 *
 * Web : http://smi.no-ip.org
 ****************************************************************************************/


// Vérification des tentatives de hack
$pos = strpos($_SERVER['PHP_SELF'], "inc.php");
if ($pos === FALSE)
    $ok_inc = TRUE;
else
    $ok_inc = FALSE;
if ($ok_inc == FALSE) header("Location: ../index.php");

$urlcache = $chemin_images . "/cache.gif";
$urllog = $chemin_logos . "/logcge.gif";

include_once("../inc/func_geol.inc.php");

include_once("../classes/geoplugin/geoplugin.class.php");

echo "<div id=\"header\">\n";
//Date du jour
echo "<div class=\"head_hd\">";
echo $nomjour . " " . date($_SESSION['date_fmt']);
// Cartouche de connexion
echo "<div class=\"cnx\">";
echo "<table border=\"0\" width=\"250\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo "<td align=\"right\" class=\"annot_petit_gras\">\n";
echo _("Code") . " : ";
echo "</td>\n";
echo "<td class=\"annot_petit_it\" style=\"padding-left:2px;\">\n";
if ($_SESSION["id_ccli"] == 0)
    echo @$_SESSION["code_log"];
else
    echo @$_SESSION["code_log"] . "_" . @$_SESSION["id_ccli"];
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align=\"right\" class=\"annot_petit_gras\">\n";
echo _("Session") . " : ";
echo "</td>\n";
echo "<td class=\"annot_petit_it\" style=\"padding-left:2px;\">\n";
switch (@$_SESSION["niv_log"]) {
    case 1 :
        if ($_SESSION["id_ccli"] == 0)
            echo _("Client");
        else
            echo _("Contact client");
        break;
    case 2 :
        echo _("Opérateur");
        break;
    case 3 :
        echo _("Technicien agence");
        break;
    case 4 :
        echo _("Agence");
        break;
    case 5 :
        echo _("Centre de Gestion");
        break;
    case 6 :
        echo _("Donneur d'ordres");
        break;
    case 7 :
        echo _("Technicien donneur d'ordres");
        break;
    case 9 :
        echo _("Administrateur");
        break;
    case 10 :
        echo _("Sous-traitant");
        break;
    case 11 :
        echo _("Technicien sous-traitant");
        break;
}
echo "</td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td align=\"right\" class=\"annot_petit_gras\">\n";
echo _("Pays / Langage") . " : ";
echo "</td>\n";
echo "<td class=\"annot_petit_it\" style=\"padding-left:2px;\">\n";
echo Retournepays($_SESSION["codepays"]) . " / " . $_SESSION["lng"];
echo "</td>\n";
echo "</tr>\n";

echo "<tr>\n";
echo "<td align=\"right\" class=\"annot_petit_gras\">\n";
switch (@$_SESSION["niv_log"]) {
    case 3 :
        echo _("Agence") . " : ";
        break;
    case 7 :
        echo _("Donneur d'ordres") . " : ";
        break;
    case 11 :
        echo _("Sous-traitant") . " : ";
        break;
    default :
        echo "&nbsp;";
        break;
}
echo "</td>\n";
echo "<td class=\"annot_petit_it\" style=\"padding-left:2px;\">\n";
switch (@$_SESSION["niv_log"]) {
    case 3 :
        echo @$_SESSION["code_age"];
        break;
    case 7 :
        echo @$_SESSION["code_do"];
        break;
    case 11 :
        echo @$_SESSION["code_st"];
        break;
    default :
        echo "&nbsp;";
        break;
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>"; // Fin du cartouche
// Affichage de l'icône pour quitter
echo "<div class=\"exit\">";
$chemin_imagesco = $chemin_images . "/quit.png";
echo '<a href="quit.php"><span class="annot_petit_gras2">'._("Quitter").'</span> <img src="' . $chemin_imagesco . '" title="' . _("Quitter") . '" alt="' . _("Quitter") . '" border="0" align="absmiddle"></a>';
echo "</div>"; // Fin du "quitter"
echo "</div>"; // Fin du header_hd
// Logo SMI
aff_img($urllog, "index.php", "logo", _("Retour accueil"), _("Retour accueil"), TRUE);
// Affichage coordonnées centre de gestion
$row = lit_enr_cdg();
if (is_array($row)) {
    $row = encode_str($row);
    extract($row);
    echo "<span class=\"annot_petit_gras\">";
    echo $cge_adr1;
    if ($cge_adr2 <> "")
        echo ", " . $cge_adr2;
    echo ", " . Retournecp_Id($cge_ville, TRUE) . " " . Retourneville_Id($cge_ville, TRUE) . "<br />";
    echo "<br />";
    echo "</span>";
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" class=\"annot_petit_gras\">\n";
    echo "<tr>\n";
    echo "<td>\n";
    $chemin_imagesco = $chemin_images . "/telc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo " " . $cge_telf;
    if (trim($cge_txttelf) <> "") {
        echo "<span class=\"annot_petit_it\">";
        echo " (" . $cge_txttelf . ")";
        echo "</span>";
    }
    echo "</td>\n";
    echo "<td style=\"padding-left:10px;\">\n";
    $chemin_imagesco = $chemin_images . "/faxc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo " " . $cge_fax;
    if (trim($cge_txtfax) <> "") {
        echo "<span class=\"annot_petit_it\">";
        echo " (" . $cge_txtfax . ")";
        echo "</span>";
    }
    echo "</td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td>\n";
    $chemin_imagesco = $chemin_images . "/webc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo " " . $cge_web;
    echo "</td>\n";
    echo "<td style=\"padding-left:10px;\">\n";
    $chemin_imagesco = $chemin_images . "/atc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo " " . $cge_email . "<br />";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>";
} else {
    echo "<br />";
    echo "<br />";
    $chemin_imagesco = $chemin_images . "/telc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo "<img src=\"" . $urlcache . "\" align=\"absmiddle\">";
    $chemin_imagesco = $chemin_images . "/faxc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo "<br />";
    $chemin_imagesco = $chemin_images . "/webc.png";
    echo "<img src=\"" . $urlcache . "\" align=\"absmiddle\">";
    $chemin_imagesco = $chemin_images . "/atc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo "<br />";

    $chemin_imagesco = $chemin_images . "/telc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo "<br />";
    $chemin_imagesco = $chemin_images . "/faxc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo "<br />";
    $chemin_imagesco = $chemin_images . "/webc.png";
    echo "<img src=\"" . $chemin_imagesco . "\" align=\"absmiddle\">";
    echo "<br />";
    echo "<br />";
}
echo "</div>"; // Fin du logo + coordonnées
?>
<div id="barre_menu" class="mnubar">
<!-- Définition du menu -->
<?PHP include_once("../jscript/menus/menu.js.php"); ?>
</div>
