%PDF- %PDF-
Direktori : /home/alliance/domains/congress-intercultural.eu/public_html/ |
Current File : /home/alliance/domains/congress-intercultural.eu/public_html/a-modifier_reponse.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(); $db = new BaseOps(); 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") { $libre=0; if($_POST['libre']=="oui") $libre=1; $where = "id = ".$_GET['id_response']; $where2 = "response = ".$_GET['id_response']; // question $values = array( "libre" => $libre); $db->update("response", $values,$where); //question_fr $values = array ( "libelle" => $_POST['libelle_fr'] ); $db->update("response_lang", $values,$where2." AND lang = 1"); //question_en $values = array ( "libelle" => $_POST['libelle_en']); $db->update("response_lang", $values,$where2." AND lang = 2");; header("Location:editer_question.php?msg=yes&id=".$_GET['id']); } else { $err = true; } } else{ $query='SELECT r.*,rl.libelle as libelle_fr FROM `response` r LEFT JOIN `response_lang` rl ON r.id=rl.response WHERE lang=1 AND r.id='.$_GET['id_response']; $data_fr = $db->select_array($query); $query='SELECT r.*,rl.libelle as libelle_en FROM `response` r LEFT JOIN `response_lang` rl ON r.id=rl.response WHERE lang=2 AND r.id='.$_GET['id_response']; $data_en = $db->select_array($query); $_POST['libelle_fr'] = $data_fr['libelle_fr']; $_POST['libelle_en'] = $data_en['libelle_en']; $_POST['libre'] = $data_fr['libre']; } //affichage du html include("theme/html.php"); //affichage des metas include("theme/meta.php"); echo "\n<title>Gestion des réponses - ".$info_titresite."</title>\n"; //affichage du header include("theme/header_admin.php"); $this_question=$edition->getQuestion($_GET['id']); ?> <div class="text_admin"> <h2>Ajouter une réponse </h2> <h3><?=$this_question['libelle']?></h3> <?php if($_GET['msg']=="yes") { echo "<p class=\"infobloc\">Opération effectuée</p>"; } if($err) { echo "<p class=\"erreurbloc\">".$erreur."</p>"; } ?> <form action="admin/modifier_reponse.php?id=<?=$_GET['id']?>&id_response=<?=$_GET['id_response']?>" 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 reponse<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">Champ libre<span class="etoile">*</span></td> <td colspan="2" > <input type="radio" name="libre" <?if($_POST['libre']) echo 'checked="checked"'; ?> value="oui" /> oui<br/> <input type="radio" name="libre" <?if(!$_POST['libre']) echo 'checked="checked"'; ?> value="non" /> non<br/> </td> </tr> </table> <div class="form_bouton"> <input type="hidden" name="post" value="1" /> <input type="submit" class="bouton" id="maj_bouton" value="Ajouter la réponse" /> </div> </form> </div> <? //affichage du footer include("theme/footer.php"); ?>