<?php 
$_SESSION['etabchoix']=@$_COOKIE['LOGGED_ETAB']; 
require_once(dirname(__DIR__, 2) . '/config.php');
require_once(BASE_PATH . '/db/idl_connect.php');
if(isset($_SESSION['isav'])) { // pour gérer l'ajout de savoirs (remise ŕ zéro, si besoin, quand on change de niveau)
	$_SESSION['isav'] = 2;
}
echo "<div class='box'><select name='seqch' id='seqch'>";
if(isset($_POST["idAuteur"])){
	$baseniv = $_POST["idAuteur"];
	$seqniv = substr("$baseniv", 0, 1);
	if($seqniv== "6"||$seqniv=="5"||$seqniv=="4"||$seqniv=="3"||$seqniv=="2"||$seqniv=="1"||$seqniv=="T") {
		$liste_seq = mysqli_query($bdd,"SELECT seq_id, seq_nom, progression FROM ".$prefix."_sequences WHERE niveau LIKE '".$seqniv."%' ORDER BY progression ASC, seq_nom ASC");
	}
	else {
		$liste_seq = mysqli_query($bdd,"SELECT seq_id, seq_nom, progression FROM ".$prefix."_sequences WHERE niveau LIKE 'a%' ORDER BY progression ASC, seq_nom ASC");
	}
	echo '<option></option>';
	while($liste = mysqli_fetch_assoc($liste_seq)) {
		echo '<option value="'.$liste['seq_id'].'">'; 
		if($liste['progression']!="1000") { echo $liste['progression'].'. '; }
		echo $liste['seq_nom'];
		echo '</option>';
	}
}
echo "</select></div>";
?>
