<?php require_once(dirname(__DIR__, 1) . '/config.php');
require_once(BASE_PATH . '/db/idl_connect.php');
echo '<meta charset="utf-8" />';
if(isset($_SESSION['user_droits'])) {
	if($_SESSION['user_droits'][1]!="2")
	{
		echo '<p class="noaccess">'.NOMODULE.'<br><a href="./index.php">'.ACCUEIL.'</a></p>';
	}
	else {
		?><style type="text/css">
		#med4 { background-color: #fff; }
		#med4 td { border: 3px #DEBB22 solid; }
		#med3 td { border: 0; }
		</style><?php
		//pour l'importation :
		echo '<h1>'.EDITC_EXP1.'</h1>';
		
		echo '<form enctype="multipart/form-data" action="./db/proc/edit_import_xml.php" method="POST">
			<table class="noborder">
				<tr>
					<td><input class="boutontab" name="file" type="file" accept=".xml" /></td>
				</tr>
				<tr><td style="text-align:right;"><input class="bouton boutseq" type="submit" value="'.SENDFILE.'" /></td></tr>
			</table>
		</form>';
		
		//pour l'exportation :
		$verif_tabseq = mysqli_query($bdd,"SELECT * FROM ".$prefix."_sequences");
		$nb_seq = mysqli_num_rows($verif_tabseq);
		if($nb_seq==0) {
			echo '<h1>Séquences</h1><h2>'.SEQNO.' <a href="edit.php?page=creation">'.SEQCREA.'</a>.</h2>';
		}
	
		else {
			echo '<h1>'.EDITC_EXP1.'</h1>';
			include('db/proc/freq_stats_nivcolors.php');
			for($i=0;$i<count($tabDebniveau);$i++) {
				$seqs = mysqli_query($bdd,"SELECT seq_id, seq_nom, niveau, date_crea, date_maj, progression FROM ".$prefix."_sequences WHERE niveau = '".$tabDebniveau[$i]."' ORDER BY progression, seq_nom");
				$nb_seqs = mysqli_num_rows($seqs);
				if($nb_seqs>0) {
					echo '<h2>'.$tabNiveau[$i].'</h2>';
					include('./db/proc/edit_export_xml.php');
				}
			}
		}
	}
}
else {
	include('include/noaccess.php');
	echo '<a href="./index.php">'.ACCUEIL.'</a></p>';
}
?>