2 require 'include/head.inc';
3 require 'include/db.inc';
4 require 'include/common.inc';
6 if(isset($_POST['submit']) && $_POST['stime']!="" && $_POST['examples']!="") {
7 $db->query("INSERT INTO sessions (id,examples,nexamples) VALUES (" . strtotime(trim($_POST['stime'])) . ",'" . $_POST['examples'] . "','" . count(explode(',',$_POST['examples'])) . "')");
8 block("lightgreen", "added session");
11 if(isset($_GET['delete'])) {
12 $db->query("DELETE FROM sessions WHERE id=" . $_GET['delete']);
13 block("red", "deleted session");
16 require 'include/session.inc';
18 block("black", "add session");
21 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
24 <th align="left">Time:</th> <th><input type="text" name="stime"></th><th></th><th>(e.g. 10.9.2012 10:30)</th>
27 <th align="left">Examples:</th> <th><input type="text" name="examples"></th>
28 <th><input type="submit" name="submit" value="Add"></th><th>(e.g. 1a,1b,1c,2,3a,3b)</th>
34 if ( $SESSIONS_n == 0 ) {
35 block("red", "no sessions defined");
39 block("black", "session overview");
42 foreach ($SESSIONS as $session) {
44 print "<td>" . $session['id'] . " </td>";
45 print "<td>" . $session['timestr'] . " </td>";
46 print "<td>" . $session['examples'] . "(" . $session['nexamples'] . ")" . " </td>";
47 if ($session['workdone'] == 0) {
48 print "<td><a href='sessions.php?delete=" . $session['id'] . "'>delete</a></td>";
50 else { print "<td>locked</td>"; }