2008-02-22 20:09:23 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2008-06-26 20:53:51 +00:00
|
|
|
|
|
|
|
// actions:
|
|
|
|
// (none)
|
|
|
|
// if have a snapshot, show start/end
|
|
|
|
// show form to get new snapshot
|
|
|
|
// snap_action
|
|
|
|
// make new snapshot and go to...
|
|
|
|
// map
|
|
|
|
// show a map;
|
|
|
|
// show form to set or change filter or breakdown
|
2008-06-27 23:15:57 +00:00
|
|
|
//
|
|
|
|
// columns:
|
|
|
|
// name
|
|
|
|
// type
|
|
|
|
// breakdown category (if using breakdown)
|
|
|
|
// nviews (as number)
|
|
|
|
// outcome (as color-coded bar graph: green=next, yellow=back, red=none)
|
|
|
|
// time (bar graph of log(t))
|
|
|
|
// score (bar graph)
|
|
|
|
//
|
|
|
|
// what's shown:
|
|
|
|
// lessons: nviews, outcome, time
|
|
|
|
// exercise: nviews, outcome, time, score
|
|
|
|
// exercise answer: nviews, outcome, time
|
|
|
|
// exercise set: score
|
|
|
|
//
|
|
|
|
// When breakdown is used, each of above has N lines
|
|
|
|
// Total, followed by each breakdown category
|
2008-06-27 18:59:33 +00:00
|
|
|
|
2008-11-01 03:07:44 +00:00
|
|
|
require_once("../inc/bolt_util_ops.inc");
|
2008-02-22 20:09:23 +00:00
|
|
|
require_once("../inc/bolt_db.inc");
|
2008-06-26 20:53:51 +00:00
|
|
|
require_once("../inc/bolt_cat.inc");
|
2008-02-22 20:09:23 +00:00
|
|
|
require_once("../inc/bolt.inc");
|
2008-10-30 22:58:33 +00:00
|
|
|
require_once("../inc/bolt_snap.inc");
|
2009-09-15 18:14:37 +00:00
|
|
|
require_once("../inc/util_ops.inc");
|
2008-02-22 20:09:23 +00:00
|
|
|
|
2008-06-27 23:15:57 +00:00
|
|
|
// the following are to minimize argument passing
|
|
|
|
|
|
|
|
$snap = null;
|
|
|
|
$course_id = 0;
|
|
|
|
$top_unit = null;
|
|
|
|
$filter = null;
|
|
|
|
$filter_cat = null;
|
|
|
|
$breakdown = null;
|
|
|
|
$breakdown_cat = null;
|
|
|
|
|
2008-06-26 20:53:51 +00:00
|
|
|
function show_snap_form() {
|
|
|
|
global $course_id;
|
2008-06-27 23:15:57 +00:00
|
|
|
|
2008-11-01 03:07:44 +00:00
|
|
|
admin_page_head("Data snapshot");
|
2008-06-26 20:53:51 +00:00
|
|
|
$s = read_map_snapshot($course_id);
|
|
|
|
|
|
|
|
if ($s) {
|
|
|
|
$end = date_str($s->time);
|
|
|
|
echo "
|
|
|
|
A data snapshot exists for the $s->dur days prior to $end.
|
|
|
|
";
|
|
|
|
show_button(
|
|
|
|
"bolt_map.php?action=map&course_id=$course_id",
|
|
|
|
"Use this snapshot",
|
|
|
|
"Use this snapshot"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
echo "There is currently no snapshot.";
|
2008-02-22 20:09:23 +00:00
|
|
|
}
|
2008-06-26 20:53:51 +00:00
|
|
|
echo "
|
|
|
|
<form action=bolt_map.php>
|
|
|
|
<input type=hidden name=action value=snap_action>
|
|
|
|
<input type=hidden name=course_id value=$course_id>
|
|
|
|
Create a new snapshot using data from the last
|
2008-08-15 22:07:24 +00:00
|
|
|
<input name=dur value=7> days.
|
2008-06-26 20:53:51 +00:00
|
|
|
<input type=submit value=OK>
|
|
|
|
</form>
|
|
|
|
";
|
2008-11-01 03:07:44 +00:00
|
|
|
admin_page_tail();
|
2008-02-22 20:09:23 +00:00
|
|
|
}
|
|
|
|
|
2008-06-26 20:53:51 +00:00
|
|
|
function snap_action() {
|
2008-06-26 23:24:43 +00:00
|
|
|
global $course_id;
|
|
|
|
global $top_unit;
|
2008-06-26 20:53:51 +00:00
|
|
|
|
2008-06-26 23:24:43 +00:00
|
|
|
$dur = get_int('dur');
|
|
|
|
$s = write_map_snapshot($course_id, $dur);
|
|
|
|
show_map();
|
2008-02-22 20:09:23 +00:00
|
|
|
}
|
|
|
|
|
2008-06-27 18:59:33 +00:00
|
|
|
function spaces($level) {
|
2008-06-27 23:15:57 +00:00
|
|
|
$x = "";
|
|
|
|
for ($i=0; $i<$level; $i++) {
|
2008-07-01 20:33:39 +00:00
|
|
|
$x .= " ";
|
2008-06-27 18:59:33 +00:00
|
|
|
}
|
2008-06-27 23:15:57 +00:00
|
|
|
return $x;
|
2008-06-27 18:59:33 +00:00
|
|
|
}
|
|
|
|
|
2008-10-30 22:58:33 +00:00
|
|
|
// filter arrays of anything that has a user_id field
|
|
|
|
// (view, xset_result, question)
|
2008-06-27 23:15:57 +00:00
|
|
|
//
|
|
|
|
function filter_array($array) {
|
|
|
|
global $snap, $filter, $filter_cat, $breakdown, $breakdown_cat;
|
|
|
|
|
2008-06-30 16:46:05 +00:00
|
|
|
if (!$filter && !$breakdown) return $array;
|
2008-06-27 18:59:33 +00:00
|
|
|
$x = array();
|
|
|
|
foreach ($array as $y) {
|
2008-06-30 16:46:05 +00:00
|
|
|
if (!array_key_exists($y->user_id, $snap->users)) continue;
|
2008-06-27 18:59:33 +00:00
|
|
|
$u = $snap->users[$y->user_id];
|
2008-06-30 16:46:05 +00:00
|
|
|
if ($filter && $filter->categorize($u) != $filter_cat) {
|
2008-06-27 23:15:57 +00:00
|
|
|
continue;
|
2008-06-27 18:59:33 +00:00
|
|
|
}
|
2008-06-27 23:15:57 +00:00
|
|
|
if ($breakdown && $breakdown_cat) {
|
2008-06-30 16:46:05 +00:00
|
|
|
if ($breakdown->categorize($u) != $breakdown_cat) {
|
2008-06-27 23:15:57 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$x[] = $y;
|
2008-06-27 18:59:33 +00:00
|
|
|
}
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
|
|
|
function avg_score($array) {
|
|
|
|
$sum = 0;
|
2008-06-27 23:15:57 +00:00
|
|
|
$n = count($array);
|
|
|
|
if ($n ==0) return 0;
|
2008-06-27 18:59:33 +00:00
|
|
|
foreach ($array as $a) {
|
|
|
|
$sum += $a->score;
|
|
|
|
}
|
|
|
|
return $sum/count($array);
|
|
|
|
}
|
|
|
|
|
2008-06-27 23:15:57 +00:00
|
|
|
function avg_time($views) {
|
|
|
|
$sum = 0;
|
|
|
|
$n = 0;
|
|
|
|
foreach ($views as $v) {
|
|
|
|
if ($v->start_time && $v->end_time) {
|
|
|
|
$sum += $v->end_time - $v->start_time;
|
|
|
|
$n++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($n ==0) return 0;
|
|
|
|
return $sum/$n;
|
|
|
|
}
|
|
|
|
|
|
|
|
function outcomes($views) {
|
|
|
|
$x = array();
|
|
|
|
$x[0] = 0;
|
|
|
|
$x[1] = 0;
|
|
|
|
$x[2] = 0;
|
|
|
|
|
|
|
|
foreach ($views as $v) {
|
|
|
|
switch ($v->action) {
|
|
|
|
case BOLT_ACTION_NONE: $x[0]++; break;
|
|
|
|
case BOLT_ACTION_NEXT: $x[1]++; break;
|
2008-08-15 22:07:24 +00:00
|
|
|
case BOLT_ACTION_SUBMIT: $x[1]++; break;
|
2008-06-27 23:15:57 +00:00
|
|
|
default: $x[2]++; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
2008-10-30 22:58:33 +00:00
|
|
|
function get_nquestions($unit, $mode) {
|
|
|
|
global $snap;
|
|
|
|
|
|
|
|
if (array_key_exists($unit->name, $snap->questions)) {
|
|
|
|
$a = filter_array($snap->questions[$unit->name]);
|
|
|
|
$n = 0;
|
|
|
|
foreach ($a as $q) {
|
|
|
|
if ($q->mode == $mode) $n++;
|
|
|
|
}
|
|
|
|
return $n;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-27 23:15:57 +00:00
|
|
|
function get_views($unit, $mode) {
|
|
|
|
global $snap;
|
|
|
|
|
|
|
|
$y = array();
|
|
|
|
if (array_key_exists($unit->name, $snap->views)) {
|
|
|
|
$a = filter_array($snap->views[$unit->name]);
|
|
|
|
foreach ($a as $x) {
|
|
|
|
if ($x->mode == $mode) $y[] = $x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $y;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_results($unit) {
|
|
|
|
global $snap;
|
|
|
|
|
|
|
|
if (array_key_exists($unit->name, $snap->results)) {
|
|
|
|
return filter_array($snap->results[$unit->name]);
|
|
|
|
}
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_xset_results($unit) {
|
|
|
|
global $snap;
|
|
|
|
|
|
|
|
if (array_key_exists($unit->name, $snap->xset_results)) {
|
|
|
|
return filter_array($snap->xset_results[$unit->name]);
|
|
|
|
}
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2008-07-01 20:33:39 +00:00
|
|
|
function class_name($class) {
|
|
|
|
switch ($class) {
|
|
|
|
case "BoltSequence": return "sequence";
|
|
|
|
case "BoltSelect": return "select";
|
|
|
|
case "BoltLesson": return "lesson";
|
|
|
|
case "BoltExercise": return "exercise";
|
|
|
|
case "BoltExerciseSet": return "exercise set";
|
|
|
|
case "BoltRandom": return "random";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-15 22:07:24 +00:00
|
|
|
$rownum = 0;
|
|
|
|
|
2008-06-27 23:15:57 +00:00
|
|
|
function show_unit_row($unit, $class, $level, $is_answer) {
|
|
|
|
global $breakdown, $breakdown_cat;
|
2008-10-30 22:58:33 +00:00
|
|
|
global $rownum, $course_id;
|
2008-06-27 23:15:57 +00:00
|
|
|
|
|
|
|
$a = $is_answer?" (answer)":"";
|
2008-08-15 22:07:24 +00:00
|
|
|
$j = ($rownum++)%2;
|
|
|
|
echo "<tr class=row$j>";
|
2008-06-30 16:46:05 +00:00
|
|
|
if ($breakdown && $breakdown_cat) {
|
|
|
|
echo "
|
|
|
|
<td><br></td>
|
|
|
|
<td><br></td>
|
|
|
|
";
|
|
|
|
} else {
|
2008-07-01 20:33:39 +00:00
|
|
|
$c = class_name($class);
|
2008-06-30 16:46:05 +00:00
|
|
|
echo "
|
2008-07-01 20:33:39 +00:00
|
|
|
<td><b>".spaces($level)."$unit->name</b></td>
|
|
|
|
<td>$c $a</td>
|
2008-06-30 16:46:05 +00:00
|
|
|
";
|
|
|
|
}
|
2008-06-27 23:15:57 +00:00
|
|
|
if ($breakdown) {
|
|
|
|
if ($breakdown_cat) {
|
|
|
|
echo "<td>$breakdown_cat</td>\n";
|
2008-06-26 23:24:43 +00:00
|
|
|
} else {
|
2008-06-27 23:15:57 +00:00
|
|
|
echo "<td>Total</td>\n";
|
2008-06-26 23:24:43 +00:00
|
|
|
}
|
2008-06-27 23:15:57 +00:00
|
|
|
}
|
|
|
|
switch ($class) {
|
|
|
|
case "BoltLesson":
|
2008-10-30 22:58:33 +00:00
|
|
|
$mode = BOLT_MODE_LESSON;
|
|
|
|
$views = get_views($unit, $mode);
|
2008-06-27 23:15:57 +00:00
|
|
|
$n = count($views);
|
|
|
|
$out = outcomes($views);
|
|
|
|
$t = avg_time($views);
|
2008-06-27 18:59:33 +00:00
|
|
|
echo "<td>$n</td>";
|
2008-10-30 22:58:33 +00:00
|
|
|
$n = get_nquestions($unit, $mode);
|
|
|
|
if ($n) {
|
2008-11-03 03:06:29 +00:00
|
|
|
echo "<td><a href=bolt_map.php?action=questions&course_id=$course_id&name=$unit->name&mode=$mode".filter_url().">$n</a></td>\n";
|
2008-10-30 22:58:33 +00:00
|
|
|
} else {
|
|
|
|
echo "<td>0</td>\n";
|
|
|
|
}
|
|
|
|
|
2008-06-30 16:46:05 +00:00
|
|
|
echo outcome_graph($out, 200);
|
2008-06-27 23:15:57 +00:00
|
|
|
echo empty_cell();
|
2008-07-01 20:33:39 +00:00
|
|
|
echo time_graph($t, 200);
|
2008-06-27 23:15:57 +00:00
|
|
|
break;
|
|
|
|
case "BoltExercise":
|
2008-10-30 22:58:33 +00:00
|
|
|
$mode = $is_answer?BOLT_MODE_ANSWER:BOLT_MODE_SHOW;
|
|
|
|
$views = get_views($unit, $mode);
|
2008-06-27 23:15:57 +00:00
|
|
|
$n = count($views);
|
|
|
|
$out = outcomes($views);
|
|
|
|
$t = avg_time($views);
|
|
|
|
echo "<td>$n</td>";
|
2008-10-30 22:58:33 +00:00
|
|
|
$n = get_nquestions($unit, $mode);
|
|
|
|
if ($n) {
|
|
|
|
echo "<td><a href=bolt_map.php?action=questions&course_id=$course_id&name=$unit->name&mode=$mode>$n</a></td>\n";
|
|
|
|
} else {
|
|
|
|
echo "<td>0</td>\n";
|
|
|
|
}
|
2008-06-30 16:46:05 +00:00
|
|
|
echo outcome_graph($out, 200);
|
2008-07-01 20:33:39 +00:00
|
|
|
if ($is_answer) {
|
|
|
|
echo empty_cell();
|
|
|
|
} else {
|
|
|
|
$results = get_results($unit);
|
|
|
|
$score = avg_score($results);
|
|
|
|
echo score_graph($score, 200);
|
|
|
|
}
|
2008-06-30 16:46:05 +00:00
|
|
|
echo time_graph($t, 200);
|
2008-06-27 23:15:57 +00:00
|
|
|
break;
|
|
|
|
case "BoltExerciseSet":
|
|
|
|
$xr = get_xset_results($unit);
|
2008-07-01 20:33:39 +00:00
|
|
|
$n = count($xr);
|
|
|
|
echo "<td>$n</td>";
|
|
|
|
echo empty_cell();
|
2008-10-30 22:58:33 +00:00
|
|
|
echo empty_cell();
|
2008-06-27 23:15:57 +00:00
|
|
|
$score = avg_score($xr);
|
2008-06-30 16:46:05 +00:00
|
|
|
echo score_graph($score, 200);
|
2008-07-01 20:33:39 +00:00
|
|
|
echo empty_cell();
|
2008-06-27 23:15:57 +00:00
|
|
|
break;
|
|
|
|
default:
|
2008-08-15 22:07:24 +00:00
|
|
|
echo empty_cell();
|
|
|
|
echo empty_cell();
|
|
|
|
echo empty_cell();
|
|
|
|
echo empty_cell();
|
2008-10-30 22:58:33 +00:00
|
|
|
echo empty_cell();
|
2008-06-26 23:24:43 +00:00
|
|
|
}
|
2008-06-27 23:15:57 +00:00
|
|
|
echo "</tr>\n";
|
|
|
|
}
|
|
|
|
|
2008-07-01 20:33:39 +00:00
|
|
|
function breakdown_class($class) {
|
|
|
|
switch ($class) {
|
|
|
|
case "BoltLesson":
|
|
|
|
case "BoltExercise":
|
|
|
|
case "BoltExerciseSet":
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-06-27 23:15:57 +00:00
|
|
|
function show_unit($unit, $level) {
|
|
|
|
global $snap, $filter, $filter_cat, $breakdown, $breakdown_cat;
|
|
|
|
|
|
|
|
$class = get_class($unit);
|
|
|
|
$breakdown_cat = null;
|
|
|
|
show_unit_row($unit, $class, $level, false);
|
2008-07-01 20:33:39 +00:00
|
|
|
if ($breakdown && breakdown_class($class)) {
|
2008-06-27 23:15:57 +00:00
|
|
|
foreach ($breakdown->categories() as $c) {
|
|
|
|
$breakdown_cat = $c;
|
|
|
|
show_unit_row($unit, $class, $level, false);
|
2008-06-26 23:24:43 +00:00
|
|
|
}
|
2008-06-27 23:15:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// if exercise, show answer page views
|
|
|
|
//
|
|
|
|
if ($class == "BoltExercise") {
|
|
|
|
$breakdown_cat = null;
|
|
|
|
show_unit_row($unit, $class, $level, true);
|
|
|
|
if ($breakdown) {
|
|
|
|
foreach ($breakdown->categories() as $c) {
|
|
|
|
$breakdown_cat = $c;
|
2008-06-30 16:46:05 +00:00
|
|
|
show_unit_row($unit, $class, $level, true);
|
2008-06-27 23:15:57 +00:00
|
|
|
}
|
2008-06-26 23:24:43 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-22 20:09:23 +00:00
|
|
|
}
|
|
|
|
|
2008-06-27 23:15:57 +00:00
|
|
|
function show_unit_recurse($unit, $level) {
|
|
|
|
show_unit($unit, $level);
|
2008-02-22 20:09:23 +00:00
|
|
|
if ($unit->is_item) return;
|
|
|
|
foreach ($unit->units as $u) {
|
2008-06-27 23:15:57 +00:00
|
|
|
show_unit_recurse($u, $level+1);
|
2008-02-22 20:09:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-26 23:24:43 +00:00
|
|
|
function show_map() {
|
2008-06-27 23:15:57 +00:00
|
|
|
global $snap, $course_id, $top_unit, $filter, $filter_cat, $breakdown;
|
2008-08-15 22:07:24 +00:00
|
|
|
global $course;
|
2008-06-26 23:24:43 +00:00
|
|
|
|
2008-11-01 03:07:44 +00:00
|
|
|
get_filters_from_form();
|
2008-06-27 18:59:33 +00:00
|
|
|
|
2008-11-01 03:07:44 +00:00
|
|
|
admin_page_head("Course map for '$course->name'");
|
2008-08-15 22:07:24 +00:00
|
|
|
bolt_style();
|
2008-06-26 23:24:43 +00:00
|
|
|
$snap = read_map_snapshot($course_id);
|
2008-08-15 22:07:24 +00:00
|
|
|
start_table();
|
2008-06-27 18:59:33 +00:00
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Type</th>
|
2008-06-30 16:46:05 +00:00
|
|
|
";
|
|
|
|
if ($breakdown) {
|
|
|
|
echo "<th>Group</th>";
|
|
|
|
}
|
|
|
|
echo "
|
2008-06-27 18:59:33 +00:00
|
|
|
<th>Views</th>
|
2008-10-30 22:58:33 +00:00
|
|
|
<th>Questions</th>
|
2008-08-15 22:07:24 +00:00
|
|
|
<th>Outcome<br>
|
|
|
|
<span class=green>Next</span>
|
|
|
|
<span class=yellow>Back</span>
|
|
|
|
<span class=red>None</span>
|
|
|
|
</th>
|
2008-06-27 18:59:33 +00:00
|
|
|
<th>Score</th>
|
2008-07-01 20:33:39 +00:00
|
|
|
<th>Time</th>
|
2008-06-27 18:59:33 +00:00
|
|
|
</tr>
|
|
|
|
";
|
2008-06-27 23:15:57 +00:00
|
|
|
show_unit_recurse($top_unit, 0);
|
2008-06-27 18:59:33 +00:00
|
|
|
echo "
|
|
|
|
</table>
|
|
|
|
<form action=bolt_map.php>
|
|
|
|
<input type=hidden name=action value=map>
|
|
|
|
<input type=hidden name=course_id value=$course_id>
|
|
|
|
<table width=600><tr><td valign=top>
|
|
|
|
";
|
2008-11-01 03:07:44 +00:00
|
|
|
filter_form($filter?$filter->name():"", $filter_cat);
|
2008-06-27 18:59:33 +00:00
|
|
|
echo "</td><td valign=top>";
|
2008-11-01 03:07:44 +00:00
|
|
|
breakdown_form($breakdown?$breakdown->name():"");
|
2008-06-27 18:59:33 +00:00
|
|
|
echo "
|
|
|
|
</td></tr></table>
|
|
|
|
<p>
|
|
|
|
<input type=submit value=OK>
|
|
|
|
</form>
|
|
|
|
";
|
2008-11-01 03:07:44 +00:00
|
|
|
admin_page_tail();
|
2008-06-26 23:24:43 +00:00
|
|
|
}
|
|
|
|
|
2008-10-30 22:58:33 +00:00
|
|
|
function show_questions() {
|
|
|
|
global $course_id;
|
2008-11-03 03:06:29 +00:00
|
|
|
|
|
|
|
$name = get_str('name');
|
|
|
|
$mode = get_int('mode');
|
|
|
|
get_filters_from_form();
|
2008-10-30 22:58:33 +00:00
|
|
|
$snap = read_map_snapshot($course_id);
|
|
|
|
$qs = $snap->questions[$name];
|
2008-11-01 03:07:44 +00:00
|
|
|
admin_page_head("Questions about $name");
|
2008-10-30 22:58:33 +00:00
|
|
|
start_table();
|
|
|
|
echo "<tr>
|
|
|
|
<th>When</th>
|
|
|
|
<th>Who</th>
|
|
|
|
<th>Question</th>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
foreach ($qs as $q) {
|
2008-11-03 03:06:29 +00:00
|
|
|
if ($q->mode != $mode) continue;
|
2008-10-30 22:58:33 +00:00
|
|
|
$user = $snap->users[$q->user_id];
|
|
|
|
echo "<tr>
|
|
|
|
<td>".time_str($q->create_time)."</td>
|
|
|
|
<td><a href=student>$user->name</td>
|
|
|
|
<td>$q->question</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
end_table();
|
2008-11-01 03:07:44 +00:00
|
|
|
admin_page_tail();
|
2008-10-30 22:58:33 +00:00
|
|
|
}
|
|
|
|
|
2008-02-22 20:09:23 +00:00
|
|
|
$course_id = get_int('course_id');
|
|
|
|
$course = BoltCourse::lookup_id($course_id);
|
|
|
|
if (!$course) error_page("no course");
|
2008-08-14 15:46:30 +00:00
|
|
|
$top_unit = require_once($course->doc_file());
|
2008-02-22 20:09:23 +00:00
|
|
|
|
2008-06-26 20:53:51 +00:00
|
|
|
$action = get_str('action', true);
|
|
|
|
switch ($action) {
|
|
|
|
case "":
|
|
|
|
show_snap_form();
|
|
|
|
break;
|
|
|
|
case "snap_action":
|
|
|
|
snap_action();
|
|
|
|
break;
|
|
|
|
case "map":
|
2008-06-26 23:24:43 +00:00
|
|
|
show_map();
|
2008-06-26 20:53:51 +00:00
|
|
|
break;
|
2008-10-30 22:58:33 +00:00
|
|
|
case "questions":
|
|
|
|
show_questions();
|
|
|
|
break;
|
2008-06-26 20:53:51 +00:00
|
|
|
default:
|
|
|
|
error_page("Unknown action $action");
|
|
|
|
}
|
2008-02-22 20:09:23 +00:00
|
|
|
|
|
|
|
?>
|