<?php
if(!isset($freqp)) { $freqp = 'freq'; }
if(!isset($jtypo)) { $jtypo = 'ins'; }
if($freqp == 'freq' ) {
	$addfreq = 'freq.h_inscription, freq.h_inscription2, freq.h_inscription3, freq.h_sortie, freq.h_sortie_2, freq.h_sortie_3, freq.cas, ';
}
else { $addfreq = 'freq.statut, '; }
// pour les chgts d'activité
$chgtactiv_info = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT valeur FROM ".$prefix."_parametres WHERE param_nom = 'freq_chgtactiv'"));
if($chgtactiv_info['valeur']!=$_SESSION['journalmodif']&&$_SESSION['journalmodif']!='def') {
	$chgtactiv_info['valeur']=$_SESSION['journalmodif'];
}
// pour les horaires d'inscriptions et de sorties
$jhors_info = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT valeur FROM ".$prefix."_parametres WHERE param_nom = 'freq_jhors'"));
//confirmation de suppression par lot
if(isset($_POST['liste_suppr'])) {
	echo '<p class="signal">'.FREQJ_ORDER1.'</p>';
	echo '<form method="POST" action="" name="liste_suppr_confirm" class="padd1"><input class="bouton boutfreq" type="submit" value="'.FREQJ_ORDER2.'" name="liste_suppr_confirm" /></form><p />';
}
//confirmation de modification par lot
if(isset($_POST['liste_modif'])) {
	$_SESSION['datepickcheck'] = 0;
	$_SESSION['crenpickercheck'] = 0;
	$_SESSION['chgtactivcheck'] = 0;
	$_SESSION['chgtespacecheck'] = 0;
	$_SESSION['chgtcascheck'] = 0;
	if($_POST['datepick_modif']!="") {
		$date = DateTime::createFromFormat('d/m/Y', $_POST['datepick_modif']);
		$_SESSION['daymod'] = $date->format('Y-m-d');;
		$_SESSION['datepickcheck'] = 1;
	}
	if($_POST['crenpicker_modif']!="") { $_SESSION['crenpick'] = $_POST['crenpicker_modif']; $_SESSION['crenpickercheck'] = 1; }
	if($_POST['liste_chgtactiv']!="") { $_SESSION['chgtactiv'] = $_POST['liste_chgtactiv']; $_SESSION['chgtactivcheck'] = 1; }
	if(@$_POST['liste_chgtespace']!="") { $_SESSION['chgtespace'] = $_POST['liste_chgtespace']; $_SESSION['chgtespacecheck'] = 1; }
	if($_POST['liste_chgtcas']!="") { $_SESSION['chgtcas'] = $_POST['liste_chgtcas']; $_SESSION['chgtcascheck'] = 1; }
	echo '<p class="signal" id="newlist">'.FREQJ_ORDER3.'</p>';
}
//annulation de la modification par lot
if(isset($_POST['liste_modif_annul'])){
	unset($_SESSION['datepickcheck']);
	unset($_SESSION['crenpickercheck']);
	unset($_SESSION['chgtactivcheck']);
	unset($_SESSION['chgtespacecheck']);
	unset($_SESSION['chgtcascheck']);
	unset($_SESSION['daymod']);
	unset($_SESSION['crenpick']);
	unset($_SESSION['chgtactiv']);
	unset($_SESSION['chgtespace']);
	unset($_SESSION['chgtcas']);
}
//inscrits					
echo '<div class="jourtable">';
echo '<table id="tablesorter" class="tablesorter journaltable"><thead><tr><th>'.DIV_TINY.'</th><th>'.NAMEUP.'</th><th>'.FORNAME.'</th>';
if($period==1||isset($_POST['liste_modif'])) { 
	// date
	echo '<th>'.DATE.'</th>';
}
echo '<th>'.CREN1.'</th>';
if($espopt['valeur']==1) { echo '<th>'.ZONE.'</th>'; }
echo '<th>'.ACTIV.'</th>';
if($jtypo=='ins') {
	echo '<th>'.CASJO.'</th>';
}
if($jtypo=='res') {
	echo '<th>'.FREQC_RETAR11.'</th>';
}
if ($droits=="2"&&$jtypo=='ins'&&$chgtactiv_info['valeur']==1) {
	if(!isset($_POST['liste_modif'])&&!isset($_POST['liste_suppr'])) {
		echo '<th name="noprint">'.SUPPR_TINY.'</th>';
	}
}
if($jhors_info['valeur']==1) {
	echo '<th>'.HOUR3.'</th>';
}
echo '</tr></thead><tbody>';
?>
<script type="text/javascript">
	function indiv_cren(cren,freq){
	  var cren = cren.options[cren.selectedIndex].value;
	  $.ajax({
	    type: "POST",
	    data: { cren: cren, freq: freq},
	    url: "js/idl/freq_indivcren.php",
	    
	   });
	}
	function indiv_espace(esp,freq){
	  var esp = esp.options[esp.selectedIndex].value;
	  $.ajax({
	    type: "POST",
	    data: { esp: esp, freq: freq},
	    url: "js/idl/freq_indivesp.php",
	    
	   });
	}
	function indiv_activ(activ,freq){
	  var activ = activ.options[activ.selectedIndex].value;
	  $.ajax({
	    type: "POST",
	    data: { activ: activ, freq: freq},
	    url: "js/idl/freq_indivactiv.php",
	    
	   });
	}
	function indiv_cas(cas,freq){
	  var cas = cas.options[cas.selectedIndex].value;
	  $.ajax({
	    type: "POST",
	    data: { cas: cas, freq: freq},
	    url: "js/idl/freq_indivcas.php",
	    
	   });
	}
</script>
<?php
// Chaque ligne, chaque inscrit :
foreach($inscrits as $liste) {
	echo '<tr id="tr'.$liste[$freqp.'_id'].'"><td>'.$liste['division'].'</td><td>'.$liste['nom'].'</td><td>'.$liste['prenom'].'</td>';
	if($period==1||isset($_POST['liste_modif'])) {
		// date
		echo '<td>'.$date = $liste['date_'.$freqp].'';
		if(isset($_POST['liste_modif'])&&$_SESSION['datepickcheck'] == 1) {
			echo '<p class="signal">'.$_SESSION['daymod'].'</p>';
		}
		echo '</td>';
	}
	// créneau
	$hor = mysqli_query($bdd,"SELECT num_creneau, debut, fin FROM ".$prefix."_horaires WHERE hor_name = '".$liste['hor_name']."'");
	$hor_info = mysqli_fetch_assoc($hor);
	$deb_cren = substr($liste['hor_name'], 0, 1);
	echo '<td>';
	if($hor_info['num_creneau']<10) {
		$affcren = '0'.$hor_info['num_creneau'].' - ';
	}
	else {
		$affcren = ''.$hor_info['num_creneau'].' - ';
	}
	$affcren .= MOMENT[$deb_cren];
	$fin_cren = substr($liste['hor_name'], 1, 1);
	$affcren .= ' ('.$deb_cren.$fin_cren.') de ';
	$deb = $hor_info['debut'];
	$dh = substr($deb, 0, 2);
	$dm = substr($deb, 3, 2);
	$affcren .= ''.$dh.'h'.$dm.' à ';
	$fin = $hor_info['fin'];
	$fh = substr($fin, 0, 2);
	$fm = substr($fin, 3, 2);
	$affcren .= ''.$fh.'h'.$fm.'';
	if($droits=="2"&&$chgtactiv_info['valeur']==1&&$jtypo=='ins'&&!isset($_POST['liste_modif'])&&!isset($_POST['liste_suppr'])) {
		echo '<span style="display:none;">'.$affcren.'</span><div class="box boxc"><select id="chgtcren'.$liste[$freqp.'_id'].'" name="chgtcren'.$liste[$freqp.'_id'].'" onchange="indiv_cren(this,\''.$liste[$freqp.'_id'].'\');">';
		if($freq_gestion_jourscren['valeur']==0) {
			$hor = mysqli_query($bdd,"SELECT * FROM ".$prefix."_horaires WHERE hor_freq LIKE '001%' ORDER BY num_creneau ASC");
		}
		else {
			$hor = mysqli_query($bdd,"SELECT * FROM ".$prefix."_horaires WHERE hor_freq LIKE '%001%' ORDER BY num_creneau ASC");
		}
		foreach($hor as $listeh) {
			$cren = $listeh['hor_name'];
			$deb_cren = substr($cren, 0, 1);
			echo '<option value="'.$listeh['hor_name'].'"';
			if($liste['hor_name']==$listeh['hor_name']) {
				echo ' selected ';
			}
			echo '>'.$listeh['hor_name'].' - ';
			include('././include/hor_boucle.php');
			echo '</option>';
		}
		echo '</select></div>';
	}
	else { echo $affcren; }
	if(isset($_POST['liste_modif'])&&$_SESSION['crenpickercheck'] == 1) {
		echo '<p class="signal">'.$_SESSION['crenpick'].'</p>';
	}
	echo '</td>';
	// espace
	if($espopt['valeur']==1) {
		echo '<td>';
		if($droits=="2"&&$chgtactiv_info['valeur']==1&&$jtypo=='ins'&&!isset($_POST['liste_modif'])&&!isset($_POST['liste_suppr'])) {
			echo '<span style="display:none;">'.$liste['espace_nom'].'</span><div class="box boxf"><select id="chgtespace'.$liste[$freqp.'_id'].'" name="chgtespace'.$liste[$freqp.'_id'].'" onchange="indiv_espace(this,\''.$liste[$freqp.'_id'].'\');">';
			$esp_activ = mysqli_query($bdd,"SELECT espace_id, espace_nom FROM ".$prefix."_espaces ORDER BY espace_nom ASC");
			echo '<option value="0">'.$esp0['valeur'].'</option>';
			while($esp = mysqli_fetch_assoc($esp_activ)) {
				echo '<option value="'.$esp['espace_id'].'"';
				if($liste['espace_id']==$esp['espace_id']) {
					echo ' selected ';
				}
				echo '>'.$esp['espace_nom'].'</option>';
			}
			echo '</select></div>';
		}
		else {
			if($liste['espace_id']==0) { echo $esp0['valeur']; }
			else { echo $liste['espace_nom']; }
		}
		if(isset($_POST['liste_modif'])&&$_SESSION['chgtespacecheck'] == 1) {
			echo '<p class="signal">';
			if($_SESSION['chgtespace']==0) { echo $esp0['valeur']; }
			else { $espaff = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT espace_nom FROM ".$prefix."_espaces WHERE espace_id = '".$_SESSION['chgtespace']."'")); echo $espaff['espace_nom']; }
			echo '</p>';
		}
		echo '</td>';
	}
	// activité
	$activ = mysqli_query($bdd,"SELECT nom_activ FROM ".$prefix."_freqactiv WHERE code_activ = '".$liste['code_activ']."'");
	$activ_info = mysqli_fetch_assoc($activ);
	if($droits=="2"&&$chgtactiv_info['valeur']==1&&$jtypo=='ins'&&!isset($_POST['liste_modif'])&&!isset($_POST['liste_suppr'])) {
		echo '<td><span style="display:none;">';
		if(@$activ_info['nom_activ']!="") { echo @$activ_info['nom_activ']; }
		echo '</span>';
		echo '<div class="box boxf"><select id="chgtactiv'.$liste[$freqp.'_id'].'" name="chgtactiv'.$liste[$freqp.'_id'].'" onchange="indiv_activ(this,\''.$liste[$freqp.'_id'].'\');">';
		$liste_activ = mysqli_query($bdd,"SELECT code_activ, nom_activ FROM ".$prefix."_freqactiv WHERE activ_activ = 1 ORDER BY nom_activ ASC");
		while($listea = mysqli_fetch_assoc($liste_activ)) {
			if($listea['code_activ']!="ZERO") { 
				echo '<option value="'.$listea['code_activ'].'"';
				if($liste['code_activ']==$listea['code_activ']) {
					echo ' selected ';
				}
				echo '>'.$listea['nom_activ'].'</option>';
			}
		}
		echo '</select></div></td>';
	}
	else {
		echo '<td>';
		if(@$activ_info['nom_activ']!="") { echo @$activ_info['nom_activ']; }
		if(isset($_POST['liste_modif'])&&$_SESSION['chgtactivcheck'] == 1) {
			$actaff = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT nom_activ FROM ".$prefix."_freqactiv WHERE code_activ = '".$_SESSION['chgtactiv']."'")); 
			echo '<p class="signal">'.$actaff['nom_activ'].'</p>';
		}
		echo '</td>';
	}
	// cas
	if($jtypo=='ins') {
		echo '<td>';
		if($droits=="2"&&$chgtactiv_info['valeur']==1&&$jtypo=='ins'&&!isset($_POST['liste_modif'])&&!isset($_POST['liste_suppr'])) {
			if(@$liste['cas']=="sor") { echo '<span style="display:none;">'.FREQT1.'</span>'; }
			else if(@$liste['cas']=="exc") { echo '<span style="display:none;">'.FREQT2.'</span>'; }
			else { echo '<span style="display:none;">'.NEANT.'</span>'; }
			echo ' <span name="noprint"><div class="box boxf"><select id="chgtcas'.$liste[$freqp.'_id'].'" name="chgtcas'.$liste[$freqp.'_id'].'" onchange="indiv_cas(this,\''.$liste[$freqp.'_id'].'\');">';
			$cascode = array('','sor','exc');
			$casname = array(NEANT,FREQT1,FREQT2);
			for($i=0;$i<count($cascode);$i++) {
				echo '<option value="'.$cascode[$i].'"';
				if(@$liste['cas']==$cascode[$i]) {
					echo ' selected ';
				}
				echo '>'.$casname[$i].'</option>';
			}
			echo '</select></div></span>';
		}
		else {
			if(@$liste['cas']=="sor") { echo FREQT1; }
			else if(@$liste['cas']=="exc") { echo FREQT2; }
			else { echo NEANT; }
			if(isset($_POST['liste_modif'])&&$_SESSION['chgtcascheck'] == 1) {
				echo '<p class="signal">';
				if($_SESSION['chgtcas']=='sor') { echo FREQT1; }
				else if($_SESSION['chgtcas']=='exc') { echo FREQT2; }
				else if($_SESSION['chgtcas']=='0') { echo NEANT; }
				echo '</p>';
			}
		}
		echo '</td>';
	}
	else if($jtypo=='res') {
		echo '<td>';
		if(@$liste['statut']=='0') { echo WAITING; }
		else if(@$liste['statut']=='1') { echo ABORDED; }
		else if(@$liste['statut']=='2') { echo DONE; }
		else if(@$liste['statut']=='4') { echo RESIDU; }
		//echo ' ('.$liste['statut'].')';
		echo '</td>';
	}
	
	if($droits=="2"&&$chgtactiv_info['valeur']==1&&$jtypo=='ins'&&!isset($_POST['liste_modif'])&&!isset($_POST['liste_suppr'])) {
		echo '<td name="noprint"><input class="boutontab" type="submit" onclick="suppr'.$liste[$freqp.'_id'].'(this,\'tr'.$liste[$freqp.'_id'].'\');" value="'.SUPPR_TINY.'" name="suppr'.$liste[$freqp.'_id'].'" /></td>';
		echo '<script type="text/javascript">
			function suppr'.$liste[$freqp.'_id'].'(retards_id, divs) {
			var param = "supfreq";
			var rnb = document.getElementById("nb_ins").textContent;
			var new_rnb = rnb-1;
			document.getElementById(divs).style.display = "none";
			document.getElementById("nb_ins").textContent = new_rnb;
			var freq_id = '.$liste[$freqp.'_id'].';
			$.ajax({
			    type: "POST",
			    data: { param, param, freq_id: freq_id },
			    url: "js/idl/freq_exclu_syn.php",
			   });
			}						
		</script>';
	}
	if($jhors_info['valeur']==1) {
		echo '<td style="min-width:150px;">';
		if(@strlen($liste['h_sortie_3'])==15) {
			$i_date3s = substr($liste['h_sortie_3'],0,4).'-'.substr($liste['h_sortie_3'],4,2).'-'.substr($liste['h_sortie_3'],6,2);
			$i_heure3s = substr($liste['h_sortie_3'],9,2).':'.substr($liste['h_sortie_3'],11,2);
			echo '<b>'.$i_date3s.' - '.$i_heure3s.'</b><br>';
		}
		if(@strlen($liste['h_inscription3'])==15) {
			$i_date3 = substr($liste['h_inscription3'],0,4).'-'.substr($liste['h_inscription3'],4,2).'-'.substr($liste['h_inscription3'],6,2);
			$i_heure3 = substr($liste['h_inscription3'],9,2).':'.substr($liste['h_inscription3'],11,2);
			echo $i_date3.' - '.$i_heure3.'<br>';
		}
		if(@strlen($liste['h_sortie_2'])==15) {
			$i_date2s = substr($liste['h_sortie_2'],0,4).'-'.substr($liste['h_sortie_2'],4,2).'-'.substr($liste['h_sortie_2'],6,2);
			$i_heure2s = substr($liste['h_sortie_2'],9,2).':'.substr($liste['h_sortie_2'],11,2);
			echo '<b>'.$i_date2s.' - '.$i_heure2s.'</b><br>';
		}
		if(@strlen($liste['h_inscription2'])==15) {
			$i_date2 = substr($liste['h_inscription2'],0,4).'-'.substr($liste['h_inscription2'],4,2).'-'.substr($liste['h_inscription2'],6,2);
			$i_heure2 = substr($liste['h_inscription2'],9,2).':'.substr($liste['h_inscription2'],11,2);
			echo $i_date2.' - '.$i_heure2.'<br>';
		}
		if(@strlen($liste['h_sortie'])==15) {
			$i_date1s = substr($liste['h_sortie'],0,4).'-'.substr($liste['h_sortie'],4,2).'-'.substr($liste['h_sortie'],6,2);
			$i_heure1s = substr($liste['h_sortie'],9,2).':'.substr($liste['h_sortie'],11,2);
			echo '<b>'.$i_date1s.' - '.$i_heure1s.'</b><br>';
		}
		$i_date = substr($liste['h_inscription'],0,4).'-'.substr($liste['h_inscription'],4,2).'-'.substr($liste['h_inscription'],6,2);
		$i_heure = substr($liste['h_inscription'],9,2).':'.substr($liste['h_inscription'],11,2);
		echo $i_date.' - '.$i_heure.'</td>';
	}
	echo '</tr>';	
}
echo '</tbody></table></div>';
if(isset($_POST['liste_modif'])) {
	echo '<form method="POST" action="" name="liste_suppr_confirm" class="padd1"><input class="bouton boutfreq" type="submit" value="'.FREQJ_ORDER4.'" name="liste_modif_confirm" />&nbsp; <input class="bouton boutfreq" type="submit" value="'.ABORD.'" name="liste_modif_annul" /></form><p />';
}

//Modifications
//traitement :
if(isset($_POST['liste_modif_confirm'])) {
	foreach($inscrits as $modif) {
		if($_SESSION['datepickcheck'] == 1) {
			$set = "SET date_freq = '".$_SESSION['daymod']."'";
		}
		else if ($_SESSION['crenpickercheck'] == 1||$_SESSION['chgtactivcheck'] == 1||$_SESSION['chgtespacecheck'] == 1||$_SESSION['chgtcascheck'] == 1) { $set ="SET "; }
		if($_SESSION['datepickcheck'] == 1&&($_SESSION['crenpickercheck'] == 1||$_SESSION['chgtactivcheck'] == 1||$_SESSION['chgtespacecheck'] == 1)) { $set.= ', '; }
		if($_SESSION['crenpickercheck'] == 1) { 
			$set.= "hor_name = '".$_SESSION['crenpick']."'"; 
		}
		if($_SESSION['chgtactivcheck'] == 1) { 
			if($_SESSION['crenpickercheck'] == 1) { $set.= ', '; }
			$set.= "code_activ = '".$_SESSION['chgtactiv']."'"; 
		}
		if($_SESSION['chgtespacecheck'] == 1) { 
			if($_SESSION['chgtactivcheck'] == 1) { $set.= ', '; }
			$set.= "espace_id = '".$_SESSION['chgtespace']."'"; 
		}
		if($_SESSION['chgtcascheck'] == 1) { 
			if($_SESSION['chgtespacecheck'] == 1) { $set.= ', '; }
			if($_SESSION['chgtcas']=="0") { $_SESSION['chgtcas'] = ""; }
			$set.= "cas = '".$_SESSION['chgtcas']."'"; 
			$hcheck = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT h_inscription2, h_inscription3 FROM ".$prefix."_freq WHERE freq_id = '".$modif['freq_id']."'"));
			$h_sortie = date('Ymd').'T'.date('His');
			if(@strlen($hcheck['h_inscription3'])==15) { $hs = 'h_sortie_3'; }
			else if(@strlen($hcheck['h_inscription2'])==15) { $hs = 'h_sortie_2'; }
			else { $hs = 'h_sortie'; }
			$set.= ", ".$hs." = '".$h_sortie."'";
		}
		if(isset($set)) {
			@mysqli_query($bdd,"UPDATE ".$prefix."_freq ".@$set." WHERE freq_id = '".$modif['freq_id']."'");
		}		
	}
	unset($_SESSION['datepickcheck']);
	unset($_SESSION['crenpickercheck']);
	unset($_SESSION['chgtactivcheck']);
	unset($_SESSION['chgtespacecheck']);
	unset($_SESSION['daymod']);
	unset($_SESSION['crenpick']);
	unset($_SESSION['chgtactiv']);
	unset($_SESSION['chgtespace']);
	unset($_SESSION['chgtcas']);
	echo '<script language="Javascript">
	<!--
	document.location.replace("freq.php?page=journal");
	// -->
	</script>';
}
if(isset($_POST['liste_suppr_confirm'])) {
	foreach($inscrits as $modif) {
		mysqli_query($bdd,"DELETE FROM ".$prefix."_freq WHERE freq_id = '".$modif['freq_id']."'");
	}
	echo '<script language="Javascript">
	<!--
	document.location.replace("freq.php?page=journal");
	// -->
	</script>';	
}
//formulaire :
if ($droits=="2"&&$chgtactiv_info['valeur']==1&&$jtypo=='ins'&&!isset($_POST['liste_modif'])&&!isset($_POST['liste_suppr'])) {
	echo '<h3 name="noprint">'.FREQJ_ORDER5.'</h3>
	<div class="journaltable"><form name="chgtjournal" action="freq.php?page=journal#newlist" method="POST" class="padd1">
	<table class="freqform"><tr><td>'.DATE.DOTS.' <input type="date" size="10" class="datepick_modif inptxt" name="datepick_modif" value="" />
	<br><br>'.CREN1.DOTS.'<br> <div class="box"><select name="crenpicker_modif" value="">';
	echo '<option></option>';
	if($freq_gestion_jourscren['valeur']==0) {
		$hor = mysqli_query($bdd,"SELECT * FROM ".$prefix."_horaires WHERE hor_freq LIKE '001%' ORDER BY num_creneau ASC");
	}
	else {
		$hor = mysqli_query($bdd,"SELECT * FROM ".$prefix."_horaires WHERE hor_freq LIKE '%001%' ORDER BY num_creneau ASC");
	}
	foreach($hor as $listeh) {
		$cren = $listeh['hor_name'];
		$deb_cren = substr("$cren", 0, 1);
		echo '<option value="'.$listeh['hor_name'].'">'.$listeh['hor_name'].' - ';
		include('././include/hor_boucle.php');
		echo '</option>';
	}
	echo '</select></div>';
	if($espopt['valeur']==1) {
		echo '<br><br>'.ZONE.DOTS.' <div class="box"><select name="liste_chgtespace" value=""><option></option>';
		$listee_activ = mysqli_query($bdd,"SELECT espace_id, espace_nom FROM ".$prefix."_espaces ORDER BY espace_nom ASC");
		echo '<option value="0">'.$esp0['valeur'].'</option>';
		while($listee = mysqli_fetch_assoc($listee_activ)) {
			echo '<option value="'.$listee['espace_id'].'">'.$listee['espace_nom'].'</option>';
		}
		echo '</select></div>';
	}
	if($nb_activ>1) {
		echo '<br><br>'.ACTIV.DOTS.' <div class="box"><select name="liste_chgtactiv" value=""><option></option>';
		$listea_activ = mysqli_query($bdd,"SELECT code_activ, nom_activ FROM ".$prefix."_freqactiv WHERE activ_activ = 1 ORDER BY nom_activ ASC");
		while($listea = mysqli_fetch_assoc($listea_activ)) {
			if($listea['code_activ']=="ZERO") { }
			else {
				echo '<option value="'.$listea['code_activ'].'">'.$listea['nom_activ'].'</option>';
			}
		}
		echo '</select></div>';
	}
	echo '<br><br>'.CASJO.DOTS.' <div class="box"><select name="liste_chgtcas" value=""><option></option>';
		$cascode = array('0','sor','exc');
		$casname = array(NEANT,FREQT1,FREQT2);
		for($i=0;$i<count($cascode);$i++) {
			echo '<option value="'.$cascode[$i].'">'.$casname[$i].'</option>';
		}
		echo '</select></div>';
	echo '</td><td class="journaltd"><input class="bouton boutfreq" type="submit" value="'.FREQJ_ORDER6.'" name="liste_modif" /><br />&nbsp; <br /><input class="bouton boutfreq" type="submit" value="'.FREQJ_ORDER7.'" name="liste_suppr" /></td></tr></table>
	</form></div>';
}

?>
