:> jean-luc.chretien@tice.ac-caen.fr * @auteurs oluve olivier.le_monnier@crdp.ac-caen.fr * @auteurs wawa olivier.lecluse@crdp.ac-caen.fr * @auteurs plouf * @Licence Distribue selon les termes de la licence GPL * @note */ /** * @Repertoire: parcs/ * file: show_parc.php */ include "entete.inc.php"; include "ldap.inc.php"; include "ihm.inc.php"; include "printers.inc.php"; require_once ("fonc_outils.inc.php"); // Traduction require_once ("lang.inc.php"); bindtextdomain('se3-parcs',"/var/www/se3/locale"); textdomain ('se3-parcs'); $parc=isset($_POST['parc']) ? $_POST['parc'] : (isset($_GET['parc']) ? $_GET['parc'] : ""); $parcs=isset($_POST['parcs']) ? $_POST['parcs'] : ""; $mpenc=isset($_POST['mpenc']) ? $_POST['mpenc'] : ""; $description=isset($_GET['description']) ? $_GET['description'] : ""; $entree=isset($_GET['entree']) ? $_GET['entree'] : ""; //aide $_SESSION["pageaide"]="Gestion_des_parcs"; if (is_admin("computers_is_admin",$login)=="Y") { //titre echo "

".gettext("Liste des parcs")."

"; if ($description=="0") { modif_description_parc ($parc,$entree); // On relance le script pour italc exec ("/usr/bin/sudo /usr/share/se3/scripts/italc_generate.sh"); } echo "

".gettext("Sélectionnez un parc:")."

"; $list_parcs=search_machines("objectclass=groupOfNames","parcs"); if ( count($list_parcs)>0) { sort($list_parcs); echo "
\n"; echo "  \n"; echo "
\n"; } else { echo "
"; echo "Il n'existe encore aucun parc"; echo "
"; exit; } // Test si le parc possede un template // Lecture des membres du parc $mp_all=gof_members($parc,"parcs",1); if ((!isset($filtrecomp))||("$filtrecomp"=="")) {$mp=$mp_all;} // Recherche de l'impra=imante par defaut $imprim_defaut = get_default_printer($parc); $nombre_machine=count($mp); /*************************************************************************/ echo "\n"; /*************************************************************************/ if ( count($mp)>15) $size=15; else $size=count($mp); if ( count($mp)>0) { sort($mp); // echo "

".gettext("Liste des machines dans le parc :")." (".count($mp).")

\n"; echo "
\n"; echo ""; echo ""; ?> "; echo "
"; echo "Ajouter une machine\"Machine\""; echo "Ajouter une imprimante\"Imprimante\""; echo "Programmer l'arrêt et l'allumage des machines\"Programmer\""; echo "Action sur les machines\"Action\""; // Template if(!file_exists("/home/templates/$parc")){ echo "Créer le template pour ce parc\"Template\""; } else { echo "Gérer le template\"Restrictions\""; } echo "Envoyer un popup aux machines connectées\"Popup\""; echo "Déléguer ce parc\"Deleguer\""; // Nomme une machine prof pour italc $parse=exec("cat /var/se3/unattended/install/wpkg/packages.xml | grep italc > /dev/null && echo 1"); if($parse==1) { echo "   "; if ($description=="1") { $description_prof="0"; } else { $description_prof="1"; } echo "Choisir la machine professeur\"italc\""; } echo "
"; echo "

"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; $module_clonage_actif="n"; $sql="select 1=1 from params where name='clonage' AND value='1';"; $test_clonage=mysql_query($sql); if(mysql_num_rows($test_clonage)>0) { $module_clonage_actif="y"; } //echo ""; echo "
\n\n"; if ($description=="1") { echo "Cliquer sur pour choisir une machine comme machine professeur"; echo "
ou recliquer sur le menu pour ne plus en avoir"; echo "

"; } echo ""; echo ""; echo ""; echo ""; if($module_clonage_actif=='y') { echo ""; } echo ""; echo "\n"; // echo ""; // echo ""; // echo ""; // echo ""; // echo "\n"; // Test la machine prof pour italc $machine_prof=search_description_parc("$parc"); $tableau_printer = "
"; $tableau_printer .= "\n
\n
\n"; $tableau_printer .= "
\n\n"; $tableau_printer .= "\n"; $tableau_printer .= "\n"; $tableau_printer .= "\n"; $tableau_printer .= "\n"; $tableau_printer .= "\n"; $tableau_printer .= "\n"; $tableau_printer .= ""; $tableau_printer .= "\n"; $suisje_printer="0"; for ($loop=0; $loop < count($mp); $loop++) { $mpenc=urlencode($mp[$loop]); // Test si on a une imprimante ou une machine $resultat=search_imprimantes("printer-name=$mpenc","printers"); $suisje_printer="non"; for ($loopp=0; $loopp < count($resultat); $loopp++) { if ($mpenc==$resultat[$loopp]['printer-name']) { $suisje_printer="yes"; $printer_in_parc++; $uri_printer = $resultat[$loopp]['printer-uri']; continue; } } if (file_exists ("/var/www/se3/includes/dbconfig.inc.php")) { include_once "fonc_parc.inc.php"; $sessid=session_id(); $systemid=avoir_systemid($mpenc); } else { $inventaire=0; } if ($suisje_printer=="yes") { //$uri_printer = $resultat[$loopp]['printer-uri']; if (preg_match("/socket:\/\//", $uri_printer)) { $uri_printer_modif = preg_replace("/socket:\/\//", "", $uri_printer); $printer_ip = explode(":", $uri_printer_modif); // echo $uri_printer; $printer_ip = $printer_ip[0]; } else { $printer_ip="none"; } // completion tableau par les donnees recuperees $tableau_printer .= ""; $tableau_printer .= ""; $tableau_printer .= "\n"; $tableau_printer .= ""; $tableau_printer .= ""; $tableau_printer .= "\n"; $tableau_printer .= "\n"; $tableau_printer .= ""; } else { echo ""; if($inventaire=="1") { // Type d'icone en fonction de l'OS $retourOs = type_os($mpenc); if($retourOs == "0") { $icone="computer_disable.png"; } elseif($retourOs == "Linux") { $icone="linux.png"; } elseif($retourOs == "XP") { $icone="winxp.png"; } elseif($retourOs == "7") { $icone="win7.png"; } elseif($retourOs == "98") { $icone="win.png"; } else { $icone="computer_disable.png"; } $ip=avoir_ip($mpenc); echo ""; } else { // la machine prof est connue if ($machine_prof==$mpenc) { echo " "; echo "\"Machine"; } } echo "\n"; $ip = avoir_ip($mpenc); //mysql_close(); $authlink = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname,$authlink) or die("Impossible de se connecter à la base $dbname."); $query=" select logintime from connexions where netbios_name='$mpenc' order by id desc limit 1"; //$query .= $cnx_start; //$query .= ",10"; $last_cnx[0]="none"; $result = mysql_query($query) or die ('ERREUR '.$requete.' '.mysql_error()); if (($result)) { while ($r=mysql_fetch_array($result)) { $last_cnx_long=$r["logintime"]; $last_cnx = explode(" ", $last_cnx_long); $time_old = mktime(0,0,0,date("m")-1,date("d"),date("Y")); $time_today= time(); //$date_today= date("Ymd",mktime(0,0,0,date("m")-1,date("d"),date("Y"))); $time_last_cnx_array = explode("-", $last_cnx_long); $time_last_cnx_array2 = explode(" ", $last_cnx_long[2]); //echo "\$time_last_cnx_array[1]=$time_last_cnx_array[1]
"; //echo "\$time_last_cnx_array[2]=$time_last_cnx_array[2]
"; //echo "\$time_last_cnx_array[0]=$time_last_cnx_array[0]
"; //$time_last_cnx = mktime(0,0,0,$time_last_cnx_array[1],$time_last_cnx_array[2],$time_last_cnx_array[0]); $time_last_cnx = mktime(0,0,0,$time_last_cnx_array[1],$time_last_cnx_array2[0],$time_last_cnx_array[0]); } } else echo gettext("erreur lors de la lecture de la base se3"); echo "\n"; if ($time_last_cnx<$time_old) { echo "\n"; } else { echo "\n"; } if($module_clonage_actif=='y') { $sql="SELECT * FROM se3_tftp_rapports WHERE name='".$mp[$loop]."' ORDER BY date DESC LIMIT 1;"; $res_rapport_tftp=mysql_query($sql); if(mysql_num_rows($res_rapport_tftp)>0) { $lig=mysql_fetch_object($res_rapport_tftp); echo "\n"; } else { echo "\n"; } } echo "\n"; echo "\n"; echo ""; } // echo " $ip"; } echo "
\"Imprimante\"$mp[$loop]$printer_ip"; if ($imprim_defaut == $mp[$loop]) { $tableau_printer .= "\"par"; } $tableau_printer .= "
\"$retourOs\""; } else echo "\"Ordinateur\""; // On selectionne la machine prof if ($description=="1") { echo " "; echo "\"Cliquer$mp[$loop]$ip$last_cnx[0]$last_cnx[0]"; echo "id\" target='_blank'>".$lig->date."\n"; $st="$lig->statut"; if($st=="SUCCES") { $cl="green"; } else { $cl="red"; } echo ""."$lig->statut".""; echo "".gettext("Aucun rapport").""; echo "
\n"; $tableau_printer .= "
"; if (isset($printer_in_parc)) { echo $tableau_printer; echo "
"; $nb_machines = count($mp)-$printer_in_parc; echo "

".$nb_machines." station(s) et "."$printer_in_parc"." imprimante(s) ".gettext("dans le parc ")."$parc

"; } else { echo "

".count($mp)." station(s) dans le parc "."$parc

"; } echo "\n"; echo "\n"; echo ""; } else { if ($parc!="") { echo "
"; $message = gettext("Il n'y a pas de machines dans ce parc à afficher !"); echo $message; } } } include ("pdp.inc.php"); ?>