%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-editer_question.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();



if(isset($_POST['post']) && $_POST['post'] == 1)
{
	$erreur = $db->verif($_POST['libelle_fr'], "Le libelle français");
	if($erreur == "ok") $erreur = $db->verif($_POST['libelle_en'], "Le libelle anglais");
	if($erreur == "ok") $erreur = $db->verif($_POST['profil'], "Le profil");
	if($erreur == "ok")
	{
		// question
		$where = "id = ".$_GET['id'];
		$where2 = "question = ".$_GET['id'];
		$values = array(
			"profil" =>$_POST['profil'],
			"type" => $_POST['type']
		);

		$db->update("question", $values, $where);
		
		
		//question_fr
		$values = array (
			"libelle" => $_POST['libelle_fr'] );
		$db->update("question_lang", $values, $where2." AND lang = 1");
			
		//question_en
		$values = array (
			"libelle" => $_POST['libelle_en']);
		$db->update("question_lang", $values, $where2." AND lang = 2");
	
		$yes = true;
	}
	else {
		$err = true;
	}
}
else{
	$query='SELECT q.*,ql.libelle as libelle_fr FROM `question` q LEFT JOIN `question_lang` ql ON q.id=ql.question WHERE lang=1 AND q.id='.$_GET['id'];
	$data_fr = $db->select_array($query);
	$query='SELECT q.*,ql.libelle as libelle_en FROM `question` q LEFT JOIN `question_lang` ql ON q.id=ql.question WHERE lang=2 AND q.id='.$_GET['id'];
	$data_en = $db->select_array($query);
	

	$_POST['libelle_fr'] = $data_fr['libelle_fr'];
	$_POST['libelle_en'] = $data_en['libelle_en'];
	$_POST['profil'] = $data_fr['profil'];
	$_POST['type'] = $data_fr['type'];
}

//affichage du html
include("theme/html.php");
//affichage des metas
include("theme/meta.php");
echo "\n<title>Gestion des questions - ".$info_titresite."</title>\n";
//affichage du header
include("theme/header_admin.php");

$this_edition=$edition->getEdition($_GET['id']);
?>

<div class="text_admin">
<h2>Modifier une question</h2>
<h3>Changer le type de question</h3>
<?php
if($_GET['msg']=="yes") {
	echo "<p class=\"infobloc\">Opération effectuée</p>";
}
if(isset($yes) && $yes) {
	echo "<p class=\"infobloc\">Opération effectuée</p>";
}
if(isset($err) && $err) {
	echo "<p class=\"erreurbloc\">".$erreur."</p>";
}

	
?>
<form action="admin/editer_question.php?id=<?=$_GET['id']?>" method="post" class="form">
	<table>
		<tr>
			<td class="label"></td>
			<td class="field head">Français</td>
			<td class="field head">Anglais</td>
		</tr>
		<tr>
			<td class="label">Libelle de la question <span class="etoile">*</span></td>
			<td class="field"><input type="text" name="libelle_fr" value="<?php echo $_POST['libelle_fr']; ?>" /></td>
			<td class="field"><input type="text" name="libelle_en" value="<?php echo $_POST['libelle_en']; ?>" /></td>
		</tr>
		<tr>
			<td class="label">Profil de la ville <span class="etoile">*</span></td>
			<td colspan="2" >
				<input type="radio" name="profil" value="1" <? if($_POST['profil']==1) echo 'checked="checked"'; ?> /> <?=$profil->getLibelle(1)?><br/>
				<input type="radio" name="profil" value="2" <? if($_POST['profil']==2) echo 'checked="checked"'; ?> /> <?=$profil->getLibelle(2)?><br/>
				<input type="radio" name="profil" value="3" <? if($_POST['profil']==3) echo 'checked="checked"'; ?> /> <?=$profil->getLibelle(3)?><br/>
			</td>
		</tr>
		<tr>
			<td class="label">Type de la question <span class="etoile">*</span></td>
			<td colspan="2" >
				<input type="radio" name="type" <? if($_POST['type']=="radio") echo 'checked="checked"'; ?> value="radio" /> liste à puces<br/>
				<input type="radio" name="type" <? if($_POST['type']=="checkbox") echo 'checked="checked"'; ?> value="checkbox" /> liste à choix multiples<br/>
			</td>
			
		</tr>
		
		
	</table>
	<div class="form_bouton">
		<input type="hidden" name="post" value="1" />
		<input type="submit" class="bouton" id="maj_bouton" value="Editer la question" />
	</div>
<h3 class="mt15">Gérer les réponses de la question</h3>
<ul class="adminlist">
	<?= $edition->liste_reponse($_GET['id']);?>
</ul>
	<a href="admin/ajouter_reponse.php?id=<?=$_GET['id']?>" class="bouton" >Ajouter une réponse</a>
</form>





</div>

<?

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

?>

Zerion Mini Shell 1.0