Add new pages
This commit is contained in:
parent
7d249967d6
commit
279f23e325
118
changeQuestion.php
Normal file
118
changeQuestion.php
Normal file
@ -0,0 +1,118 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<?php
|
||||
$id = $_GET['id'];
|
||||
|
||||
$fileQ = new QuestionsFile("questions.xml");
|
||||
$question = $fileQ->get_question($id);
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8" />
|
||||
<link rel="Stylesheet" href="style.css" />
|
||||
<title>Every AskWeb (BETA)</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<div id="main_title">
|
||||
<a href="http://www.h2g2.com" target="_blank">
|
||||
<img src="marvin-robot_normal.png" alt="" id="banner"/>
|
||||
</a>
|
||||
<h1>Nemubot AskWeb (BETA)</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section id="introduction">
|
||||
<article>
|
||||
<h2>Dernière chance pour changer d'avis</h2>
|
||||
Voici le rappel de votre question :<br/>
|
||||
<?php $question->print_test(); ?>
|
||||
|
||||
Vous avez la possibilité de modifier votre question avant de la
|
||||
faire valider. Faites vous plaisir.<br/>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<form id="formulaire" method="post" action="validateChangeQuestion.php">
|
||||
|
||||
<section id="Form">
|
||||
<article id="list">
|
||||
<label for="course">De quelle matière s'agit-il ?</label><br/>
|
||||
|
||||
<select name="course" id="course">
|
||||
|
||||
<optgroup label="Cours communs">
|
||||
<option value="SGBD">SGBD</option>
|
||||
<option value="CompressionDeDonnées">
|
||||
Compression de données</option>
|
||||
<option value="ProtocolesDeLiaisons">
|
||||
Protocoles De Liaisons</option>
|
||||
<option value="TYLA">TYLA</option>
|
||||
<option value="ActiveDirectory">
|
||||
Active Directory</option>
|
||||
<option value="GrapheFlotReseau">
|
||||
Graphes Flots Reseaux</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="Electif">
|
||||
<option value="RXAN">RXAN</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="TDA">
|
||||
<option value="TYLA">TYLA</option>
|
||||
<option value="CCMP">CCMP</option>
|
||||
<option value="SLPS">SLPS</option>
|
||||
<option value="FMPS">FMPS</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="MTM">
|
||||
<option value="ITIL">ITIL</option>
|
||||
<option value="Qualite">Qualité</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="Autre">
|
||||
<option value="Autre" selected>Autre</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<p id="questionPart">
|
||||
<label id="q" for="question">
|
||||
Quelle est votre question ? </label><br/>
|
||||
<textarea id="question" name="question"
|
||||
rows="3" cols="70"></textarea>
|
||||
</p>
|
||||
<p id="answerList">
|
||||
<label for="answer">Quelle est la réponse ? </label><br/>
|
||||
<input id="answer" name="answer0" type="text" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="button" value="Ajouter une réponse supplémentaire"
|
||||
onclick="add()"/>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="send" value="Envoyer" />
|
||||
</p>
|
||||
|
||||
</article>
|
||||
|
||||
<article>
|
||||
<h2>... Ou la confirmer telle quelle</h2>
|
||||
|
||||
Si la question vous semble corect, vous pouvez directement
|
||||
la confirmer ici:<br/>
|
||||
|
||||
<a href= <?php "http://".$_SERVER["SERVER_NAME"]
|
||||
. dirname($_SERVER["REQUEST_URI"]) .
|
||||
"/confirmation.php?id=".$question->getId();?>>
|
||||
Valider la question</a>
|
||||
|
||||
</article>
|
||||
</section>
|
||||
<body>
|
||||
<html>
|
43
validateChangeQuestion.php
Normal file
43
validateChangeQuestion.php
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<?php
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
define("FILENAME", "questions_file.nemubot");
|
||||
|
||||
|
||||
include("Question.class.php");
|
||||
include("QuestionsFile.class.php");
|
||||
|
||||
if (isset ($_POST['send']))
|
||||
{
|
||||
//Gets parameters: course, question and answers
|
||||
$course = "";
|
||||
$answers = array();
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
if ($key == "question")
|
||||
$question = $value;
|
||||
else if ($key == "course")
|
||||
$course = $value;
|
||||
else if (preg_match("#^answer#", $key) && $key != "")
|
||||
$answers[] = $value;
|
||||
}
|
||||
|
||||
//Check we have at least a question and an answer
|
||||
if (empty($question))
|
||||
die("Veuillez indiquer une question !");
|
||||
else if (count($answers) <= 0)
|
||||
die("Veuillez indiquer au moins une réponse correcte !");
|
||||
else
|
||||
{
|
||||
$file = new QuestionsFile('questions.xml');
|
||||
$id = POST_['id'];
|
||||
$quest = $file->get_question($id);
|
||||
$quest->setCourse($couse);
|
||||
$quest->setQuestion($question);
|
||||
$quest->setAnswer($answers);
|
||||
|
||||
// Is this enought to change the xml ?
|
||||
$file->save();
|
||||
?>
|
Reference in New Issue
Block a user