<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Activer Ctrl</title>
<link rel="stylesheet" href="w3.css">
<!--<script src="https://sscc-bikfaya.com/Mob_app/tinymce/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script> 
  
<script>tinymce.init({selector:'textarea'});</script> -->
</head>
<style>
body {width:90%;}
</style>
<body>

<div class="w3-card-4">
<form method="post" action="_dispublicate.php" >
<?php
include 'header.php';
$classeid=0;
$date=$agenda="";
$ctrlErr="";
//include("_serveur.php");
//include("_serveur.php");
$cycle=$_GET['cycle'];
include '_serveur.php';?>
<input name="cycle" type="hidden" value="<?php $cycle=$_REQUEST['cycle']; echo $cycle; ?>">
<?php
$sql = 'SELECT * from classes where cycleID="'.$cycle.'" order by id ASC';
   if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req=  mysqli_query($link, $sql);
echo '<p><label class="w3-text-teal" >Classe:</label>';
//echo'<select name="cla" class="w3-select w3-border w3-light-grey">';

 while($data = mysqli_fetch_array($req)) {
$classe=$data['name'];
$classeid=$data['id'];
$classe=strtoupper($classe);
// echo' <option value="'.$classeid.'">'.$classe.'</option>';
echo ' <input class="w3-check" type="checkbox" name="cla[]"  value="'.$classeid.'">
  <label>'.$classe.'</label>';
        };

//echo '</select>';
$sql = 'SELECT * from semesters  order by id ASC';
   if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req=  mysqli_query($link, $sql);
echo '<p><label class="w3-text-teal" >Classe:</label>';
//echo'<select name="cla" class="w3-select w3-border w3-light-grey">';

 while($data = mysqli_fetch_array($req)) {
$semester=$data['name'];
$semesterid=$data['id'];
$classe=strtoupper($classe);
// echo' <option value="'.$classeid.'">'.$classe.'</option>';
echo ' <input class="w3-check" type="checkbox" name="sem[]"  value="'.$semesterid.'">
  <label>'.$semester.'</label>';
        };

//echo '</select>';

 echo' </p><p> <input name="envoyer" type="submit" class="style19" value="Envoyer" bgcolor="#CC99FF" /></p></form></div>';
               
if (isset ($_POST['envoyer'])){
$cla1=array();
$cla1=$_POST['cla'];
$sem1=array();
$sem1=$_POST['sem'];
// Storing a string into the variable which
// needs to be Encrypted

  $j=0;
  $m=0;
  while ($j<sizeof($cla1))
  {
	  while($m<sizeof($sem1))
	       {
	 $sql='UPDATE classesSemesters SET parentsActive=0 where classID="'.$cla1[$j].'" and semesterID="'.$sem1[$m].'"';
	    if(!(mysqli_query($link, $sql))){
   echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
		$m=$m+1;							
           }
		   $m=0;
  $j=$j+1;
}
 echo ' <div class="w3-panel w3-leftbar w3-sand w3-xxlarge w3-serif">
    <p><i>"Contrôles  Désactivés"</i></p>
  </div>';

}
//On se connecte
// on ferme la connexion

?>



</body>
</html>