Commit b08d6d61 authored by Stephane Crozat's avatar Stephane Crozat
Browse files

fix #30 (partially)

parent 25931590
......@@ -33,9 +33,9 @@ if (isset($_GET['mode'])) {
}
else {
/** Subscription and unsubscription management **/
if (isset($_GET['api']) && $admin->isActive()) {
if (isset($_GET['api'])) {
if (isset($_GET['action'])) {
if ($_GET['action']=='sub') {
if ($_GET['action']=='sub' && $admin->isActive()) {
$db->subToApi($admin, $_SESSION['utclogin'], $_GET['api']);
}
elseif ($_GET['action']=='unsub') {
......
......@@ -104,7 +104,11 @@ class DB {
return $res;
}
/** Returns T is subscriptions and unsubscription are allowed **/
/** Returns configuration parameters as:
** openbegin | openend | isactive
** ------------------------+--------------------------+----------
** mercredi 10 avril 2019 | mercredi 31 juillet 2019 | t
**/
public function config() {
$sql = 'SELECT * FROM vconfig';
$st = $this->conn->prepare($sql);
......
......@@ -75,7 +75,6 @@ class Views {
}
public function printSubList($list) {
#KNOWN_BUB #TODO Il est possible de ses déinscrire en utilisant directement l'URL
if ($list) {
echo '<hr/>';
echo '<h2>Vos inscriptions</h2>';
......@@ -86,13 +85,21 @@ class Views {
echo "<h3>".$this->printWeek($row)."</h3>";
}
echo '<p>';
if ($this->isActive()) {
// If student has been validated
if ($row['validation']) {
echo "<span class='validation'>[validé]</span> ";
}
else {
echo "<a href='index.php?action=unsub&api=$row[id]' class='unsub'>[désinscription]</a> ";
// If it has not been validated and subscription are still opened
if ($this->isActive()) {
$msg = 'désinscription';
}
// If it has not been validated and subscription are closed
else {
echo "<span class='validation'>[liste d'attente]</span> ";
$msg = 'annulation';
}
echo "<a href='index.php?action=unsub&api=$row[id]' class='unsub'>[$msg]</a> ";
}
echo $this->printApi($row);
echo '</p>';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment