Commit ee4de7a9 authored by Laurent Joly's avatar Laurent Joly
Browse files

maintenance_gestion_poste.php

page en place pour la consultation
parent 809888c6
<?php <?php
/** /**
* Maintenance gestion des postes * Maintenance suppression des postes
* @Projet LCS / SambaEdu * @Projet LCS / SambaEdu
* @auteurs Laurent Joly * @auteurs Laurent Joly
...@@ -46,19 +46,28 @@ else ...@@ -46,19 +46,28 @@ else
$page_id=1; $page_id=1;
include("maintenance_top.php"); include("maintenance_top.php");
function maintenance_liste_poste($config,$flag,$uuid)
echo "<form method='get' action=''>\n";
echo "</form>\n";
function maintenance_liste_poste($config)
{ {
$wpkg_link = connexion_db_wpkg($config); $wpkg_link = connexion_db_wpkg($config);
if ($flag!=-1)
$query_flag="AND p.flag_poste=".($flag+0);
else
$query_flag="";
$query_uuid="";
switch($uuid)
{
case 0:
$query_uuid=" AND (p.uuid_poste is NULL OR p.uuid_poste like 'DELETE%')";
break;
case 1:
$query_uuid=" AND (p.uuid_poste is not NULL AND p.uuid_poste not like 'DELETE%')";
break;
}
$query = mysqli_prepare($wpkg_link, "SELECT p.id_poste, p.nom_poste, p.OS_poste, p.date_rapport_poste, p.ip_poste, p.mac_address_poste, p.file_log_poste, p.file_rapport_poste, p.date_modification_poste, p.flag_poste, p.uuid_poste, count(distinct pa.id_app) as nb_appli, sum(pa.statut_poste_app='Installed') as nb_appli_installed $query = mysqli_prepare($wpkg_link, "SELECT p.id_poste, p.nom_poste, p.OS_poste, p.date_rapport_poste, p.ip_poste, p.mac_address_poste, p.file_log_poste, p.file_rapport_poste, p.date_modification_poste, p.flag_poste, p.uuid_poste, count(distinct pa.id_app) as nb_appli, sum(pa.statut_poste_app='Installed') as nb_appli_installed
FROM (`postes` p) FROM (`postes` p)
LEFT JOIN (`poste_app` pa) ON pa.id_poste=p.id_poste LEFT JOIN (`poste_app` pa) ON pa.id_poste=p.id_poste
WHERE 1=1 WHERE 1=1 ".$query_flag.$query_uuid."
GROUP BY p.nom_poste ASC GROUP BY p.nom_poste ASC
ORDER BY p.date_modification_poste ASC"); ORDER BY p.date_modification_poste ASC");
mysqli_stmt_execute($query); mysqli_stmt_execute($query);
...@@ -91,7 +100,7 @@ function maintenance_liste_poste($config) ...@@ -91,7 +100,7 @@ function maintenance_liste_poste($config)
return $tab; return $tab;
} }
$liste_poste=maintenance_liste_poste($config); $liste_poste=maintenance_liste_poste($config,$get_flag,$get_uuid);
$tri_poste = array(); $tri_poste = array();
$tri_flag = array(); $tri_flag = array();
...@@ -154,51 +163,91 @@ if ($liste_poste) { ...@@ -154,51 +163,91 @@ if ($liste_poste) {
} }
echo "<table cellspadding='2' cellspacing='1' border='0' align='center' bgcolor='black'>\n"; echo "<table cellspadding='2' cellspacing='1' border='0' align='center' bgcolor='black'>\n";
echo "<tr style='color:white'>"; echo "<tr style='color:white'>\n";
echo "<th width='120' rowspan='2'><a href='?tri="; echo "<th width='120' rowspan='2'><a href='?tri=";
if ($tri == 0) if ($tri == 0)
echo "1"; echo "1";
else else
echo "0"; echo "0";
echo "' style='color:" . $regular_lnk . "'>Nom du poste</a></th>"; echo "' style='color:" . $regular_lnk . "'>Nom du poste</a></th>\n";
echo "<th width='50' rowspan='2'>OS</th>"; echo "<th width='50' rowspan='2'>OS</th>\n";
echo "<th width='120' rowspan='2'><a href='?tri="; echo "<th width='120'><a href='?tri=";
if ($tri == 2) if ($tri == 2)
echo "3"; echo "3";
else else
echo "2"; echo "2";
echo "' style='color:" . $regular_lnk . "'>Statut</a></th>"; echo "' style='color:" . $regular_lnk . "'>Statut</a></th>\n";
echo "<th width='180' colspan='2'>Nombre d'applications</th>"; echo "<th width='180' colspan='2'>Nombre d'applications</th>\n";
echo "<th width='200' rowspan='2'><a href='?tri="; echo "<th width='200' rowspan='2'><a href='?tri=";
if ($tri == 6) if ($tri == 6)
echo "7"; echo "7";
else else
echo "6"; echo "6";
echo "' style='color:" . $regular_lnk . "'>Date du dernier rapport</a></th>"; echo "' style='color:" . $regular_lnk . "'>Date du dernier rapport</a></th>\n";
echo "<th width='120' rowspan='2'><a href='?tri="; echo "<th width='120' rowspan='2'><a href='?tri=";
if ($tri == 8) if ($tri == 8)
echo "9"; echo "9";
else else
echo "8"; echo "8";
echo "' style='color:" . $regular_lnk . "'>Adresse IP</a></th>"; echo "' style='color:" . $regular_lnk . "'>Adresse IP</a></th>\n";
echo "<th width='160' rowspan='2'><a href='?tri="; echo "<th width='160' rowspan='2'><a href='?tri=";
if ($tri == 10) if ($tri == 10)
echo "11"; echo "11";
else else
echo "10"; echo "10";
echo "' style='color:" . $regular_lnk . "'>Adresse mac</a></th>"; echo "' style='color:" . $regular_lnk . "'>Adresse mac</a></th>\n";
echo "<th width='160' rowspan='2'>Uuid machine</a></th>"; echo "<th width='160'>Uuid machine</a></th>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr style='color:white'>";
echo "<th width='90'>Total</th>"; echo "<form method='get' action=''>\n";
echo "<tr style='color:white'>\n";
echo "<th>";
echo " <select name='flag' onchange='submit()'>";
echo " <option value='-1'";
if ($get_flag==-1)
echo " selected";
echo ">Tout</option>";
echo " <option value='0'";
if ($get_flag==0)
echo " selected";
echo ">Non protégé</option>";
echo " <option value='1'";
if ($get_flag==1)
echo " selected";
echo ">Protégé</option>";
echo " <option value='2'";
if ($get_flag==2)
echo " selected";
echo ">Autre</option>";
echo " </select>";
echo "</th>\n";
echo "<th width='90'>Total</th>\n";
echo "<th width='90'><a href='?tri="; echo "<th width='90'><a href='?tri=";
if ($tri == 4) if ($tri == 4)
echo "5"; echo "5";
else else
echo "4"; echo "4";
echo "' style='color:" . $regular_lnk . "'>Installées</a></th>"; echo "' style='color:" . $regular_lnk . "'>Installées</a></th>\n";
echo "<th>";
echo " <select name='uuid' onchange='submit()'>";
echo " <option value='-1'";
if ($get_uuid==-1)
echo " selected";
echo ">Tout</option>";
echo " <option value='0'";
if ($get_uuid==0)
echo " selected";
echo ">Inconnu</option>";
echo " <option value='1'";
if ($get_uuid==1)
echo " selected";
echo ">Connu</option>";
echo " </select>";
echo "</th>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<input type='hidden' name='tri' value='" . $tri . "'>\n";
echo "</form>\n";
foreach ($liste_poste as $nom_poste => $lp) foreach ($liste_poste as $nom_poste => $lp)
{ {
...@@ -260,7 +309,7 @@ foreach ($liste_poste as $nom_poste => $lp) ...@@ -260,7 +309,7 @@ foreach ($liste_poste as $nom_poste => $lp)
echo "</td>"; echo "</td>";
echo "<td align='center'>" . $lp["nb_appli"] . "</td>"; echo "<td align='center'>" . $lp["nb_appli"] . "</td>";
echo "<td align='center'>" . $lp["nb_appli_installed"] . "</td>"; echo "<td align='center'>" . $lp["nb_appli_installed"] . "</td>";
$rapport_date = date('d/m/Y', strtotime($lp["date_modification_poste"])); $rapport_date = date('d/m/Y', strtotime($lp["date_modification_poste"]));
$rapport_time = date('H:i:s', strtotime($lp["date_modification_poste"])); $rapport_time = date('H:i:s', strtotime($lp["date_modification_poste"]));
echo "<td align='center'><a href='log.php?logfile=" . $lp["file_rapport_poste"] . "' target='rapport_poste' style='color: " . $lnk . "'>" . $rapport_date . " à " . $rapport_time . "</a></td>"; echo "<td align='center'><a href='log.php?logfile=" . $lp["file_rapport_poste"] . "' target='rapport_poste' style='color: " . $lnk . "'>" . $rapport_date . " à " . $rapport_time . "</a></td>";
echo "<td align='center'>" . $lp["IP_poste"] . "</td>"; echo "<td align='center'>" . $lp["IP_poste"] . "</td>";
......
Supports Markdown
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