Can now filter the questions list
This commit is contained in:
parent
38fa401b19
commit
e554ed3a66
3 changed files with 21 additions and 1 deletions
11
list.php
11
list.php
|
|
@ -5,6 +5,8 @@ session_start();
|
|||
|
||||
require_once("QuestionsFile.class.php");
|
||||
|
||||
@$filter = $_GET["filter"];
|
||||
|
||||
if (!empty($_SESSION["connected"]) && !empty($_POST["id"]))
|
||||
{
|
||||
$file = new QuestionsFile("questions.xml");
|
||||
|
|
@ -22,6 +24,10 @@ else
|
|||
?>
|
||||
<section id="introduction" style="margin: auto -15%;">
|
||||
<article id="menu">.:
|
||||
<form method="get" action="?" style="float: right;">
|
||||
<?php if (isset($_GET["valid"])) echo '<input type="hidden" name="valid">'; ?>
|
||||
<label for="filter">Filter par code de cours :</label> <input type="text" id="filter" name="filter" value="<?php echo $filter; ?>"> <input type="submit" value="Filtrer">
|
||||
</form>
|
||||
<a href="?">Liste des questions non-validées</a> ::
|
||||
<a href="?valid">Liste des questions validées</a> :.
|
||||
</article>
|
||||
|
|
@ -30,6 +36,7 @@ else
|
|||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cours</th>
|
||||
<th>Question</th>
|
||||
<th>Auteur</th>
|
||||
<th>Soumission</th>
|
||||
|
|
@ -55,10 +62,14 @@ foreach($file->get_questions() as $q)
|
|||
if (!$q->isValidated())
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($filter) && $q->getCourse()->getCode() != $filter)
|
||||
continue;
|
||||
|
||||
$id = $q->getId();
|
||||
?>
|
||||
<tr>
|
||||
<td><acronym title="<?php echo $q->getCourse()->getName(); ?>"><?php echo $q->getCourse()->getCode(); ?></acronym></td>
|
||||
<td><?php echo $q->getQuestion(); ?></td>
|
||||
<td><?php if ($q->get_writer() != null) echo $q->get_writer()->getUsername(); ?></td>
|
||||
<td><?php echo strftime("%d/%m/%y %H:%M", $q->getAddedTime()); ?></td>
|
||||
|
|
|
|||
Reference in a new issue