Add a page to report questions
This commit is contained in:
parent
e554ed3a66
commit
63e14532f8
@ -11,6 +11,7 @@ class Question
|
|||||||
private $answers = array();
|
private $answers = array();
|
||||||
private $added_time;
|
private $added_time;
|
||||||
private $validated = false;
|
private $validated = false;
|
||||||
|
private $reported = false;
|
||||||
private $validator = "";
|
private $validator = "";
|
||||||
private $writer = "";
|
private $writer = "";
|
||||||
|
|
||||||
@ -22,6 +23,8 @@ class Question
|
|||||||
$this->added_time = $node->getAttribute("addedtime");
|
$this->added_time = $node->getAttribute("addedtime");
|
||||||
if (intval($node->getAttribute("validated")))
|
if (intval($node->getAttribute("validated")))
|
||||||
$this->validated = true;
|
$this->validated = true;
|
||||||
|
if (intval($node->getAttribute("reported")))
|
||||||
|
$this->reported = true;
|
||||||
$this->validator = $node->getAttribute("validator");
|
$this->validator = $node->getAttribute("validator");
|
||||||
$this->writer = $node->getAttribute("writer");
|
$this->writer = $node->getAttribute("writer");
|
||||||
$this->question = $node->getAttribute("question");
|
$this->question = $node->getAttribute("question");
|
||||||
@ -101,6 +104,7 @@ class Question
|
|||||||
|
|
||||||
$qnode->setAttribute("xml:id", $this->id);
|
$qnode->setAttribute("xml:id", $this->id);
|
||||||
$qnode->setAttribute("addedtime", $this->added_time);
|
$qnode->setAttribute("addedtime", $this->added_time);
|
||||||
|
$qnode->setAttribute("reported", intval($this->reported));
|
||||||
$qnode->setAttribute("validated", intval($this->validated));
|
$qnode->setAttribute("validated", intval($this->validated));
|
||||||
$qnode->setAttribute("validator", $this->validator);
|
$qnode->setAttribute("validator", $this->validator);
|
||||||
$qnode->setAttribute("writer", $this->writer);
|
$qnode->setAttribute("writer", $this->writer);
|
||||||
@ -126,6 +130,16 @@ class Question
|
|||||||
return $this->added_time;
|
return $this->added_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getReportId()
|
||||||
|
{
|
||||||
|
return md5($this->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setReported($reported = true)
|
||||||
|
{
|
||||||
|
$this->reported = $reported;
|
||||||
|
}
|
||||||
|
|
||||||
public function getId()
|
public function getId()
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
40
report.php
Normal file
40
report.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php include("header.html") ?>
|
||||||
|
<section id="introduction">
|
||||||
|
<article id="report">
|
||||||
|
<h2><?php
|
||||||
|
include("Question.class.php");
|
||||||
|
include("QuestionsFile.class.php");
|
||||||
|
|
||||||
|
if (isset($_POST['id']))
|
||||||
|
{
|
||||||
|
$id = $_POST['id'];
|
||||||
|
$file = new QuestionsFile("questions.xml");
|
||||||
|
foreach($file->get_questions() as $q)
|
||||||
|
{
|
||||||
|
if ($q->getReportId() == $id)
|
||||||
|
{
|
||||||
|
$q->setReported();
|
||||||
|
$id = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($id))
|
||||||
|
echo 'La question n\'a pas été trouvée';
|
||||||
|
else
|
||||||
|
echo 'La question a été rapporté avec succès';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
header("Location: ./");
|
||||||
|
?></h2>
|
||||||
|
<p>
|
||||||
|
Nemubot vous remercie de l'aider à améliorer la qualité de sa base de données.<br><br>
|
||||||
|
Vous pouvez vous aussi poser des questions à <a href="./" >cette adresse</a>,
|
||||||
|
où bien simplement essayer de répondre aux questions déjà posées en tapant
|
||||||
|
<code>!qcm</code> sur un cannal où nemubot est présent.<br><br>
|
||||||
|
|
||||||
|
<span style="text-decoration:line-through;">Amusez-vous</span> Révisez bien !
|
||||||
|
</p>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user