diff attendees.inc.php @ 103:c6b9041078ec

Add hard limit option for attendees, and add feature of using "0" to disable hard and soft limit completely.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 21 Oct 2013 14:52:06 +0300
parents 76c3b89d7b11
children aeebfedb5709
line wrap: on
line diff
--- a/attendees.inc.php	Mon Oct 21 13:45:11 2013 +0300
+++ b/attendees.inc.php	Mon Oct 21 14:52:06 2013 +0300
@@ -1,5 +1,5 @@
 <?
-if (stChkSetting("allowRegister"))
+if (stCheckRegistrationAvailable())
 {
 ?>
 <div class="reglink">
@@ -8,15 +8,13 @@
 <?
 }
 
-//echo "<h1>Current attendees</h1>\n";
-$maxAttendees = stGetSetting("maxAttendees");
-$numAttendees = 0;
-if (($res = $db->query("SELECT COUNT(*) FROM attendees")) !== FALSE)
-  $numAttendees = $res->fetchColumn();
+echo "<p>Total of <b>".$numAttendees.
+ "</b> people registered to attend";
 
-echo "<p>Total of <b>".$numAttendees.
- "</b> people registered to attend (<b>".
- $maxAttendees."</b> max).</p>\n";
+if ($maxAttendeesHard > 0)
+ echo " (<b>".$maxAttendeesHard."</b> max)";
+
+echo ".</p>\n";
 
 ?>
 <table class="attendees">
@@ -33,7 +31,8 @@
 {
   foreach ($res as $item)
   {
-    stPrintAttendee($item, $row++, FALSE, ($index > $maxAttendees) ? " overbooked" : "");
+    $over = $maxAttendeesSoft > 0 && $index > $maxAttendeesSoft;
+    stPrintAttendee($item, $row++, FALSE, $over ? " overbooked" : "");
     $index--;
   }
 }