Validation - Not complete

This commit is contained in:
Bertrand 2012-05-22 16:05:46 +02:00
parent fea020504c
commit 4c4d737f9a
4 changed files with 77 additions and 13 deletions

View File

@ -92,6 +92,16 @@ class Question
return $qnode; return $qnode;
} }
public function isValidated()
{
$this->validated = true;
}
public function getId()
{
return $this->id;
}
} }
?> ?>

View File

@ -5,7 +5,7 @@
<link rel="Stylesheet" href="style.css" /> <link rel="Stylesheet" href="style.css" />
<title>Every Questions</title> <title>Every Questions</title>
<script laguage="javascript"> <script language="javascript">
var nbAnswer = 1; var nbAnswer = 1;
function add() function add()
{ {

View File

@ -5,6 +5,26 @@
</head> </head>
<body> <body>
<article id="validate">
<h2>Merci de votre participation!</h2>
<p>
Votre question a bien été ajoutée à la liste.<br/>
Elle doit maintenant être confirmée. Un email a été envoyé
à l'un des membres du chan pour qu'il valide votre question.
</p>
<p>
Vous pouvez proposer de nouvelles questions en cliquant
sur le lien ci-dessous.<br/>
<a href="index.html">Proposer une nouvelle question</a>
</p>
</article>
<p>
<h3>La partie ci dessous est uniquement réservée au debug</h3>
Merci de ne pas en tenir compte
</p>
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
@ -44,25 +64,31 @@ if (isset ($_POST['send']))
$file->add_question($quest); $file->add_question($quest);
$file->save(); $file->save();
echo "<br/>";
echo "<br/> C'est ici pour valider";
echo "<br/>"
. "http://178.170.101.82/~Cccompany/nemubot_askweb/validation.php?id="
. $quest->getId();
// @TODO: Find a validator (from the list of previous senders for example?) // @TODO: Find a validator (from the list of previous senders for example?)
// @TODO: Update the question and save the file // @TODO: Update the question and save the file
// @TODO: Send mail to the selected validator // @TODO: Send mail to the selected validator
/* This code works, perhaps should be placed in a method in Question class?*/ /* This code works, perhaps should be placed in a method in Question class?
$to = "bertrand.cournaud@gmail.com"; $to = "bertrand.cournaud@gmail.com";
$subject = "[Nemubot] Validation d'une question"; $subject = "[Nemubot] Validation d'une question";
$headers = "From: Nemubot <bot@nemunai.re>"; $headers = "From: Nemubot <bot@nemunai.re>";
$message = "Bonjour,\n"; $message = "Bonjour,\n";
if (mail($to, $subject, $message, $headers)) if (mail($to, $subject, $message, $headers))
{ {
echo ("Email sent"); echo ("Email sent");
} }
else else
echo ("Error with the email"); echo ("Error with the email");
/* //*/ //*/
} }
} }
else else

28
validation.php Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
</head>
<body>
<h1>Validation de la question</h1>
Vous pouvez valider la question. Cliquez simplement sur le
lien ci dessous.<br/>
<input type="button" value="Valider la question"
onclick="validate()"/>
<?php
include("Question.class.php");
include("QuestionsFile.class.php");
$id = $_GET['id'];
$file = new QuestionsFile('questions.xml');
$questions = $file->get_question($id);
$question->print_test();
?>
</body>
</html>