2012-06-18 18:09:31 +00:00
|
|
|
<!DOCTYPE html><html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<link rel="Stylesheet" href="style.css">
|
|
|
|
<title>Every Questions (BETA)</title>
|
|
|
|
<script type="text/javascript">
|
2012-06-16 19:39:58 +00:00
|
|
|
function add()
|
|
|
|
{
|
2012-06-18 18:09:31 +00:00
|
|
|
var element = document.createElement("input");
|
2012-06-16 19:39:58 +00:00
|
|
|
|
2012-06-18 18:09:31 +00:00
|
|
|
element.setAttribute("type", "text");
|
|
|
|
element.setAttribute("id", "answer");
|
|
|
|
element.setAttribute("name", "answer" + nbAnswer);
|
|
|
|
nbAnswer++;
|
|
|
|
element.setAttribute("placeholder", "Nouvelle réponse");
|
2012-06-16 19:39:58 +00:00
|
|
|
|
2012-06-18 18:09:31 +00:00
|
|
|
var foo = document.getElementById("answerList");
|
|
|
|
foo.appendChild(element);
|
2012-06-16 19:39:58 +00:00
|
|
|
}
|
|
|
|
</script>
|
2012-06-18 18:09:31 +00:00
|
|
|
</head>
|
2012-06-16 19:39:58 +00:00
|
|
|
|
2012-06-18 18:09:31 +00:00
|
|
|
<body>
|
|
|
|
<header>
|
|
|
|
<a href="http://www.h2g2.com" target="_blank">
|
|
|
|
<img src="marvin-robot_normal.png" alt="" id="banner"/>
|
|
|
|
</a>
|
|
|
|
<h1>Nemubot Questions (BETA)</h1>
|
|
|
|
</header>
|
2012-06-15 11:35:04 +00:00
|
|
|
<?php
|
2012-06-15 12:12:05 +00:00
|
|
|
|
|
|
|
include("Question.class.php");
|
|
|
|
include("QuestionsFile.class.php");
|
|
|
|
|
2012-06-15 11:35:04 +00:00
|
|
|
$id = $_GET['id'];
|
|
|
|
|
|
|
|
$fileQ = new QuestionsFile("questions.xml");
|
|
|
|
$question = $fileQ->get_question($id);
|
|
|
|
?>
|
|
|
|
<section id="introduction">
|
|
|
|
<article>
|
2012-06-18 18:09:31 +00:00
|
|
|
<h2>Dernière chance pour changer d'avis</h2>
|
|
|
|
<p>
|
|
|
|
<strong>Cours concerné :</strong> <?php echo $question->getCourse()->getName(); ?><br><br>
|
|
|
|
<strong>Question posée :</strong> <?php echo $question->getQuestion(); ?><br><br>
|
|
|
|
<strong>Réponses valides exhaustives :</strong>
|
|
|
|
</p>
|
|
|
|
<?php
|
|
|
|
echo "<ul>";
|
|
|
|
foreach($question->getAnswer() as $a)
|
|
|
|
echo "<li>".$a."</li>";
|
|
|
|
echo "</ul>";
|
|
|
|
?>
|
|
|
|
<p>
|
|
|
|
Vous avez la possibilité de modifier votre question avant de la
|
|
|
|
faire valider.<br>
|
|
|
|
Faites vous plaisir.
|
|
|
|
</p>
|
2012-06-15 11:35:04 +00:00
|
|
|
</article>
|
2012-06-18 18:09:31 +00:00
|
|
|
<article>
|
|
|
|
<h2>Modifier la question ...</h2>
|
|
|
|
<form method="post" action="questions.php">
|
|
|
|
<input type="hidden" name="id" value=<?php echo $question->getId(); ?>>
|
|
|
|
<input type="hidden" name="email" value=<?php echo $question->get_writer()->getEmail(); ?>>
|
|
|
|
<label for="course">De quelle matière s'agit-il ?</label><br>
|
2012-06-15 11:35:04 +00:00
|
|
|
<select name="course" id="course">
|
2012-06-18 18:09:31 +00:00
|
|
|
<?php
|
|
|
|
include_once("Course.class.php");
|
|
|
|
$cs = Course::getCourses();
|
|
|
|
$qc = $question->getCourse();
|
|
|
|
|
|
|
|
foreach($cs as $c)
|
|
|
|
{
|
|
|
|
if ($qc->getId() == $c->getId())
|
|
|
|
print '<option selected="selected" value="'.$c->getId().'">'.$c->getName().'</option>';
|
|
|
|
else
|
|
|
|
print '<option value="'.$c->getId().'">'.$c->getName().'</option>';
|
|
|
|
}
|
2012-06-15 11:35:04 +00:00
|
|
|
|
2012-06-18 18:09:31 +00:00
|
|
|
?>
|
2012-06-15 11:35:04 +00:00
|
|
|
</select>
|
|
|
|
|
|
|
|
<p id="questionPart">
|
2012-06-18 18:09:31 +00:00
|
|
|
<label id="q" for="question">Quelle est votre question ? </label><br>
|
|
|
|
<textarea id="question" name="question" rows="3" cols="70"><?php echo nl2br(htmlentities($question->getQuestion())); ?></textarea>
|
2012-06-15 11:35:04 +00:00
|
|
|
</p>
|
|
|
|
<p id="answerList">
|
2012-06-18 18:09:31 +00:00
|
|
|
<label for="answer">Quelle est la réponse ?</label><br>
|
|
|
|
<?php
|
|
|
|
$max = 1;
|
|
|
|
foreach($question->getAnswer() as $k => $a)
|
|
|
|
{
|
|
|
|
echo '<input type="text" name="answer'.$k.'" value="'.$a.'">';
|
|
|
|
if ($max < $k)
|
|
|
|
$max = $k;
|
|
|
|
}
|
|
|
|
print '<script type="text/javascript">var nbAnswer = '.($max+1).';</script>';
|
|
|
|
?>
|
2012-06-15 11:35:04 +00:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<input type="button" value="Ajouter une réponse supplémentaire"
|
|
|
|
onclick="add()"/>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<input type="submit" name="send" value="Envoyer" />
|
|
|
|
</p>
|
2012-06-18 18:09:31 +00:00
|
|
|
</form>
|
|
|
|
</article>
|
|
|
|
<article>
|
|
|
|
<h2>... ou la confirmer telle quelle !</h2>
|
|
|
|
<p>
|
|
|
|
Si la question vous semble corect, vous pouvez directement
|
|
|
|
la confirmer ici :<br>
|
|
|
|
</p>
|
|
|
|
<form method="post"
|
|
|
|
class="validation"
|
|
|
|
action="confirmation.php">
|
|
|
|
<input type="hidden" name="id" value="<?php echo $question->getId() ?>">
|
|
|
|
<input type="submit" value="Je confirme">
|
|
|
|
</form>
|
|
|
|
<span style="clear: both; display: block;"></span>
|
|
|
|
</article>
|
2012-06-15 11:35:04 +00:00
|
|
|
</section>
|
2012-06-18 18:09:31 +00:00
|
|
|
<?php include('footer.html') ?>
|
|
|
|
</body>
|
2012-06-16 12:10:45 +00:00
|
|
|
</html>
|