echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "<p align='center'><input type=\"submit\" name=\"submit\" value=\"Valider\" /></p>\n"; echo "</form>\n"; echo "<script type='text/javascript'>\nnb_parcs=0;\nid_parc='';\nfor(i=0;i<{$loop};i++) {\n\tif(document.getElementById('parc_'+i)) {\n\t\tnb_parcs++;\n\t\tid_parc='parc_'+i;\n\t}\n}\nif(nb_parcs==1) {\n\tdocument.getElementById(id_parc).checked=true;\n}\n</script>\n"; echo "<p><a href='index.php'>Retour à l'index</a>.</p>\n"; } else { if (!isset($_POST['parametrage_action'])) { echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n"; echo "<input type=\"hidden\" name=\"parametrage_action\" value=\"1\" />\n"; $max_eff_parc = 0; for ($i = 0; $i < count($parc); $i++) { echo "<h2>Parc {$parc[$i]}</h2>\n"; echo "<input type=\"hidden\" name=\"parc[]\" value=\"{$parc[$i]}\" />\n"; $mp = gof_members($parc[$i], "parcs", 1); $nombre_machine = count($mp); sort($mp); //echo "<table border='1'>\n"; echo "<table class='crob'>\n"; echo "<tr>\n"; echo "<th>Nom</th>\n"; echo "<th>Etat</th>\n"; echo "<th>Session</th>\n"; echo "<th>Config DHCP</th>\n"; echo "<th>Dernier Rapport</th>\n"; //echo "<th>Sauvegarde</th>\n"; echo "<th>Rapport<br />\n"; echo "<a href='#' onclick='check_machine({$i},\"check\");return false'><img src=\"../elements/images/enabled.gif\" border='0' alt=\"Tout cocher\" title=\"Tout cocher\" /></a>\n"; echo " / <a href='#' onclick='check_machine({$i},\"uncheck\");return false'><img src=\"../elements/images/disabled.gif\" border='0' alt=\"Tout décocher\" title=\"Tout décocher\" /></a>\n"; echo "</th>\n";
function is_machine_in_parc($machine, $parc) { $retour = "n"; $mp = gof_members($parc, "parcs", 1); $nombre_machine = count($mp); for ($loop = 0; $loop < count($mp); $loop++) { if (strtolower($mp[$loop]) == strtolower($machine)) { $retour = "y"; break; } } return $retour; }
echo "<input type=\"submit\" value=\"Valider\">\n"; echo "</FORM>\n"; } } else // Affichage du formulaire de remplissage des droits if (!$delete_right ) { // Filtrage des noms echo "<FORM action=\"delete_right.php\" method=\"post\">\n"; echo "<P>Lister les noms contenant: "; echo "<INPUT TYPE=\"text\" NAME=\"filtrecomp\"\n VALUE=\"$filtrecomp\" SIZE=\"8\">"; echo "<input type=\"hidden\" name=\"right\" value=\"$right\">\n"; echo '<input name="jeton" type="hidden" value="'.md5($_SESSION['token'].htmlentities($_SERVER['PHP_SELF'])).'" />'; echo "<input type=\"submit\" value=\"Valider\">\n"; echo "</FORM>\n"; // Lecture des membres du droit $mp_all=gof_members($right,"rights",0); // Filtrage selon critere if ("$filtrecomp"=="") $mp=$mp_all; else { $lmloop=0; $mpcount=count($mp_all); for ($loop=0; $loop < count($mp_all); $loop++) { $mach=$mp_all[$loop]; if (mb_ereg($filtrecomp,$mach)) $mp[$lmloop++]=$mach; } } if ( count($mp)>15) $size=15; else $size=count($mp); if ( count($mp)>0) { $form = "<form action=\"delete_right.php\" method=\"post\">\n"; $form.="<p>Sélectionnez les personnes ou groupes à priver du droit:</p>\n"; $form.="<p><select size=\"".$size."\" name=\"old_rights[]\" multiple=\"multiple\">\n";
/** * Retourne la liste des machines du ou des parcs dans un tableau * @Parametres $parc * @Return */ function params_action($parc) { echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n"; echo "<input type=\"hidden\" name=\"parametrage_action\" value=\"1\" />\n"; $max_eff_parc = 0; for ($i = 0; $i < count($parc); $i++) { echo "<h2>Parc {$parc[$i]}</h2>\n"; echo "<input type=\"hidden\" name=\"parc[]\" value=\"{$parc[$i]}\" />\n"; echo "<input type=\"hidden\" name=\"os\" value=\"{$os}\" />\n"; $mp = gof_members($parc[$i], "parcs", 1); $nombre_machine = count($mp); sort($mp); //echo "<table border='1'>\n"; echo "<table class='crob'>\n"; echo "<tr>\n"; echo "<th>Nom</th>\n"; echo "<th>Etat</th>\n"; echo "<th>Session</th>\n"; echo "<th>Config DHCP</th>\n"; //echo "<th>Sauvegarde</th>\n"; echo "<th>Install " . $os . " Linux<br />\n"; echo "<a href='#' onclick='check_machine({$i},\"check\");return false'><img src=\"../elements/images/enabled.gif\" border='0' alt=\"Tout cocher\" title=\"Tout cocher\" /></a>\n"; echo " / <a href='#' onclick='check_machine({$i},\"uncheck\");return false'><img src=\"../elements/images/disabled.gif\" border='0' alt=\"Tout décocher\" title=\"Tout décocher\" /></a>\n"; echo "</th>\n"; echo "<th>Actions programmées</th>\n"; echo "</tr>\n"; 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"; continue; } } if ($suisje_printer == "non") { // Réinitialisation: $id_machine = ""; echo "<tr>\n"; echo "<td width='15%'>" . $mp[$loop] . "</td>\n"; // Etat: allumé ou éteint echo "<td width='15%'>"; $mp_curr = search_machines2("(&(cn={$mpenc})(objectClass=ipHost))", "computers"); if ($mp_curr[0]["ipHostNumber"]) { $iphost = $mp_curr[0]["ipHostNumber"]; echo "<div id='divip{$loop}'>Patientez</div>\n"; echo "<script type='text/javascript'>\n\t\t\t\t\t// <![CDATA[\n\t\t\t\t\tnew Ajax.Updater(\$('divip{$loop}'),'ajax_lib.php?ip={$iphost}&mode=ping_ip',{method: 'get'});\n\t\t\t\t\t//]]>\n\t\t\t\t</script>\n"; } echo "</td>\n"; // Session: ouverte ou pas... sous quelle identité echo "<td width='15%'>\n"; echo "<div id='divsession{$loop}'>Patientez</div>\n"; echo "<script type='text/javascript'>\n\t\t\t\t// <![CDATA[\n\t\t\t\tnew Ajax.Updater(\$('divsession{$loop}'),'ajax_lib.php?nom_machine=" . $mp[$loop] . "&mode=session',{method: 'get'});\n\t\t\t\t//]]>\n\t\t\t</script>\n"; echo "</td>\n"; // Etat config DHCP: // Par la suite il ne faudra pas prendre les IP dans l'annuaire, // mais dans la config DHCP parce que ce sont ces IP qui seront attribuées lors du boot PXE echo "<td width='15%'>\n"; //$mp_curr=search_machines("(&(cn=$mpenc)(objectClass=ipHost))","computers"); if ($mp_curr[0]["macAddress"]) { $sql = "SELECT * FROM se3_dhcp WHERE mac='" . $mp_curr[0]["macAddress"] . "';"; // mp_curr[0]["macAddress"] correspond à une adresse mac recherchée dans l'annuaire LDAP. // Si les machines ont été changées et que l'on a ré-attribué le nom, il faut penser à nettoyer l'entrée dans l'annuaire: // source /usr/share/se3/sbin/variables_admin_ldap.sh // ldapdelete -x -D $ROOTDN -w $PASSDN cn=NOM_MACHINE,ou=Computers,$BASEDN // Et se reconnecter une fois sur la machine pour que le connexion.pl renseigne une nouvelle entrée cn=NOM_MACHINE //echo "$sql<br />"; $res = mysql_query($sql); if (mysql_num_rows($res) > 0) { $lig = mysql_fetch_object($res); $id_machine = $lig->id; //echo $lig->ip; echo "<img src=\"../elements/images/enabled.gif\" border='0' alt=\"{$lig->ip}\" title=\"{$lig->ip}\" />"; } else { echo "<img src=\"../elements/images/disabled.gif\" border='0' alt=\"Pas d'adresse IP attribuée\" title=\"Pas d'adresse IP attribuée\" />"; } } else { echo "<img src=\"../elements/images/disabled.gif\" border='0' alt=\"Pas d'adresse MAC dans l'annuaire???\" title=\"Pas d'adresse MAC dans l'annuaire???\" />"; } echo "</td>\n"; // Sélection des machines à sauvegarder: echo "<td width='15%'>\n"; /* foreach($mp_curr[0] as $champ => $valeur) { echo "\$mp_curr[0]['$champ']=$valeur<br />"; } */ if ($id_machine != "") { echo "<input type='checkbox' name='id_machine[]' id='machine_" . $i . "_" . $loop . "' value='{$id_machine}' />\n"; } else { echo "<img src=\"../elements/images/disabled.gif\" border='0' alt=\"Il faut commencer par effectuer la configuration DHCP\" title=\"Il faut commencer par effectuer la configuration DHCP\" />"; } echo "</td>\n"; // Action programmée echo "<td>\n"; if ($id_machine != "") { $sql = "SELECT * FROM se3_tftp_action WHERE id='" . $id_machine . "';"; $res = mysql_query($sql); if (mysql_num_rows($res) > 0) { $lig = mysql_fetch_object($res); echo "<a href='visu_action.php?id_machine={$id_machine}' target='_blank'>{$lig->type} programmé(e)</a>"; } else { echo "<img src=\"../elements/images/disabled.gif\" border='0' alt=\"Pas d'action programmée\" title=\"Pas d'action programmée\" />"; } } echo "</td>\n"; echo "</tr>\n"; } } echo "</table>\n"; if ($max_eff_parc < $loop) { $max_eff_parc = $loop; } } echo "<script type='text/javascript'>\n\tfunction check_machine(num_parc,mode) {\n\t\tfor(i=0;i<{$max_eff_parc};i++){\n\t\t\tif(document.getElementById('machine_'+num_parc+'_'+i)){\n\t\t\t\tif(mode=='check'){\n\t\t\t\t\tdocument.getElementById('machine_'+num_parc+'_'+i).checked=true;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tdocument.getElementById('machine_'+num_parc+'_'+i).checked=false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n</script>\n"; echo "<p align='center'><input type=\"submit\" name=\"submit\" value=\"Valider\" /></p>\n"; echo "</form>\n"; }
// Nom du groupe professeurs principaux $nom_groupe_pp="Groupe_".$prefix."Professeurs_Principaux"; // Vérification de l'existence de la branche Trash: test_creation_trash(); $tab_no_Trash_prof=array(); $tab_no_Trash_eleve=array(); // Suppression des anciens groupes si l'importation est annuelle: //if(isset($_POST['annuelle'])) { if($annuelle=="y") { //ldap_get_right("no_Trash_user",$login)=="Y" $tmp_tab_no_Trash_user=gof_members("no_Trash_user","rights",1); if(count($tmp_tab_no_Trash_user)>0) { $attribut=array("cn"); $cpt_trash_ele=0; $cpt_trash_prof=0; my_echo("<p>Quelques comptes doivent être préservés de la Corbeille (<i>dispositif no_Trash_user</i>) :<br />\n"); for($loop=0;$loop<count($tmp_tab_no_Trash_user);$loop++) { //my_echo("\$tmp_tab_no_Trash_user[$loop]=$tmp_tab_no_Trash_user[$loop]<br />"); if($loop>0) {my_echo(", ");} my_echo("$tmp_tab_no_Trash_user[$loop]"); $tabtmp=get_tab_attribut("groups", "(&(cn=Profs)(memberuid=$tmp_tab_no_Trash_user[$loop]))", $attribut); if(count($tabtmp)>0) { my_echo("(<i>prof</i>)"); $tab_no_Trash_prof[$cpt_trash_prof]=$tmp_tab_no_Trash_user[$loop];