<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 1.0.0

Copyright (C) 2006-2014  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
 ****************************************************************************************/

session_start();

require_once("../lib/gettext/gettext.inc");
include_once("../inc/config.inc.php");
include_once("../inc/func_log.inc.php");
if (CheckURLLog(FALSE) == FALSE) header("Location: ../index.php");
if (CheckNivLog("6-7") == FALSE) header("Location: ../index.php");
include_once("../inc/fic_age.inc.php");
include_once("../inc/fic_cocl.inc.php");
include_once("../inc/fic_droits.inc.php");
include_once("../inc/fic_fici.inc.php");
include_once("../inc/fic_int.inc.php");
include_once("../inc/fic_plan.inc.php");
include_once("../inc/fic_prm.inc.php");
include_once("../inc/fic_rdv.inc.php");
include_once("../inc/fic_statut.inc.php");
include_once("../inc/fic_tac.inc.php");
include_once("../inc/fic_tec.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_time.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/lst.inc.php");
include_once("../classes/ezSQL/shared/ez_sql_core.php");
include_once("../classes/ezSQL/mysqli/ez_sql_mysqli.php");
include_once("../inc/func_sql.inc.php");
Archivelog(@$_SESSION["code_log"]);
$pbm_conf = FALSE;
if (!exist_logo("cge")) $pbm_conf = TRUE;
if (!exist_logo(@$_SESSION["code_do"])) $pbm_conf = TRUE;
if (!existe_cdg()) $pbm_conf = TRUE;
?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>

        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>SMI - <?PHP echo _("ESPACE PRIVE"); ?> : <?PHP echo _("Index Donneur d'Ordres"); ?></title>

        <?PHP include_once("../inc/header.inc.php"); ?>

        <script type="text/javascript">
            <!--
            function init_all() {
                init_Body();
                $( "#onglets_idx" ).tabs();
                init_autohref_classe('falselnkimg','<?PHP echo str_escape(_("Merci de confirmer<br />Sinon, cliquez sur 'Annuler'")); ?>');
                Focus_first();
            }

            $(document).ready(function () {
                init_all();
            });
            //-->
        </script>

    </head>

<body>

<?php
if ($pbm_conf == FALSE) {
    include_once("../inc/entete.inc.php");
    ?>
    <p align="center"><span class="titrepage"><?PHP echo _("VOTRE TABLEAU DE BORD"); ?></span><br /></p>
    <div id="onglets_idx">
    <ul>
        <li><a href="#idx_intc"><?PHP echo _("Interventions en cours"); ?></a></li>
    </ul>
    <div id="idx_intc">
    <?PHP
    $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);

    $rech = cree_strrechlstint($_SESSION["niv_log"]);
    if (!stristr($rech, "WHERE "))
        $rech .= " WHERE " . TBINT . ".int_codedo='" . $db->escape(@$_SESSION["code_do"]) . "' AND " . TBINT . ".int_datefin = '0000-00-00'";
    else
        $rech .= " AND " . TBINT . ".int_codedo='" . $db->escape(@$_SESSION["code_do"]) . "' AND " . TBINT . ".int_datefin = '0000-00-00'";

    $rech .= "ORDER BY " . TBINT . ".int_code DESC";
    // *** Fin de chaîne de Recherche

    $rows = $db->get_results($rech, ARRAY_A);

    if (($rows) AND (count($rows) > 0)) {
        $numrows = count($rows);
        echo "<span class=\"annot_petit_it\">";
        echo _("Laisser la souris sur une icône pour le détail") . "<br />";
        echo "</span>";

        // *** Affichage de la table
        echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";

        // création entête
        titlst($int_titre_col);
        echo "<th>" . _("Cliquer") . "</th>\n";

        $i = 0;

        // Inclusion module affichage liste interventions
        include("../inc/intr_lst.inc.php");

        echo "</table>\n";
        // *** Fin affichage de la table
    } else {
        echo "<div class=\"annot_gras_it\">";
        echo "<br />" . _("Pas d'intervention en cours");
        echo "</div>";
    }

    $db->disconnect();

    $taille_piedla = "";
    include("../inc/piedla.inc.php"); ?>
    </div>
    </div>
    <?PHP
    include_once("pied.php");
} else {
    ?>
    <p align="center"><span class="titrepageerr"><?PHP echo _("PROBLEME DE CONFIGURATION"); ?></span></p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <?PHP
    pop_ret_auto(_("SMI n'a pas encore été totalement configuré pour votre compte") . "<br />" . _("Merci de contacter l'administrateur ou le centre de gestion"), 'warn', "index.php");
}
?>