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