Can change a validated question
This commit is contained in:
parent
42fec70edf
commit
30c06c08e8
2 changed files with 40 additions and 15 deletions
|
@ -160,7 +160,11 @@ class Question
|
|||
|
||||
public function setQuestion($question)
|
||||
{
|
||||
$this->question = $question;
|
||||
if ($this->question != $question)
|
||||
{
|
||||
$this->question = $question;
|
||||
$this->validated = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAnswer()
|
||||
|
@ -183,18 +187,22 @@ class Question
|
|||
|
||||
public function setAnswer($answers)
|
||||
{
|
||||
$this->answers = array();
|
||||
if (!empty($answers))
|
||||
if ($this->answers != $answers)
|
||||
{
|
||||
if (is_array($answers))
|
||||
{
|
||||
foreach ($answers as $ans)
|
||||
$this->answers[] = $ans;
|
||||
}
|
||||
else
|
||||
$this->answers[] = $answers;
|
||||
}
|
||||
$this->answers = array();
|
||||
$this->validated = false;
|
||||
|
||||
if (!empty($answers))
|
||||
{
|
||||
if (is_array($answers))
|
||||
{
|
||||
foreach ($answers as $ans)
|
||||
$this->answers[] = $ans;
|
||||
}
|
||||
else
|
||||
$this->answers[] = $answers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mail_utf8($to, $subject = '(No subject)',
|
||||
|
|
|
@ -27,19 +27,26 @@
|
|||
</a>
|
||||
<h1>Nemubot Questions (BETA)</h1>
|
||||
</header>
|
||||
<section id="introduction">
|
||||
<article>
|
||||
<?php
|
||||
|
||||
include("Question.class.php");
|
||||
include("QuestionsFile.class.php");
|
||||
|
||||
$id = $_GET['id'];
|
||||
@$id = $_GET['id'];
|
||||
|
||||
$fileQ = new QuestionsFile("questions.xml");
|
||||
$question = $fileQ->get_question($id);
|
||||
if (isset($question))
|
||||
{
|
||||
?>
|
||||
<section id="introduction">
|
||||
<article>
|
||||
<h2>Dernière chance pour changer d'avis</h2>
|
||||
<h2><?php
|
||||
if ($question->isValidated())
|
||||
echo "Cette question a déjà été validée ; si vous la modifiez, elle devra être de nouveau validée";
|
||||
else
|
||||
echo"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>
|
||||
|
@ -107,6 +114,10 @@ print '<script type="text/javascript">var nbAnswer = '.($max+1).';</script>';
|
|||
</p>
|
||||
</form>
|
||||
</article>
|
||||
<?php
|
||||
if (!$question->isValidated())
|
||||
{
|
||||
?>
|
||||
<article>
|
||||
<h2>... ou la confirmer telle quelle !</h2>
|
||||
<p>
|
||||
|
@ -120,6 +131,12 @@ print '<script type="text/javascript">var nbAnswer = '.($max+1).';</script>';
|
|||
<input type="submit" value="Je confirme">
|
||||
</form>
|
||||
<span style="clear: both; display: block;"></span>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
header("Location: ./");
|
||||
?>
|
||||
</article>
|
||||
</section>
|
||||
<?php include('footer.html') ?>
|
||||
|
|
Reference in a new issue