<?php
#=
include("../include/vars_adm.php");
include("../include/util.inc.php");
include("../include/get.inc.php");
include("../include/utiljs.php");
$statut=$_REQUEST['statut'];
opensession($statut,false);
if (isset($newname)) {//passage 2
    if (!empty($newname)) {
        connecte($host, $user, $mdp, $db);
        $namesec=trim(mysql_real_escape_string($newname));
        query("UPDATE classes SET divcod='".secs($namesec)."' WHERE classe_id=".seci($classe_id));
        }
    header("Location: liste_classes.php?statut=$statut");
    exit();
    }

//1er passage
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
?>
<html>
<head>
    <title>Renomme un groupe</title>
    <BASE TARGET="_self">
    <link rel="stylesheet" href="<?php echo "../themes/".$etab_theme."/b2i.css" ?>">
    <script language="javascript">
        function classeestbonne() { //vérifie le formulaire avant envoi
        var frm=document.form1;
        if (!frm.newname.value) {
           alert("Le nom de la classe est vide.");
           return false;
           }
        return true;
        }
    </script>
</head>
<?php
if ($statut=='Prof') {
          print "<body class=\"arialprof\" onload='document.form1.newname.focus();'>";
          print "<p class=\"sous_titre\" align=\"center\">Renommer un groupe</p>";
   }
    else {
          print "<body class=\"arialadmin\" onload='document.form1.newname.focus();'>";
          print "<p class=\"sous_titre\" align=\"center\">Renommer une classe ou un groupe</p>";
   }

connecte($host, $user, $mdp, $db);
print "<p>Ancien nom : $divcod &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
print "<form name=\"form1\" method=\"post\" action=\"renommegrp.php\">";
print "Nouveau nom <i>(max 12 car)</i>: <input type=\"text\" size=14 maxlength=12 name=\"newname\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
print "<input type=\"submit\" name=\"ok\" value=\"Renommer\" onclick=\"return classeestbonne();\">\n";
print "<input type=\"hidden\" name=\"statut\" value=\"$statut\" >\n";
print "<input type=\"hidden\" name=\"classe_id\" value=\"$classe_id\" >\n";
print "</form>\n";
print "</p>\n";
?>
</body>
</html>