block("lightgreen", "added session");
}
- if($_GET['delete']!="") {
+ if(isset($_GET['delete'])) {
$db->query("DELETE FROM sessions WHERE id=" . $_GET['delete']);
block("red", "deleted session");
}
</form>
<?php
+ if ( $SESSIONS_n == 0 ) {
+ block("red", "no sessions defined");
+ exit;
+ }
+
block("black", "session overview");
print "<table>";
<?php
include 'prefs.inc';
- $lec_lines = file('var/lecture.txt');
-
- foreach ($lec_lines as $line_num => $line) {
- $lecture[$line_num] = $line;
- }
-
print "<table>";
print "<tr><th align=\"left\">Banana Exercise Management</th><tr>";
print "<tr><th bgcolor=blue><font color=white> " . $PREFS['exname'] . ", Gruppe: " . $PREFS['groupname'] . " </font></th></tr>";
$result=$db->query("SELECT id,examples,nexamples FROM sessions ORDER BY id");
$SESSIONS_next = -1;
$SESSIONS_actual = -1;
+ $SESSIONS_n = 0;
while ($session = $result->fetch(PDO::FETCH_ASSOC)) {
$SESSIONS[$session['id']] = array("id" => $session['id'], "timestr" => date("d.m.Y H:i", $session['id']),
if ( strtotime("now") < $session['id'] + 3600 && ( $SESSIONS_actual==-1 || $SESSIONS_actual > $session['id'] ) ) {
$SESSIONS_actual = $session['id'];
}
+ $SESSIONS_n++;
}
if($SESSIONS_next == -1) unset($SESSIONS_next);
if($SESSIONS_actual == -1) unset($SESSIONS_actual);
$SESSIONS_totex = 0;
- foreach ($SESSIONS as $session) {
- if($session['id'] < $SESSIONS_next) { $SESSIONS_totex += $session['nexamples']; }
+ if(isset($SESSIONS)) {
+ foreach ($SESSIONS as $session) {
+ if($session['id'] < $SESSIONS_next) { $SESSIONS_totex += $session['nexamples']; }
+ }
}
$SESSIONS_totex_nextinc = 0;
- foreach ($SESSIONS as $session) {
- if($session['id'] <= $SESSIONS_next) { $SESSIONS_totex_nextinc += $session['nexamples']; }
+ if( isset($SESSIONS) && isset($SESSIONS_next) ) {
+ foreach ($SESSIONS as $session) {
+ if($session['id'] <= $SESSIONS_next) { $SESSIONS_totex_nextinc += $session['nexamples']; }
+ }
}
}
?>