%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/alliance/domains/sedl.alnetis.fr/public_html/
Upload File :
Create Path :
Current File : /home/alliance/domains/sedl.alnetis.fr/public_html/a-liste_partner-form.php

<?php
include_once("inc/config.php");
include_once("inc/functions.php");
include_once("inc/session.php");
include_once("inc/init.php");

verif_co_admin();

$partnerform = new PartnerForm($connection);
$partnerform2 = new PartnerForm2($connection);

if(isset($_POST['active']) && $_POST['active'] == "toggle") {
	if($partnerform->is_active()) {
		//désactivation du formulaire
		$values = array (
			"value" => 0
		);
	} else {
		//désactivation du formulaire
		$values = array (
			"value" => 1
		);
	}
	$db->update("partnerform_config", $values, " config = 'active'");
}

function maybeEncodeCSVField($string) {
	$string = strip_tags(html_entity_decode($string, ENT_QUOTES));
    if(strpos($string, ';') !== false || strpos($string, '"') !== false || strpos($string, "\n") !== false) {
        $string = '"' . str_replace('"', '""', $string) . '"';
    }
    return mb_convert_encoding($string, 'UTF-16LE', 'UTF-8');
}

function liste5a($array, $sep2) {
	$length = count($array);
	$i = 1;
	$string = "";
	foreach ($array as $key => $value) {
		$string .= $value;
		if($i < $length) $string .= $sep2." ";
		$i++;
	}
	return $string;
}

if(!isset($_POST['valide']) || $_POST['valide'] == "n") $valide = false; else $valide = $_POST['valide'];
if(!isset($_POST['pays']) || $_POST['pays'] == "n") $pa = false; else $pa = $_POST['pays'];
//$ed=$this_edition['id'];
$ed=$_SESSION['edition_admin'];
$this_edition=$edition->getCurrentEdition($aff="ins",$_SESSION['lang']);

if(isset($_POST['exportcsv']) && $_POST['exportcsv'] == 1) {

	if($valide == o) $valide = 0;
	$sep = ';';
	$sep2 = ',';
	$liste_forms = $partnerform->liste_forms($ed, $valide, $pa);
	if($liste_forms) {
		header("Content-type: text/csv; charset=utf-8");
		header("Content-Disposition: attachment; filename=export.csv");
		$now = gmdate("D, d M Y H:i:s");
		header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
		header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
		header("Last-Modified: {$now} GMT");
		header("Content-Type: application/force-download");
		header("Content-Type: application/octet-stream");
		header("Content-Type: application/download");
		header("Content-Transfer-Encoding: binary");
		header("Pragma: no-cache");
		header("Expires: 0");
		echo mb_convert_encoding(lang("Community name").$sep."Status".$sep."Date".$sep.lang("part_mayor").$sep.lang("part_address").$sep.lang("part_country").$sep.lang("part_website").$sep.lang("part_facebook").$sep.lang("part_twitter").$sep.lang("part_contactperson").$sep.lang("part_name").$sep.lang("part_function").$sep.lang("part_phone").$sep.lang("part_email").$sep."2.I".$sep."2.II".$sep."2.III".$sep."2.IV".$sep."2.V.a".$sep."2.V.b".$sep."2.VI.a".$sep."2.VI.b".$sep."2.VI.c".$sep."2.VI.d".$sep."Videos".$sep."Photo1".$sep."Photo2".$sep."Photo3\n", 'UTF-16LE', 'UTF-8');
		foreach($liste_forms as $form) {
			$sec = $section->getSection($form['section'], $_SESSION['lang']);
			$thispays = $pays->getUnPays($form['country'], $_SESSION['lang']);
			echo maybeEncodeCSVField($sec['titre']).$sep;
			if($form['submitted'] == 1) echo maybeEncodeCSVField("Submitted").$sep; else echo maybeEncodeCSVField("Draft").$sep;
			echo maybeEncodeCSVField(date("d/m/Y",$form['date'])).$sep;
			echo maybeEncodeCSVField($form['mayor']).$sep;
			echo maybeEncodeCSVField($form['address']).$sep;
			echo maybeEncodeCSVField($thispays['name']).$sep;
			echo maybeEncodeCSVField($form['website']).$sep;
			echo maybeEncodeCSVField($form['facebook']).$sep;
			echo maybeEncodeCSVField($form['twitter']).$sep;
			echo maybeEncodeCSVField($form['contactperson']).$sep;
			echo maybeEncodeCSVField($form['name']).$sep;
			echo maybeEncodeCSVField($form['function']).$sep;
			echo maybeEncodeCSVField($form['phone']).$sep;
			echo maybeEncodeCSVField($form['email']).$sep;
			echo maybeEncodeCSVField($form['detail1']).$sep;
			echo maybeEncodeCSVField($form['detail2']).$sep;
			echo maybeEncodeCSVField($form['detail3']).$sep;
			echo maybeEncodeCSVField($form['detail4']).$sep;
			if(isset($form['detail5a']) && $form['detail5a'] != "")
			{
				$detail5a = unserialize(strip_tags(html_entity_decode($form['detail5a'])));
				$detail5a_values = array();
				if(isset($detail5a[0]) && $detail5a[0] == 1) array_push($detail5a_values, lang("part_detail5a0"));
				if(isset($detail5a[1]) && $detail5a[1] == 1) array_push($detail5a_values, lang("part_detail5a1"));
				if(isset($detail5a[2]) && $detail5a[2] == 1) array_push($detail5a_values, lang("part_detail5a2"));
				echo maybeEncodeCSVField(liste5a($detail5a_values, $sep2));
			}
			echo $sep;
			echo maybeEncodeCSVField($form['detail5b']).$sep;
			echo maybeEncodeCSVField($form['detail6a']).$sep;
			echo maybeEncodeCSVField($form['detail6b']).$sep;
			echo maybeEncodeCSVField($form['detail6c']).$sep;
			echo maybeEncodeCSVField($form['detail6d']).$sep;
			echo maybeEncodeCSVField($form['videos']).$sep;
			if(isset($form['photo1']) && $form['photo1'] != "") { echo maybeEncodeCSVField("http://sedl.alnetis.fr/uploads/".$form['photo1']); } echo $sep;
			if(isset($form['photo2']) && $form['photo2'] != "") { echo maybeEncodeCSVField("http://sedl.alnetis.fr/uploads/".$form['photo2']); } echo $sep;
			if(isset($form['photo3']) && $form['photo3'] != "") { echo maybeEncodeCSVField("http://sedl.alnetis.fr/uploads/".$form['photo3']); } echo "\n";
		}
		die;
	}
}

$_POST['exportcsv'] = 0;

//affichage du html
include("theme/html.php");
//affichage des metas
include("theme/meta.php");
echo "\n<title>Liste des réponses au formulaire statut partenaire - ".$info_titresite."</title>\n";
//affichage du header
include("theme/header_admin.php");
?>

<div class="text_admin">
<h2>Liste des réponses au formulaire statut partenaire</h2>
<form action="admin/liste_partner-form.php" method="post" class="bouton_admin flexcontent mt10">
<input type="hidden" name="active" value="toggle" />
<?php
if($partnerform->is_active()) {
?>
	<div><button type="submit" class="bouton confirm">Désactiver le formulaire</button></div>
<?php
} else {
?>
	<div><button type="submit" class="bouton confirm">Activer le formulaire</button></div>
<?php
}
?>
</form>
<?php
if(isset($_POST['msg']) && $_POST['msg']=="yes") {
	echo "<p class=\"infobloc\">Opération effectuée</p>";
}
?>

<form action="admin/liste_partner-form.php" method="post" class="form mt10">
	<table>
		
		<tr>
			<td class="label">Etat (validation)</td>
			
			<td class="field">
				<select name="valide" style="width: 300px;">
					<option value="n">Tous les états</option>
<?php
		echo '<option value="1"';
			if($valide == "1") echo ' selected="selected"';
		echo ' >Fomulaire soumis</option> ';
		echo '<option value="o"';
			if($valide == "o") echo ' selected="selected"';
		echo ' >Formulaire non soumis (brouillon)</option> ';
?>
				</select>
			</td>
		</tr>
		<tr>
			<td class="label">Pays</td>
			
			<td class="field">
				<select name="pays" style="width: 300px;">
					<option value="n">Tous les pays</option>
<?php
		$res = $pays->getPays(1);
		foreach($res as $pay) {
		echo '<option value="'.$pay['id'].'"';
			if($pa == $pay['id']) echo ' selected="selected"';
		echo ' >'.$pay['name'].'</option> ';
		}
?>
				</select>
			</td>
		</tr>
	</table>

	<div class="form_bouton">
		<input type="hidden" name="exportcsv" id="input_exportcsv" value="0" />
		<button class="bouton" id="maj_bouton">Filtrer les réponses</button>
		<? if($this_edition['id']<12):?>
			<button class="bouton" id="partnerexportcsv">Export en CSV (Excel)</button>
		<? else:?>
			<a href="export.php" class="bouton">Export Excel</a>
		<? endif;?>
	</div>
</form>
		
<ul class="adminlist mt10">
<?php
	$brouillon = false;
	if($valide == "o") {
		$valide = false;
		$brouillon = true;
	}
	$liste_forms = $partnerform->liste_forms($ed, $valide, $pa, false, 0, $brouillon);
	$liste_forms2 = $partnerform2->liste_forms($ed, $valide, $pa, false, 0, $brouillon);
	if($liste_forms || $liste_forms2):
		if($liste_forms):
			foreach($liste_forms as $form):
				$sec = $section->getSection($form['section'], $_SESSION['lang']);?>
				<li>
					<div class="acti_profil_<?=$sec['profil'];?>">
						<strong><?=$sec['titre'];?></strong>
						<?php if($form['submitted'] != 1): ?>
						<span class="infolabel brouillon">Brouillon</span>
						<?php endif; ?>
						(<?=date("d/m/Y",$form['date']);?>)&nbsp;
						<a href="admin/partner-form-response.php?id=<?=$sec['id'];?>">Voir les réponses</a>					
						- <a href="admin/partner-form.php?id=<?=$sec['id'];?>" class="blue">Modifier les réponses</a>					
						- <a href="admin/editer_section.php?id=<?=$sec['id'];?>">Voir le partenaire (panneau admin)</a>					
					</div>
				</li>
	<?php
			endforeach;
		endif;
		if($liste_forms2):
			foreach($liste_forms2 as $form):
				$sec = $section->getSection($form['section'], $_SESSION['lang']);?>
				<li>
					<div class="acti_profil_<?=$sec['profil'];?>">
						<strong><?=$sec['titre'];?></strong>
						<?php if($form['submitted'] != 1): ?>
						<span class="infolabel brouillon">Brouillon</span>
						<?php endif; ?>
						(<?=date("d/m/Y",$form['date']);?>)&nbsp;
						<a href="admin/partner-form2.php?id=<?=$form['section'];?>" class="blue">Réponses</a>					
						- <a href="admin/editer_section.php?id=<?=$sec['id'];?>">Voir le partenaire (panneau admin)</a>					
					</div>
				</li>
	<?php
			endforeach;
		endif;
	else:
		echo "<div class=\"infobloc\">Pas de formulaire trouvé</div>";
	endif;

?>
</ul>

</div>


<script type="text/javascript">
	$('#maj_bouton').click(function(e) {
		e.preventDefault();
		$('#input_exportcsv').val(0);
		$('.form').submit();
	});
	$('#partnerexportcsv').click(function(e) {
		e.preventDefault();
		$('#input_exportcsv').val(1);
		$('.form').submit();
	});
</script>

<?

//affichage du footer
include("theme/footer.php");

?>

Zerion Mini Shell 1.0