You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
4.1 KiB
101 lines
4.1 KiB
|
|
<link rel="stylesheet" href="css/VueAdmin.css">
|
|
|
|
|
|
<?php require_once('../BDD/SqliteDb.php');
|
|
require_once('../BDD/OracleDb.php');
|
|
$db = new SqliteDb('o');
|
|
|
|
|
|
$stmt = $db->prepare('SELECT * FROM QcmQuestion WHERE numQuestion= ?');
|
|
$stmt->bindParam(1, $_GET['numQuestion']);
|
|
$resultQuestion = $stmt->execute();
|
|
$questionRow = $resultQuestion->fetchArray();
|
|
|
|
$stmt = $db->prepare('SELECT reponse FROM QcmReponse WHERE numQuestion= ?');
|
|
$stmt->bindParam(1, $_GET['numQuestion']);
|
|
$resultQuestion = $stmt->execute();
|
|
while($r = $resultQuestion->fetchArray(SQLITE3_NUM)){
|
|
$reponseRow[] = $r[0];
|
|
}
|
|
|
|
$stmt = $db->prepare('SELECT * FROM QcmCorrection WHERE numQuestion= ?');
|
|
$stmt->bindParam(1, $_GET['numQuestion']);
|
|
$resultQuestion = $stmt->execute();
|
|
$correctRow = $resultQuestion->fetchArray();
|
|
|
|
?>
|
|
<form style="border:1px solid #ccc" method="GET" action="Traitement/AjoutQuestion.php">
|
|
<div class="container">
|
|
|
|
|
|
<h1>Ajouter une question(QCM)</h1>
|
|
<hr>
|
|
|
|
<label><b>Numéro de question : </b></label>
|
|
<input type="text" placeholder="Saisir le numéro de la démonstration..." id="numQuestion" value="<?php echo $_GET['numQuestion']; ?>" required disabled>
|
|
|
|
|
|
<label><b>Consigne : </b></label>
|
|
<input type="text" placeholder="Ecrire l'intitulé de la démonstration..." id="consigne" value="<?php echo $questionRow['question']; ?>" required >
|
|
|
|
<label><b>Réponse 1 : </b></label>
|
|
<input type="text" id="choix1" value="<?php echo $reponseRow[0]; ?>" required>
|
|
|
|
<label><b>Réponse 2 : </b></label>
|
|
<input type="text" id="choix2" value="<?php echo $reponseRow[1]; ?>" required>
|
|
|
|
<label><b>Réponse 3 : </b></label>
|
|
<input type="text" id="choix3" value="<?php echo $reponseRow[2]; ?>" required>
|
|
|
|
<label><b>Bonne Réponse ? </b><br/>
|
|
<input type="radio" name="reponse" value="1" style="margin-bottom:15px" <?php if($correctRow['numReponse']== 1) echo 'checked'; ?>> 1
|
|
<input type="radio" name="reponse" value="2" style="margin-bottom:15px" <?php if($correctRow['numReponse']== 2) echo 'checked'; ?>> 2
|
|
<input type="radio" name="reponse" value="3" style="margin-bottom:15px" <?php if($correctRow['numReponse']== 3) echo 'checked'; ?>> 3
|
|
</label><br/>
|
|
|
|
<div >
|
|
<input type="button" value="Ajouter" onclick="SubmitModifierQCM()" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<div id="erreur">
|
|
|
|
</div>
|
|
|
|
<form method="get">
|
|
<input id="inp-qcm" class="bouton" type="submit" name="action" value="QCM" >
|
|
</form>
|
|
|
|
|
|
</body>
|
|
|
|
<script>
|
|
|
|
function SubmitModifierQCM() {
|
|
|
|
//var chapitre = $('#chapitre').val() ;
|
|
var numQuestion = $('#numQuestion').val() ;
|
|
var consigne = $('#consigne').val() ;
|
|
var choix1= $('#choix1').val() ;
|
|
var choix2= $('#choix2').val() ;
|
|
var choix3= $('#choix3').val() ;
|
|
//var reponse = $('#reponse').val() ;
|
|
var reponse = $("input[name='reponse']:checked").val();
|
|
var modif = 1;
|
|
|
|
|
|
$.get("Traitement/AjoutQCM.php", {numQuestion: numQuestion,consigne: consigne,choix1: choix1,choix2: choix2,choix3: choix3,reponse: reponse, modif : modif},
|
|
function(data) {
|
|
$('#erreur').html(data);
|
|
if (data.includes("AJOUT") == true){
|
|
var result = confirm("La question a été ajoutée. Afficher les QCM ?");
|
|
if(result) $('#inp-qcm').trigger("click");
|
|
}
|
|
//$('#demoForm')[0].reset();
|
|
});
|
|
}
|
|
|
|
</script>
|
|
</html>
|