<?php
foreach($seqs as $seqs_liste) {
	if($seqs_liste['seq_id']!=@$seq_norepeat) {
		echo '<p>';
		if($seqs_liste['seq_complete']==1) { echo ' <abbr title="'.EDIT_COMP1.'"><i class="fas fa-bookmark"></i></abbr> '; }
		else { echo '<i class="far fa-bookmark"></i> '; }
		if($seqs_liste['progression'] != '1000') { echo '<b>'.$seqs_liste['progression'].'.</b> '; }
		echo '<a href="edit.php?page=consult&seq_id='.$seqs_liste['seq_id'].'">'.$seqs_liste['seq_nom'].'</a>';
		if($seqs_liste['date_maj']=='0000-00-00'||$seqs_liste['date_maj']=='') {
			echo ' ('.$seqs_liste['date_crea'].')';
		}
		else { echo ' ('.$seqs_liste['date_maj'].')'; }
		if($seqs_liste['seq_actif']==0) { 
			$brik_nb = mysqli_num_rows(mysqli_query($bdd,"SELECT * FROM ".$prefix."_edtbrik WHERE seq_id = '".$seqs_liste['seq_id']."'"));
			$event_nb = mysqli_num_rows(mysqli_query($bdd,"SELECT * FROM ".$prefix."_edtevent WHERE seq_id = '".$seqs_liste['seq_id']."'"));
			if($brik_nb>0) { 
				echo ' ['.EDIT_INFO1.' '.$brik_nb.' '.EDIT_INFO2;
				if($brik_nb>1) {echo PLURIEL; }
				echo ']';
			}
			if($event_nb>0) { 
				echo ' ['.EDIT_INFO1.' '.$event_nb.' '.EDIT_INFO3;
				if($event_nb>1) { echo PLURIEL; }
				echo ']';
			}
			if($brik_nb==0&&$event_nb==0) { echo ' ['.EDIT_INFO4.']'; }
		}
		$nb_docs = mysqli_num_rows(mysqli_query($bdd,"SELECT * FROM ".$prefix."_seqdocs WHERE seq_id = '".$seqs_liste['seq_id']."'"));
		if($nb_docs>0&$docs==0) {
			echo ' <abbr title="'.EDIT_INFO5.' '.$nb_docs.' '.EDIT_INFO6;
			if($nb_docs>1) { echo PLURIEL; }
			echo '"><i class="fa-regular fa-folder-open"></i></abbr>';
		}
		echo '</p>';
		if($docs==1) {
			echo '<ul class="p100">'.$nb_docs.' '.EDIT_INFO6;
			if($nb_docs>1) { echo PLURIEL; }
			echo ' :';
			$documents = mysqli_query($bdd,"SELECT * FROM ".$prefix."_seqdocs WHERE seq_id = '".$seqs_liste['seq_id']."'");
			foreach($documents as $liste_docs) {
				echo '<li style="list-style-type:none;">';
				if(substr($liste_docs['docname'],-4)==".pdf") {
					echo '<i class="fa-regular fa-file-pdf"></i> ';
				}
				else if(substr($liste_docs['docname'],-4)==".png"||substr($liste_docs['docname'],-4)==".gif"||substr($liste_docs['docname'],-4)==".jpg") {
					echo '<i class="fa-regular fa-file-image"></i> ';
				}
				else {
					echo '<i class="fa-regular fa-file"></i> ';
				}
				echo '<a href="'.$_SESSION['url_base'].'/../seqfichiers/'.$prefix.'/'.$liste_docs['docurl'].'" download="';
				if($liste_docs['docname']=="") { echo $liste_docs['docurl']; }
				else { echo $liste_docs['docname']; }
				echo'">';
				if($liste_docs['docname']=="") { echo $liste_docs['docurl']; }
				else { echo $liste_docs['docname']; }
				echo '</a> - ';
				$taille = @number_format(filesize('seqfichiers/'.$prefix.'/'.$liste_docs['docurl'])/1048,2);
				echo $taille;
				echo ' kB';
				echo '</li>';
			}
			echo '</ul><hr class="hr2n">';
			$seq_norepeat = $seqs_liste['seq_id'];
		}
	}
}
?>