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)
|
public function setQuestion($question)
|
||||||
{
|
{
|
||||||
$this->question = $question;
|
if ($this->question != $question)
|
||||||
|
{
|
||||||
|
$this->question = $question;
|
||||||
|
$this->validated = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAnswer()
|
public function getAnswer()
|
||||||
|
@ -183,18 +187,22 @@ class Question
|
||||||
|
|
||||||
public function setAnswer($answers)
|
public function setAnswer($answers)
|
||||||
{
|
{
|
||||||
$this->answers = array();
|
if ($this->answers != $answers)
|
||||||
if (!empty($answers))
|
|
||||||
{
|
{
|
||||||
if (is_array($answers))
|
$this->answers = array();
|
||||||
{
|
$this->validated = false;
|
||||||
foreach ($answers as $ans)
|
|
||||||
$this->answers[] = $ans;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$this->answers[] = $answers;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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)',
|
function mail_utf8($to, $subject = '(No subject)',
|
||||||
|
|
|
@ -27,19 +27,26 @@
|
||||||
</a>
|
</a>
|
||||||
<h1>Nemubot Questions (BETA)</h1>
|
<h1>Nemubot Questions (BETA)</h1>
|
||||||
</header>
|
</header>
|
||||||
|
<section id="introduction">
|
||||||
|
<article>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include("Question.class.php");
|
include("Question.class.php");
|
||||||
include("QuestionsFile.class.php");
|
include("QuestionsFile.class.php");
|
||||||
|
|
||||||
$id = $_GET['id'];
|
@$id = $_GET['id'];
|
||||||
|
|
||||||
$fileQ = new QuestionsFile("questions.xml");
|
$fileQ = new QuestionsFile("questions.xml");
|
||||||
$question = $fileQ->get_question($id);
|
$question = $fileQ->get_question($id);
|
||||||
|
if (isset($question))
|
||||||
|
{
|
||||||
?>
|
?>
|
||||||
<section id="introduction">
|
<h2><?php
|
||||||
<article>
|
if ($question->isValidated())
|
||||||
<h2>Dernière chance pour changer d'avis</h2>
|
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>
|
<p>
|
||||||
<strong>Cours concerné :</strong> <?php echo $question->getCourse()->getName(); ?><br><br>
|
<strong>Cours concerné :</strong> <?php echo $question->getCourse()->getName(); ?><br><br>
|
||||||
<strong>Question posée :</strong> <?php echo $question->getQuestion(); ?><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>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</article>
|
</article>
|
||||||
|
<?php
|
||||||
|
if (!$question->isValidated())
|
||||||
|
{
|
||||||
|
?>
|
||||||
<article>
|
<article>
|
||||||
<h2>... ou la confirmer telle quelle !</h2>
|
<h2>... ou la confirmer telle quelle !</h2>
|
||||||
<p>
|
<p>
|
||||||
|
@ -120,6 +131,12 @@ print '<script type="text/javascript">var nbAnswer = '.($max+1).';</script>';
|
||||||
<input type="submit" value="Je confirme">
|
<input type="submit" value="Je confirme">
|
||||||
</form>
|
</form>
|
||||||
<span style="clear: both; display: block;"></span>
|
<span style="clear: both; display: block;"></span>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
header("Location: ./");
|
||||||
|
?>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
<?php include('footer.html') ?>
|
<?php include('footer.html') ?>
|
||||||
|
|
Reference in a new issue