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'])) { ...@@ -33,9 +33,9 @@ if (isset($_GET['mode'])) {
} }
else { else {
/** Subscription and unsubscription management **/ /** Subscription and unsubscription management **/
if (isset($_GET['api']) && $admin->isActive()) { if (isset($_GET['api'])) {
if (isset($_GET['action'])) { if (isset($_GET['action'])) {
if ($_GET['action']=='sub') { if ($_GET['action']=='sub' && $admin->isActive()) {
$db->subToApi($admin, $_SESSION['utclogin'], $_GET['api']); $db->subToApi($admin, $_SESSION['utclogin'], $_GET['api']);
} }
elseif ($_GET['action']=='unsub') { elseif ($_GET['action']=='unsub') {
......
...@@ -104,7 +104,11 @@ class DB { ...@@ -104,7 +104,11 @@ class DB {
return $res; 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() { public function config() {
$sql = 'SELECT * FROM vconfig'; $sql = 'SELECT * FROM vconfig';
$st = $this->conn->prepare($sql); $st = $this->conn->prepare($sql);
......
...@@ -75,7 +75,6 @@ class Views { ...@@ -75,7 +75,6 @@ class Views {
} }
public function printSubList($list) { public function printSubList($list) {
#KNOWN_BUB #TODO Il est possible de ses déinscrire en utilisant directement l'URL
if ($list) { if ($list) {
echo '<hr/>'; echo '<hr/>';
echo '<h2>Vos inscriptions</h2>'; echo '<h2>Vos inscriptions</h2>';
...@@ -86,13 +85,21 @@ class Views { ...@@ -86,13 +85,21 @@ class Views {
echo "<h3>".$this->printWeek($row)."</h3>"; echo "<h3>".$this->printWeek($row)."</h3>";
} }
echo '<p>'; echo '<p>';
if ($this->isActive()) { // If student has been validated
if ($row['validation']) { if ($row['validation']) {
echo "<span class='validation'>[validé]</span> "; echo "<span class='validation'>[validé]</span> ";
}
else {
// 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 { else {
echo "<a href='index.php?action=unsub&api=$row[id]' class='unsub'>[désinscription]</a> "; 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 $this->printApi($row);
echo '</p>'; 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