<?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
 ****************************************************************************************/


// 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");

include_once("../inc/fic_age.inc.php");
include_once("../inc/fic_cli.inc.php");
include_once("../inc/fic_droits.inc.php");
include_once("../inc/fic_int.inc.php");
include_once("../inc/fic_plan.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_geo.inc.php");
include_once("../inc/func_time.inc.php");
include_once("../inc/func_txt.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");
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"]);
// Variables Formulaire
fix_magic_quotes();
$_GET = clean_str($_GET);

$fi = "";
$cat = "";
$urg = "";
$dateddef1 = "";
$dateddef2 = "";
$dateddefp1 = "";
$dateddefp2 = "";
if (isset($_GET['fi']) && ($_GET['fi'] <> ""))
    $fi = intval($_GET['fi']);
if (isset($_GET['cat']) && ($_GET['cat'] <> ""))
    $cat = $_GET['cat'];
if (isset($_GET['urg']) && ($_GET['urg'] <> ""))
    $urg = intval($_GET['urg']);
if (isset($_GET['dateddef1']) && ($_GET['dateddef1'] <> "")) {
    if (chkdate($_GET['dateddef1']) == TRUE)
        $dateddef1 = $_GET['dateddef1'];
}
if (isset($_GET['dateddef2']) && ($_GET['dateddef2'] <> "")) {
    if (chkdate($_GET['dateddef2']) == TRUE)
        $dateddef2 = $_GET['dateddef2'];
}
if (isset($_GET['dateddefp1']) && ($_GET['dateddefp1'] <> "")) {
    if (chkdate($_GET['dateddefp1']) == TRUE)
        $dateddefp1 = $_GET['dateddefp1'];
}
if (isset($_GET['dateddefp2']) && ($_GET['dateddefp2'] <> "")) {
    if (chkdate($_GET['dateddefp2']) == TRUE)
        $dateddefp2 = $_GET['dateddefp2'];
}
$tab_cli = [];
if (@$_SESSION["niv_log"] == 1)
    $tab_cli = give_tab_rcli($_SESSION["code_log"], 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 _("Impression Liste Interventions"); ?></title>

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

    <script type="text/javascript">
        <!--
        function init_all() {
            init_Body();
            warn_print(1);
        }

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


</head>

<body>
<?php
if (@$_SESSION["niv_log"] >= 5)
    entimplst("LISTE DES INTERVENTIONS");
else
    entimplst("LISTE DE VOS INTERVENTIONS");

$db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);

// création de la commande MySQL initiale
$rech = cree_strrechlstintfi();

// Modification de la chaine de recherche en fonction des filtres par colonne
$rech = cree_strrechlst_filtre_col($rech);

// Modification de cette chaine pour tenir compte des filtres spécifiques N°cessitant des accès à des
// bases complémentaires
// $rech = cree_strrechlstintfi2($rech);

// Rajout des tris
switch (@$_SESSION["niv_log"]) {
    case 1 :
        if (count($tab_cli) <= 1)
            $rech .= crestr_triord($intcli_titre_col, "int_code", FALSE, $limit);
        else
            $rech .= crestr_triord($int_titre_col, "int_code", FALSE, $limit);
        break;
    default :
        $rech .= crestr_triord($int_titre_col, "int_code", FALSE, $limit);
        break;
}


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

switch (@$_SESSION["niv_log"]) {
    case 3 :
        if (count($tab_int) == 0)
            $numrows = 0;
        break;
    default :
        break;
}

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

// création entête
switch (@$_SESSION["niv_log"]) {
    case 1 :
        titlst($intcli_titre_col);
        break;
    default :
        titlst($int_titre_col);
        break;
}
// echo "<th>"._("Cliquer")."</th>\n";


$i = 0;
$imprimer = TRUE;

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

echo "</table>\n";
// *** Fin affichage de la table

$db->disconnect();
?>
</body>
</html>