2 $result=$db->query("SELECT id,examples,nexamples FROM sessions ORDER BY id");
6 while ($session = $result->fetch(PDO::FETCH_ASSOC)) {
7 $SESSIONS[$session['id']] = array("id" => $session['id'], "timestr" => date("d.m.Y H:i", $session['id']),
8 "workdone" => $db->query("SELECT COUNT(*) FROM workdone WHERE session=" . $session['id'])->fetch(PDO::FETCH_NUM)[0],
9 "examples" => $session['examples'], "nexamples" => $session['nexamples']);
10 if ( strtotime("now") < $session['id'] && ( $SESSIONS_next==-1 || $SESSIONS_next > $session['id'] ) ) {
11 $SESSIONS_next = $session['id'];
13 if ( strtotime("now") < $session['id'] + 3600 && ( $SESSIONS_actual==-1 || $SESSIONS_actual > $session['id'] ) ) {
14 $SESSIONS_actual = $session['id'];
17 if($SESSIONS_next == -1) unset($SESSIONS_next);
20 foreach ($SESSIONS as $session) {
21 if($session['id'] < $SESSIONS_next) { $SESSIONS_totex += $session['nexamples']; }
24 $SESSIONS_totex_nextinc = 0;
25 foreach ($SESSIONS as $session) {
26 if($session['id'] <= $SESSIONS_next) { $SESSIONS_totex_nextinc += $session['nexamples']; }