diff --git a/db/bolt_constraints.sql b/db/bolt_constraints.sql deleted file mode 100644 index ef51b84036..0000000000 --- a/db/bolt_constraints.sql +++ /dev/null @@ -1,11 +0,0 @@ -alter table bolt_course - add unique(name); - -alter table bolt_enrollment - add unique(user_id, course_id); - -alter table bolt_view - add index bv_cs(course_id, start_time); - -alter table bolt_refresh - add unique br_u(user_id, course_id, name); diff --git a/db/bolt_schema.sql b/db/bolt_schema.sql deleted file mode 100644 index 8e04e56f9b..0000000000 --- a/db/bolt_schema.sql +++ /dev/null @@ -1,154 +0,0 @@ -create table bolt_user ( - user_id integer not null, - birth_year integer not null, - sex tinyint not null, - flags integer not null, - attrs text not null, - -- project-defined. Use serialized PHP object - primary key (user_id) -); - -create table bolt_course ( - id integer not null auto_increment, - create_time integer not null, - short_name varchar(255) not null, - name varchar(255) not null, - description text not null, - hidden tinyint not null, - bossa_app_id integer not null, - -- on completion, go to this Bossa app - primary key (id) -); - -create table bolt_enrollment ( - create_time integer not null, - user_id integer not null, - course_id integer not null, - last_view_id integer not null, - -- ID of last study phase view - mastery double not null -); - --- Represents a view of an item; --- created when we show the item, --- and finalized when the user clicks on something to leave the page --- A special view is used to represent the end of a course; --- its mode is BOLT_MODE_FINISHED. --- -create table bolt_view ( - id integer not null auto_increment, - user_id integer not null, - course_id integer not null, - item_name varchar(255) not null, - -- name of the item - state text not null, - -- course state - mode integer not null, - -- distinguishes exercise show/answer - phase integer not null, - -- distinguishes study/review/refresh - action integer not null, - -- what the user clicked to leave page - start_time integer not null, - end_time integer not null, - prev_view_id integer not null, - -- for exercise answer views; - -- refers to the original exercise view - fraction_done double not null, - result_id integer not null, - -- if this was an exercise show, link to result record - refresh_id integer not null, - -- if unit was flagged for review, link to review record - -- ?? remove? - primary key (id) -); - --- represents the result of a single exercise --- -create table bolt_result ( - id integer not null auto_increment, - create_time integer not null, - user_id integer not null, - course_id integer not null, - view_id integer not null, - -- the display of exercise - item_name varchar(255) not null, - score double not null, - response text not null, - -- the query string containing user's responses - primary key(id) -); - --- represents the result of a completed exercise set, --- where "completed" means the last exercise was scored. --- In theory this could be reconstructed from the individual exercise results, --- but this table makes it easier for analytics --- -create table bolt_xset_result ( - id integer not null auto_increment, - create_time integer not null, - user_id integer not null, - course_id integer not null, - start_time integer not null, - end_time integer not null, - name varchar(255) not null, - -- logical name of exercise set unit - score double not null, - -- weighted average score - view_id integer not null, - -- the view of the answer page of last exercise in set - primary key(id) -); - --- represents the completion of a select structure --- -create table bolt_select_finished ( - id integer not null auto_increment, - user_id integer not null, - course_id integer not null, - end_time integer not null, - name varchar(255) not null, - -- logical name of the select unit - selected_unit varchar(255) not null, - -- name of selected subunit - view_id integer not null, - -- the view of the last item - primary key(id) -); - --- represents a refresh/repeat of an exercise set, --- either pending (not due yet), --- due but not started, or in progress. --- -create table bolt_refresh ( - id integer not null auto_increment, - create_time integer not null, - user_id integer not null, - course_id integer not null, - name varchar(255) not null, - -- logical name of result set unit - last_view_id integer not null, - -- if refresh is in progress, the last view - xset_result_id integer not null, - -- most recent result for this exercise set - due_time integer not null, - -- when refresh will be due - count integer not null, - -- index into intervals array - primary key (id) -); - -create table bolt_question ( - id integer not null auto_increment, - create_time integer not null, - user_id integer not null, - course_id integer not null, - name varchar(255) not null, - -- logical name of item where question was asked - mode integer not null, - -- distinguishes exercise show/answer - question text not null, - state integer not null, - -- whether question has been handled - primary key (id) -); diff --git a/db/bossa_constraints.sql b/db/bossa_constraints.sql deleted file mode 100644 index 8761c206bb..0000000000 --- a/db/bossa_constraints.sql +++ /dev/null @@ -1,10 +0,0 @@ -alter table bossa_app - add unique(name), - add unique(short_name); - -alter table bossa_job - add index bj_conf_needed(app_id, calibration, priority_0); - -alter table bossa_job_inst - add index bji_job(job_id), - add index bji_user(user_id); diff --git a/db/bossa_schema.sql b/db/bossa_schema.sql deleted file mode 100644 index 2ceda93689..0000000000 --- a/db/bossa_schema.sql +++ /dev/null @@ -1,63 +0,0 @@ -create table bossa_app ( - id integer not null auto_increment, - create_time integer not null, - name varchar(255) not null, - short_name varchar(255) not null, - description varchar(255) not null, - long_jobs tinyint not null, - hidden tinyint not null, - bolt_course_id integer not null, - time_estimate integer not null, - time_limit integer not null, - calibration_frac double not null, - info text, - -- app-specific info, JSON - primary key(id) -) engine = InnoDB; - -create table bossa_job ( - id integer not null auto_increment, - create_time integer not null, - app_id integer not null, - batch_id integer not null, - state integer not null, - info text, - calibration tinyint not null, - priority_0 double not null, - -- add more as needed - -- for calibration jobs, init to random and decrement on each view - primary key(id) -) engine=InnoDB; - -create table bossa_job_inst ( - id integer not null auto_increment, - create_time integer not null, - app_id integer not null, - job_id integer not null, - user_id integer not null, - batch_id integer not null, - finish_time integer not null, - timeout integer not null, - calibration tinyint not null, - info text, - primary key(id) -) engine=InnoDB; - -create table bossa_user ( - user_id integer not null, - category integer not null, - flags integer not null, - -- debug, show_all - info text, - -- Project-dependent info about users ability and performance. - primary key(user_id) -) engine = InnoDB; - -create table bossa_batch ( - id integer not null auto_increment, - create_time integer not null, - name varchar(255) not null, - app_id integer not null, - calibration tinyint not null, - primary key(id) -) engine = InnoDB; diff --git a/html/inc/bolt.inc b/html/inc/bolt.inc deleted file mode 100644 index ee2cbc6222..0000000000 --- a/html/inc/bolt.inc +++ /dev/null @@ -1,381 +0,0 @@ -. - -// Bolt course document API - -error_reporting(E_ALL); -ini_set('display_errors', true); -ini_set('display_startup_errors', true); - -abstract class BoltUnit { - public $name; - // Logical name. Changing this makes it a different unit. - // For items, this is the filename with query string; - // for structures, it must be specified with name() - public $title; - // Optional; used when showing course history outline. - public $is_item; - public $attrs; // course-defined - - abstract function walk(&$iter, $incr, &$frac_done); - // multi-purpose function for traversing a course. - // Create entry in $iter->state if not there. - // Recurse to first child. - // If first child is an item, set $iter->item - // If incr is set - // the bottom-level non-item unit should increment. - // return value: true if the caller should increment - // frac_done: Fraction done (of this unit and any subunits) -} - -// base class for exercise and lesson -// -class BoltItem extends BoltUnit { - public $filename; - public $query_string; - function __construct($filename, $title, $attrs) { - $p = strpos($filename, '?'); - if ($p === false) { - $this->filename = $filename; - $this->query_string = null; - } else { - $this->filename = substr($filename, 0, $p); - $this->query_string = substr($filename, $p+1); - } - $this->name = $filename; - $this->title = $title; - $this->is_item = true; - $this->attrs = $attrs; - } - function begin() { - return array(new BoltFrame($this)); - } - function walk(&$iter, $incr, &$frac_done) { - echo "SHOULDN'T BE HERE\n"; - } -} - -class BoltLesson extends BoltItem { - function is_exercise() { - return false; - } -} - -class BoltExercise extends BoltItem { - public $callback; - // called as func($student, $score, $query_string) after scoring - public $weight; - public $has_answer_page; - - function __construct( - $filename, $title, $attrs, $callback, $weight, $has_answer_page - ) { - parent::__construct($filename, $title, $attrs); - $this->callback = $callback; - $this->weight = $weight; - $this->has_answer_page = $has_answer_page; - } - function is_exercise() { - return true; - } -} - -// Base class for control structures (all units other than items). -// The state of a control structure has two parts: -// 1) a transient PHP object -// 2) a persistent "state record" (stored in JSON in the DB) -// -// The PHP object has the following properties: -// - a set of units -// - ordered: a flag for whether the set has been ordered yet -// - order($state_rec): a function for ordering this set, -// defined in the derived class -// (i.e., random, student-specific, or identity) -// This orders the set, sets "ordered", and adds info to the state rec -// saying how the ordering was done (e.g. RNG seed) -// - a number "ntoshow" for how many units to show -// -// The state record has the following items: -// - index: index into the unit array -// - nshown: for how many units completed so far -// - child_name: name of current child, or null -// -class BoltSet extends BoltUnit { - public $units; - function __construct($name, $units, $ntoshow, $attrs) { - $this->name = $name; - $this->is_item = false; - $this->units = $units; - $this->ntoshow = $ntoshow; - $this->ordered = false; - $this->attrs = $attrs; - } - - // restart this unit - set its state record to an initial state - // - function restart(&$iter) { - $state_rec = $iter->state[$this->name]; - if (!$state_rec) $state_rec = $this->init(); - $state_rec['nshown'] = 0; - $state_rec['child_name'] = null; - $iter->state[$this->name] = $state_rec; - } - - // initialize this unit (once per course) - // - function init(&$iter) { - $state_rec = array(); - $state_rec['index'] = 0; - $iter->state[$this->name] = $state_rec; - return $state_rec; - } - - function finished(&$iter) { - $this->restart($iter); - } - - function walk(&$iter, $incr, &$frac_done) { - $n = count($this->units); - if (array_key_exists($this->name, $iter->state)) { - $state_rec = $iter->state[$this->name]; - $child_name = $state_rec['child_name']; - $nshown = $state_rec['nshown']; - if (!$this->ordered) { - $this->order($iter); - } - - // look up unit by name - // - $child = null; - for ($i=0; $i<$n; $i++) { - $c = $this->units[$i]; - if ($c->name == $child_name) { - $child = $c; - break; - } - } - - // if not there, look up by index - // - if (!$child) { - $i = $state_rec['index']; - if ($i >= $n) { - // and if index is too big, use last unit - // - $i = $n-1; - } - $child = $this->units[$i]; - } - - // at this point, $child is the current unit, and $i is its index - // - if ($incr) { - if ($child->is_item) { - $my_inc = true; - } else { - $my_inc = $child->walk($iter, $incr, $frac_done); - } - if ($my_inc) { - $nshown++; - if ($nshown == $this->ntoshow) { - $frac_done = 1; - $this->finished($iter); - return true; - } else { - $i = ($i+1)%$n; - } - } - } - } else { - // here if no state record; initialize - // - $i = 0; - $nshown = 0; - $this->init($iter); - $this->order($iter); - } - - // at this point, $i is index of current child, $nshown is valid, - // and this unit has a record in the state array - // - $child = $this->units[$i]; - $frac_done = $nshown/$n; - $state_rec = $iter->state[$this->name]; - $state_rec['index'] = $i; - $state_rec['nshown'] = $nshown; - $state_rec['child_name'] = $child->name; - $iter->state[$this->name] = $state_rec; - if ($child->is_item) { - $iter->item = $child; - } else { - $child->walk($iter, false, $f); - $frac_done += $f*(1/$n); - } - return false; - } - - // return the name of our child, if we exist in the state - // - function get_child($state) { - if (array_key_exists($this->name, $state)) { - $state_rec = $state[$this->name]; - $child_name = $state_rec['child_name']; - foreach($this->units as $c) { - if ($c->name == $child_name) { - return $c; - } - } - } - return null; - } - -} - -function name($n) { - return array('name', $n); -} - -function title($n) { - return array('title', $n); -} - -function number($n) { - return array('number', $n); -} - -function filename($n) { - return array('filename', $n); -} - -function has_answer_page($n) { - return array('has_answer_page', $n); -} - -function attrs($n) { - return array('attrs', $n); -} - -function callback($n) { - return array('callback', $n); -} - -function lesson() { - $filename = ""; - $title = ""; - $attrs = null; - - $args = func_get_args(); - foreach ($args as $arg) { - if (is_array($arg)) { - switch ($arg[0]) { - case 'title': $title = $arg[1]; break; - case 'filename': $filename = $arg[1]; break; - case 'attrs': $attrs = $arg[1]; break; - default: echo "Unrecognized lesson parameter: ", $arg[0], "\n"; break; - } - } else { - echo "unprocessed arg of class ".get_class($arg); - } - } - if (!$title) { - $title = $filename; - } - if (!$filename) { - error_page("Missing filename in lesson"); - } - return new BoltLesson($filename, $title, $attrs); -} - -function exercise() { - $filename = ""; - $title = ""; - $attrs = null; - $weight = 1; - $has_answer_page = true; - - $args = func_get_args(); - $callback = null; - foreach ($args as $arg) { - if (is_array($arg)) { - switch ($arg[0]) { - case 'title': $title = $arg[1]; break; - case 'filename': $filename = $arg[1]; break; - case 'attrs': $attrs = $arg[1]; break; - case 'callback': $callback = $arg[1]; break; - case 'weight': $weight = $arg[1]; break; - case 'has_answer_page': $has_answer_page = $arg[1]; break; - default: echo "Unrecognized exercise parameter: ", $arg[0], "\n"; break; - } - } - } - if (!$title) { - $title = $filename; - } - if (!$filename) { - error_page("Missing filename in lesson"); - } - return new BoltExercise( - $filename, $title, $attrs, $callback, $weight, $has_answer_page - ); -} - -function item_attrs() { - global $item; - return $item->attrs; -} - -function student_sex() { - global $user; - return $user->bolt->sex; -} - -function student_age() { - global $user; - if (!$user->bolt->birth_year) return -1; - $date = getdate(); - $this_year = $date["year"]; - return $this_year - $user->bolt->birth_year; -} - -function student_country() { - global $user; - return $user->country; -} - -function student_name() { - global $user; - return $user->name; -} - -function student_attrs() { - global $user; - return unserialize($user->bolt->attrs); -} - -function set_student_attrs($attrs) { - global $user; - $attrs = serialize($attrs); - $user->bolt->update("attrs='$attrs'"); -} - -require_once('../inc/bolt_seq.inc'); -require_once('../inc/bolt_rnd.inc'); -require_once('../inc/bolt_xset.inc'); -require_once('../inc/bolt_select.inc'); - -?> diff --git a/html/inc/bolt_cat.inc b/html/inc/bolt_cat.inc deleted file mode 100644 index 96a0d9e7d7..0000000000 --- a/html/inc/bolt_cat.inc +++ /dev/null @@ -1,168 +0,0 @@ -. - -// represents a categorization of students -// -abstract class Categorization { - abstract function name(); - // returns descriptive name - abstract function categories(); - // returns list of categories - abstract function categorize($user); - // returns a student's category -} - -class CatSex extends Categorization { - function name() { - return "Sex"; - } - function categories() { - return array ("Male", "Female", "Unknown"); - } - function categorize($user) { - switch ($user->bolt->sex) { - case 1: return "Male"; - case 2: return "Female"; - default: return "Unknown"; - } - } -} - -$x = localtime(time(), true); -$this_year = 1900 + $x['tm_year']; - -class CatAge20 extends Categorization { - function name() { - return "Age (20-year groups)"; - } - function categories() { - return array("0-19", "20-39", "40-59", "60-79", "80+", "Unknown"); - } - function categorize($user) { - if (!$user->bolt->birth_year) return "Unknown"; - global $this_year; - $n = $this_year - $user->bolt->birth_year; - if ($n < 20) return "0-19"; - if ($n < 40) return "20-39"; - if ($n < 60) return "40-59"; - if ($n < 80) return "60-79"; - return "80+"; - } -} - -$categorizations = array(new CatSex(), new CatAge20()); - -function lookup_categorization($name) { - global $categorizations; - foreach ($categorizations as $c) { - if ($c->name() == $name) return $c; - } - return null; -} - -function filter_form($sel_name, $sel_cat) { - global $categorizations; - $checked = (!$sel_name || $sel_name == "none")?"checked":""; - echo " - Filter by: -
-
\n"; - page_tail(); -} - -//////////// show refresh schedule ////////////// - -function show_refresh($r) { - echo "($n students)
$a1 | -- | $a2 | -
Insufficient data | -
$t0 |
- ";
- }
- if ($x1) {
- $s .= "
$t sec |
-
$t% |
- ";
- }
- if ($y) {
- $s .= "- "; - } - $s .= " |
- Please try again later.
- ";
- page_tail();
- }
-}
-
-?>
diff --git a/html/user/bolt.css b/html/user/bolt.css
deleted file mode 100644
index a7ec6c5bec..0000000000
--- a/html/user/bolt.css
+++ /dev/null
@@ -1,414 +0,0 @@
-/* General */
-
-a, a:link, a:visited, a:active {
- color: #0069A1;
- text-decoration: none;
-}
-
-a:hover { text-decoration: underline; }
-
-body {
- background-image: url("img/gray_gradient.png");
- background-repeat: repeat-x;
- background-color: white;
- font-family: Verdana, Arial, Sans Serif;
- font-size: 13px;
- margin: 5px 10px;
- color: black;
-}
-
-h1, h2 {
- font-size: x-large;
- font-weight: normal;
-}
-
-h1 {
- color: #203C66;
- margin: 10px;
-}
-
-h3, h4 { font-weight: bold; }
-
-hr {
- size: 0px;
- border-top: 2px solid #e8e8e8;
- margin: 8px 2px;
-}
-
-.table {
- padding: 4px;
- margin: 2px;
-}
-
-.table-bordered {
- border: 2px solid #e8e8e8;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
-}
-
-th {
- background-color: #c0c0c0;
- font-weight: bold;
- vertical-align: top;
-}
-
-td {
- vertical-align: top;
- padding: 4px;
-}
-
-td.bordered {
- border: 1px solid gray;
-}
-
-td.indent { border-left: 4px solid white; }
-
-th, td.heading {
- font-weight: bold;
- margin: 4px 0px;
- padding: 8px;
- background-color: #d8d8d8;
-}
-
-td.fieldname {
- background-color: #eeeeee;
- text-align: right;
- padding-right: 10px;
- margin: 2px 0px;
-}
-
-td.fieldvalue {
- margin: 2px 0px;
- vertical-align: middle;
-}
-
-td.fieldname_error {
- background-color: #ff8888;
- text-align: right;
-}
-
-td.fieldvalue_error {
- background-color: #ff8888;
- font-weight: bold;
-}
-
-td.navbar {
- border: 0px;
- text-align: center;
- vertical-align: middle;
-}
-
-td.friend {
- background-color: #e8e8e8;
- text-align: center;
- vertical-align: middle;
-}
-
-.row0 {
- background-color: #d9d9d9;
- text-align: left;
-}
-.row1 {
- background-color: #eeeeee;
- text-align: left;
-}
-
-.highlighted_row0 {
- background-color: #b9d9f9;
- text-align: left;
-}
-.highlighted_row1 {
- background-color: #ceeefe;
- text-align: left;
-}
-
-.row_hd0 { background-color: #cffacf; }
-
-.row_hd1 { background-color: #defade; }
-
-tr.message { background-color: #e0e0e0; }
-
-input[type="text"], select, textarea, .btn {
- border: 1px solid #d8d8d8;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- padding: 2px 4px;
- font-size: 12px;
-}
-
-input[type="button"], input[type="submit"], input.btn {
- margin: 2px 0px;
- background: #d4d0c8;
- margin-right: 0.6em;
- color: #203C66;
- border: 1px solid #a8a8a8;
- font-size: 12px;
- font-weight: normal;
-}
-
-/* IE6 doesn't understand [type=XXXX] so we factor this out into its own */
-.btn {
- margin: 2px 0px;
- background: #d4d0c8;
- margin-right: 0.6em;
- white-space: nowrap;
- color: #203C66;
- border: 1px solid #a8a8a8;
- font-size: 0.9em;
- font-weight: normal;
- line-height: 2em;
-}
-
-.btn:hover {
- background: #edece8;
- text-decoration:none;
-}
-
-input[type="button"]:hover, input[type="submit"]:hover, input.btn:hover, .forum_toplinks a:hover {
- background: #edece8;
-}
-
-.actionlist {
- display: inline;
- list-style: none;
- margin: 0;
- padding: 0;
-}
-.actionlist li {
- display: inline;
-}
-
-
-img { border: 0px; }
-
-img.userimg { border: 0px; }
-
-/* Main Page */
-
-#news {
- background-color: #dff0ff;
- border: 2px solid #add8e6;
- padding: 10px;
- margin: 4px;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
-}
-
-#news h2, #uotd h2, #mainnav h2 {
- margin-top: 0px;
- font-size: 1.2em;
- font-weight: bold;
-}
-
-#news h3 {
- color: #666666;
- font-size: 1em;
- margin-bottom: 2px;
-}
-
-#news p {
- margin-top: 0px;
-}
-
-#uotd {
- background-color: #d3d3d3;
- border: 2px solid #eeeeee;
- padding: 10px;
- margin: 4px;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
-}
-
-/* Forum */
-
-td.category , tr.subtitle{
- background-color: #dddddd;
- border: 0px;
- font-weight: bold;
- margin: 6px 0px;
-}
-
-th {
- font-weight: bold;
- margin: 4px 2px;
- padding: 4px;
-}
-
-td.postheader {
- background-color: #eeeeee;
- height: 24px;
- margin-left: 4px;
- padding-left: 8px;
- -moz-border-radius: 0px 0px 10px 10px;
- -webkit-border-radius: 0px 0px 10px 10px;
-}
-
-td.postbody {
- font-size: 9pt;
- margin-left: 4px;
- background: transparent url('img/75pct_white.png');
-}
-
-td.postfooter {
- background-color: #eeeeee;
- height: 26px;
- margin-left: 4px;
- padding-left: 8px;
- -moz-border-radius: 10px 10px 0px 0px;
- -webkit-border-radius: 10px 10px 0px 0px;
-}
-
-tr.helpdeskseparator { height: 10pt; }
-
-tr.postseparator {
- background-color: #c8c8c8;
- border: 1px solid #aaaaaa;
- margin: 4px 0px;
-}
-
-td.threadline { text-align: left; }
-
-td.numbers {
- text-align: center;
-}
-
-td.numbers {
- text-align: left;
-}
-
-td.lastpost {
-}
-
-.title {
- font-size: 14px;
- font-weight: bold;
-}
-
-.text-info, .description {
- font-size: 80%;
- font-weight: normal;
-}
-
-.authorcol {
- width: 136px;
- overflow: hidden;
-}
-
-div.authorcol {
- border: 1px solid #c8c8c8;
- background-color: white;
- padding: 8px 5px;
- width: 120px;
- margin-left: 2px;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
-}
-
-.authorinfo img {
- border: 1px solid #a8a8a8;
- margin: 3px 9px;
-}
-
-.authorcol input { margin: 4px 10px; }
-
-blockquote.postbody {
- border-left: 2px solid #0089e1;
- background-color: #f5fffa;
- padding: 2px 6px;
- margin: 0px 6px 0px 10px;
- font-style: italic;
-}
-
-#thread {
- width: 100%;
- table-layout: fixed;
- overflow: visible;
-}
-
-.forum_toplinks td {
- vertical-align: middle;
-}
-
-span.page_title {
- font-size: 24px;
- margin: 20px;
-}
-
-p.text-muted, span.note {
- font-weight: normal;
- font-size: 0.9em;
- font-style: italic;
-}
-
-span.news_date {
- color: #646464;
- font-size: 0.9em;
-}
-span.news_title {
- font-weight: bold;
-}
-
-span.inboxunread {
- font-weight: bold;
-}
-
-span.highlight {
- background-color: #ffffcc;
-}
-
-.nobr{
- white-space: nowrap;
-}
-
-.code {
- font-family: "Courier New", courier, monospace;
- display: block;
- margin-left: 5em;
- border-left: 3px solid #ccaaaa;
- padding-left: 1em;
- white-space: nowrap;
- overflow: auto;
-}
-
-small {
- font-size: 0.8em;
-}
-
-p.text-danger, .error {
- color: #ff0000;
- font-weight: bold;
- font-size: 1.1em;
-}
-
-.notice {
- color: #009900;
- font-weight: bold;
- font-size: 1.1em;
-}
-
-#preview {
- border: 2px solid #cccccc;
- background-color: #eeeeee;
- margin: 1em;
- padding: 0.2em;
-}
-
-#preview .header {
- font-weight: bold;
- font-size: 1.3em;
- border-bottom: 1px solid #cccccc;
-}
-
-/* Server Status Page */
-
-td.running { background-color: #9aff4f; }
-
-td.notrunning { background-color: #feff6f; }
-
-td.disabled { background-color: #ff4f4f; }
-
-/* IE hack */
-
-* html body .code {
- white-space: normal;
-}
diff --git a/html/user/bolt.php b/html/user/bolt.php
deleted file mode 100644
index 6ccda1c16a..0000000000
--- a/html/user/bolt.php
+++ /dev/null
@@ -1,71 +0,0 @@
-.
-
-require_once("../inc/bolt_db.inc");
-require_once("../inc/util.inc");
-require_once("../inc/bolt_util.inc");
-
-page_head("Courses");
-
-$user = get_logged_in_user(false);
-if ($user) {
- BoltUser::lookup($user);
-}
-
-$courses = BoltCourse::enum();
-start_table();
-table_header(
- "Course", "Status"
-);
-foreach ($courses as $course) {
- if ($course->hidden && !($user->bolt->flags&BOLT_FLAG_SHOW_ALL)) {
- continue;
- }
- $e = $user?BoltEnrollment::lookup($user->id, $course->id):null;
- if ($e) {
- $start = date_str($e->create_time);
- $view = BoltView::lookup_id($e->last_view_id);
- $ago = time_diff(time() - $view->start_time);
- $pct = number_format($view->fraction_done*100, 0);
- $status = "Started $start
-
Last visit: $ago ago
-
$pct% done
- ";
- if ($view->fraction_done < 1) {
- $status .= "
id&action=resume>Resume
- ";
- }
- $status .= "
id&action=start>Restart
- | id>History
- ";
- } else {
- $status = "
- id&action=start>Start
- ";
- }
- row2_init("$course->name
-
$course->description
", - $status - ); - show_refreshes(); - echo "\n"; -} -end_table(); -page_tail(); - -?> diff --git a/html/user/bolt_admin.css b/html/user/bolt_admin.css deleted file mode 100644 index 295c4ca6ca..0000000000 --- a/html/user/bolt_admin.css +++ /dev/null @@ -1,63 +0,0 @@ -table.bolt_bar { - margin: 0px; - padding: 0px; - border: 0px; - //border-collapse: collapse; - border-spacing: 0px; -} - -td.bolt_bar { - border: 1px solid #aaaaaa; - padding: 0px; - margin: 0px; -} - -span.green { - padding: 2px; - background-color: #88ff88; - font-size: 0.9em; - font-style: italic; -} -span.yellow { - padding: 2px; - background-color: #ffff88; - font-size: 0.9em; - font-style: italic; -} -span.red { - padding: 2px; - background-color: #ff8888; - font-size: 0.9em; - font-style: italic; -} - -td.bolt_bar1 { - padding: 0; - margin: 0px 0px; - font-size: 0.9em; - background-color: #dddddd; -} - -td.bolt_bar2 { - padding: 0; - margin: 0px 0px; - font-size: 0.9em; - background-color: #44bb44; -} - -tr.bolt_head1 { - background-color: #ccccff; - font-weight: bold; - -moz-border-radius: 6px; - -webkit-border-radius: 6px; - -} - -tr.bolt_head2 { - background-color: #cccccc; - -moz-border-radius: 6px; - -webkit-border-radius: 6px; -} - -span.bolt_small { -} diff --git a/html/user/bolt_course.php b/html/user/bolt_course.php deleted file mode 100644 index 9ba8a94aad..0000000000 --- a/html/user/bolt_course.php +++ /dev/null @@ -1,116 +0,0 @@ -. - -require_once("../inc/util.inc"); - -$user = get_logged_in_user(); - -function phase_name($phase) { - switch ($phase) { - case BOLT_PHASE_STUDY: return "study"; - case BOLT_PHASE_REVIEW: return "review"; - case BOLT_PHASE_REFRESH: return "refresh"; - default: return "unknown phase: $phase"; - } -} - -function mode_name($mode) { - switch ($mode) { - case BOLT_MODE_LESSON: return "lesson"; - case BOLT_MODE_SHOW: return "exercise"; - case BOLT_MODE_ANSWER: return "answer page"; - case BOLT_MODE_FINISHED: return "course completed"; - default: return "unknown mode: $mode"; - } -} - -function action_name($action) { - switch ($action) { - case BOLT_ACTION_NONE: return "None"; - case BOLT_ACTION_NEXT: return "Next"; - case BOLT_ACTION_PREV: return "Previous"; - case BOLT_ACTION_SUBMIT: return "Submit"; - case BOLT_ACTION_QUESTION: return "Question"; - case BOLT_ACTION_COURSE_HOME: return "Course home"; - default: return "unknown: $action"; - } -} - -function show_view($view) { - if ($view->end_time) { - $d = $view->end_time - $view->start_time; - $dur = "$d seconds"; - } else { - $dur = "---"; - } - - if ($view->result_id) { - $result = BoltResult::lookup_id($view->result_id); - $qs = str_replace("action=answer", "action=answer_page", $result->response); - $score = number_format($result->score*100); - $x = "-"; - -page_tail(); -?> diff --git a/html/user/bolt_course_sample.php b/html/user/bolt_course_sample.php deleted file mode 100644 index 52dca82a3e..0000000000 --- a/html/user/bolt_course_sample.php +++ /dev/null @@ -1,136 +0,0 @@ -. - -require_once("../inc/bolt.inc"); - -function part2() { - return sequence( - name('inner seq'), - lesson( - name('lesson 3'), - filename('bolt_sample_lesson.php?n=3') - ) - ); -} - -function basic_review() { - return sequence( - lesson( - name('lesson 1'), - filename('bolt_sample_lesson.php?n=1') - ), - lesson( - name('lesson 2'), - filename('bolt_sample_lesson.php?n=2') - ) - ); -} - -function int_review() { - return lesson( - name('lesson 2'), - filename('bolt_sample_lesson.php?n=2') - ); -} - -function my_rand($student, $unit) { - return rand(); -} - -function sample_select() { - return select( - name('sample select'), - valuator('my_rand'), - lesson( - name('lesson 1'), - filename('bolt_sample_lesson.php?n=1') - ), - lesson( - name('lesson 2'), - filename('bolt_sample_lesson.php?n=2') - ), - lesson( - name('lesson 3'), - filename('bolt_sample_lesson.php?n=3') - ) - ); -} - -function sample_random() { - return random( - name('first lessons'), - number(2), - lesson( - name('lesson 1'), - filename('bolt_sample_lesson.php?n=1') - ), - lesson( - name('lesson 2'), - filename('bolt_sample_lesson.php?n=2') - ), - lesson( - name('lesson 3'), - filename('bolt_sample_lesson.php?n=3') - ) - ); -} - -function xset_with_review() { - return exercise_set( - name('exercise set 1'), - number(2), - exercise( - name('exercise 1'), - filename('bolt_sample_exercise.php?n=1') - ), - exercise( - name('exercise 2'), - filename('bolt_sample_exercise.php?n=2') - ), - exercise( - name('exercise 3'), - filename('bolt_sample_exercise.php?n=3') - ), - repeat(.3, basic_review(), REVIEW), - repeat(.7, int_review(), REVIEW|REPEAT), - repeat(1, null, REPEAT|NEXT), - refresh(array(7, 14, 28)) - ); -} - -function sample_xset() { - return exercise_set( - name('sample exercise set'), - number(1), - exercise( - name('exercise 1'), - filename('bolt_sample_exercise.php?n=1') - ) - ); -} - -return sequence( - name('course'), - // sample_random(), - // xset_with_review(), - sample_select(), - sample_xset(), - part2() -); - -?> diff --git a/html/user/bolt_sched.php b/html/user/bolt_sched.php deleted file mode 100644 index 940ecbf75a..0000000000 --- a/html/user/bolt_sched.php +++ /dev/null @@ -1,661 +0,0 @@ -. - -// Bolt scheduler. -// GET args: -// course_id: course ID -// action: see commands below - -require_once("../inc/bolt.inc"); -require_once("../inc/bolt_sched.inc"); -require_once("../inc/bolt_db.inc"); -require_once("../inc/bolt_ex.inc"); -require_once("../inc/bolt_util.inc"); -require_once("../inc/util.inc"); - -function debug_show_state($state, $tag) { - global $user; - global $refresh; - if ($user->bolt->flags&BOLT_FLAGS_DEBUG) { - echo "$tag state:
"; print_r($state); echo "\n"; - if ($refresh) { - echo "
Refresh ID: $refresh->id
"; - } - echo "
"; print_r($item); echo "\n"; - echo "
- You may now
- bossa_app_id>do work.
- ";
- } else {
- echo "Congratulations - you have completed this course.";
- $links[] = "";
- $up_link = "Course home page";
- show_nav($links, $up_link, $view_id);
- }
- page_footer();
-}
-
-function show_refresh_finished() {
- page_header("Refresh completed");
- echo "Return to courses";
- page_footer();
-}
-
-function show_nav($links, $up_link, $view_id) {
- global $course;
-
- echo "
$link | \n"; - } - echo "
- $up_link
- ";
-}
-
-// show an item (lesson, exercise, answer page)
-//
-function show_item($iter, $view_id, $prev_view_id, $mode, $repeat=null) {
- global $user;
- global $course;
- global $bolt_ex;
- global $refresh;
- global $url_args;
-
- $item = $iter->item;
- page_header();
- $bolt_query_string = $item->query_string;
-
- $links = array();
- if ($prev_view_id) {
- $links[] = "";
- }
-
- $next = "
";
-
- if ($item->is_exercise()) {
- $bolt_ex->mode = $mode;
- $bolt_ex->index = 0;
- switch ($mode) {
- case BOLT_MODE_SHOW:
- echo "
-
Score on this exercise set: $avg%"; - if ($repeat->flags & REVIEW) { - //echo "
"; - //print_r($repeat); - //echo ""; - $name = urlencode($repeat->unit->name); - $r = "Review, then repeat exercises"; - $links[] = $r; - } - if ($repeat->flags & REPEAT) { - $r = "Repeat exercises"; - $links[] = $r; - } - if ($repeat->flags & NEXT) { - $links[] = $next; - } - } else { - $links[] = $next; - } - - $up_link = "Course home page"; - show_nav($links, $up_link, $view_id); - - page_footer(); - - if ($refresh) { - $refresh->update("last_view_id=$view_id"); - } else { - $e = new BoltEnrollment(); - $e->user_id = $user->id; - $e->course_id = $course->id; - $e->update("last_view_id=$view_id"); - } -} - -// Show the student the results of an old exercise; no navigation items -// -function show_answer_page($iter, $score) { - global $bolt_ex; - - $bolt_ex->mode = BOLT_MODE_ANSWER; - $bolt_ex->index = 0; - - $item = $iter->item; - page_header(); - $bolt_query_string = $item->query_string; - require_once($item->filename); - if (function_exists('bolt_divide')) bolt_divide(); - $score_pct = number_format($score*100); - echo "Score: $score_pct%"; - page_footer(); -} - -function start_course() { - global $user; - global $course; - global $course_doc; - - BoltEnrollment::delete($user->id, $course->id); - $iter = new BoltIter($course_doc); - $iter->at(); - - $now = time(); - $mode = default_mode($iter->item); - $view_id = create_view($iter, $mode, 0); - BoltEnrollment::insert("(create_time, user_id, course_id, last_view_id) values ($now, $user->id, $course->id, $view_id)"); - show_item($iter, $view_id, 0, $mode); -} - -function start_refresh() { - global $course_doc; - global $refresh; - - $xset_result = BoltXsetResult::lookup_id($refresh->xset_result_id); - if (!$xset_result) error_page("Exercise set result not found"); - $view = BoltView::lookup_id($xset_result->view_id); - if (!$view) error_page("view not found"); - $iter = new BoltIter($course_doc); - $iter->decode_state($view->state); - $iter->at(); - $xset = $iter->xset; - if (!$xset || $xset->name != $xset_result->name) { - error_page("missing exercise set"); - } - $xset->restart($iter); - $iter->at(); - $mode = default_mode($iter->item); - $view_id = create_view($iter, $mode, 0); - show_item($iter, $view_id, 0, $mode); -} - -function show_next($iter, $view) { - global $refresh, $user, $course; - $iter->next(); - - if ($refresh) { - $iter->at(); - if (!$iter->xset) { - // if we're doing a refresh and are no longer in an xset, - // we must have finished the refresh - // - show_refresh_finished(); - $refresh->update('count=count+1'); - return; - } - } - - if ($iter->item) { - $state = $iter->encode_state(); - $mode = default_mode($iter->item); - $view_id = create_view($iter, $mode, $view->id); - show_item($iter, $view_id, $view->id, $mode); - } else { - // course finished - $iter->frac_done = 1; - $fin_view_id = create_view($iter, BOLT_MODE_FINISHED, $view->id); - $e = new BoltEnrollment(); - $e->user_id = $user->id; - $e->course_id = $course->id; - $e->update("last_view_id=$fin_view_id"); - show_finished_page($fin_view_id, $view->id); - } -} - -$user = get_logged_in_user(); -BoltUser::lookup($user); -$course_id = get_int('course_id'); -$refresh_id = get_int('refresh_id', true); -$refresh = null; -$url_args = "course_id=$course_id"; -if ($refresh_id) { - $refresh = BoltRefreshRec::lookup_id($refresh_id); - if (!$refresh) error_page("No such refresh"); - if ($refresh->user_id != $user->id) error_page("Wrong user"); - if ($refresh->course_id != $course_id) error_page("Wrong course"); - $url_args .= "&refresh_id=$refresh_id"; -} -$course = BoltCourse::lookup_id($course_id); -if (!$course) { - error_page("no such course"); -} -$view_id = get_int('view_id', true); -$action = sanitize_tags(get_str('action', true)); -$course_doc = require_once($course->doc_file()); - -switch ($action) { -case 'start': - if (info_incomplete($user)) { - request_info($user, $course); - exit(); - } - if ($refresh) { - start_refresh(); - exit(); - } - $e = BoltEnrollment::lookup($user->id, $course_id); - if ($e) { - page_header(); - echo "You are already enrolled in $course->name. -
- Are you sure you want to start over from the beginning? -
- "; - show_button( - "bolt_sched.php?action=start_confirm&$url_args", - "Yes", - "Start this course from the beginning" - ); - show_button( - "bolt_sched.php?action=resume&$url_args", - "Resume", - "Resume course from current position" - ); - page_footer(); - exit(); - } - // fall through -case 'start_confirm': - start_course(); - break; -case 'update_info': - update_info(); - start_course(); - break; -case 'prev': - $view = finalize_view($view_id, BOLT_ACTION_PREV); - debug_show_state(unserialize($view->state), "Initial"); - if ($view->prev_view_id) { - $view = BoltView::lookup_id($view->prev_view_id); - $iter = new BoltIter($course_doc); - $iter->decode_state($view->state); - $iter->at(); - $mode = $view->mode; - if ($mode == BOLT_MODE_ANSWER) { - $v2 = BoltView::lookup_id($view->prev_view_id); - $result = BoltResult::lookup_id($v2->result_id); - srand($v2->id); - $bolt_ex->score = $result->score; - $bolt_ex->query_string = $result->response; - } - $view_id = create_view($iter, $mode, $view->prev_view_id); - show_item($iter, $view_id, $view->prev_view_id, $mode); - } else { - error_page("At start of course"); - } - break; -case 'next': // "next" button in lesson or exercise answer page - $view = finalize_view($view_id, BOLT_ACTION_NEXT); - debug_show_state(unserialize($view->state), "Initial"); - - $iter = new BoltIter($course_doc); - $iter->decode_state($view->state); - show_next($iter, $view); - break; -case 'answer': // submit answer in exercise - $view = finalize_view($view_id, BOLT_ACTION_SUBMIT); - debug_show_state(unserialize($view->state), "Initial"); - $iter = new BoltIter($course_doc); - $iter->decode_state($view->state); - $iter->at(); - - debug_show_item($iter->item); - $item = $iter->item; - if (!$item->is_exercise()) { - print_r($item); - error_page("expected an exercise"); - } - if ($view->item_name != $item->name) { - error_page("unexpected name"); - } - - // compute the score - - $bolt_ex->query_string = $_SERVER['QUERY_STRING']; - $bolt_ex->mode = BOLT_MODE_SCORE; - $bolt_ex->index = 0; - $bolt_ex->score = 0; - $bolt_query_string = $item->query_string; - srand($view_id); - ob_start(); // buffer output to avoid showing exercise text - require($item->filename); - ob_end_clean(); - - $bolt_ex->score /= $bolt_ex->index; - - if ($item->callback) { - call_user_func( - $item->callback, $bolt_ex->score, $bolt_ex->query_string - ); - } - - // make a record of the result - - $qs = BoltDb::escape_string($_SERVER['QUERY_STRING']); - $now = time(); - $result_id = BoltResult::insert( - "(create_time, user_id, course_id, view_id, item_name, score, response) - values ($now, $user->id, $course->id, $view->id, '$view->item_name', $bolt_ex->score, '$qs')" - ); - $view->update("result_id=$result_id"); - - // If this is part of an exercise set, call its callback function - // - $repeat = null; - $xset = $iter->xset; - if ($xset) { - $is_last = $xset->xset_record_score( - $iter, $bolt_ex->score, $view->id, $avg_score, $repeat - ); - if ($repeat) $repeat->avg_score = $avg_score; - if ($is_last) { - // if the exercise set if finished, make or update DB records - // - if ($xset->callback) { - call_user_func($xset->callback, $avg_score); - } - $now = time(); - $id = BoltXsetResult::insert("(create_time, user_id, course_id, name, score, view_id) values ($now, $user->id, $course->id, '$xset->name', $avg_score, $view_id)"); - $refresh_intervals = $xset->refresh; - if ($refresh_intervals) { - $refresh_rec = BoltRefreshRec::lookup( - "user_id=$user->id and course_id=$course->id and name='$xset->name'" - ); - if ($refresh_rec) { - $count = $refresh_rec->count; - $n = count($refresh_intervals->intervals); - if ($count >= $n) { - $count = $n - 1; - } - $due_time = time() + $refresh_intervals->intervals[$count]*86400; - $refresh_rec->update("create_time=$now, xset_result_id=$id, due_time=$due_time"); - } else { - $due_time = time() + $refresh_intervals->intervals[0]*86400; - BoltRefreshRec::insert( - "(user_id, course_id, name, create_time, xset_result_id, due_time, count) values ($user->id, $course->id, '$xset->name', $now, $id, $due_time, 0)" - ); - } - } - } - } - - // show the answer page - - if ($item->has_answer_page) { - srand($view_id); - $view_id = create_view($iter, BOLT_MODE_ANSWER, $view->id); - show_item($iter, $view_id, $view->id, BOLT_MODE_ANSWER, $repeat); - } else { - show_next($iter, $view); - } - break; -case 'answer_page': - $view = BoltView::lookup_id($view_id); - $iter = new BoltIter($course_doc); - $iter->decode_state($view->state); - $iter->at(); - if ($iter->item->name != $view->item_name) { - error_page("Exercise no longer exists in course"); - } - $result = BoltResult::lookup_id($view->result_id); - srand($view_id); - $bolt_ex->query_string = $result->response; - show_answer_page($iter, $result->score); - break; -case 'course_home': - $view = finalize_view($view_id, BOLT_ACTION_COURSE_HOME); - Header("Location: bolt.php"); - break; -case 'review': - // user chose to do review then repeat an exercise set - // - $view = finalize_view($view_id, BOLT_ACTION_REVIEW); - debug_show_state(unserialize($view->state), "Initial"); - $iter = new BoltIter($course_doc); - $iter->decode_state($view->state); - $iter->at(); - if (!$iter->xset) { - echo "NO XSET"; exit; - } - $xset = $iter->xset; - $unit_name = sanitize_tags(get_str('unit_name')); - $found = $xset->start_review($iter, $unit_name); - if (!$found) { - echo "REVIEW UNIT MISSING"; exit; - } - $iter->at(); - $mode = default_mode($iter->item); - $view_id = create_view($iter, $mode, $view->id); - show_item($iter, $view_id, $view->id, $mode); - break; -case 'repeat': - // user chose to repeat an exercise set - // - $view = finalize_view($view_id, BOLT_ACTION_REPEAT); - debug_show_state(unserialize($view->state), "Initial"); - $iter = new BoltIter($course_doc); - $iter->decode_state($view->state); - $iter->at(); - if (!$iter->xset) { - echo "NO XSET"; exit; - } - $xset = $iter->xset; - $xset->restart($iter); - $iter->at(); - $mode = default_mode($iter->item); - $view_id = create_view($iter, $mode, $view->id); - show_item($iter, $view_id, $view->id, $mode); - break; -case 'resume': - // user chose to resume a course or refresh - // - if ($refresh) { - if ($refresh->last_view_id) { - $view = BoltView::lookup_id($refresh->last_view_id); - } else { - start_refresh(); - exit(); - } - } else { - $view = null; - $e = BoltEnrollment::lookup($user->id, $course_id); - if ($e) { - $view = BoltView::lookup_id($e->last_view_id); - } - if (!$view) { - start_course(); - break; - } - } - if ($view->mode == BOLT_MODE_FINISHED) { - show_finished_page($view->id, $view->prev_view_id); - break; - } - $iter = new BoltIter($course_doc); - $iter->decode_state($view->state); - $iter->at(); - $mode = $view->mode; - if ($view->item_name == $iter->item->name && ($mode == BOLT_MODE_ANSWER)) { - // if we're returning to an answer page, - // we need to look up the user's responses and the score. - // - $view_orig = BoltView::lookup_id($view->prev_view_id); - $result = BoltResult::lookup_id($view_orig->result_id); - srand($view_orig->id); - $bolt_ex->query_string = $result->response; - $bolt_ex->score = $result->score; - $bolt_ex->index = 0; - $view_id = create_view($iter, $mode, $view_orig->id); - show_item($iter, $view_id, $view_orig->id, $mode); - } else { - $view_id = create_view($iter, $mode, $view->id); - show_item($iter, $view_id, $view->id, $mode); - } - break; -case 'question': - $view = finalize_view($view_id, BOLT_ACTION_QUESTION); - debug_show_state(unserialize($view->state), "Initial"); - $now = time(); - $question = BoltDb::escape_string(get_str('question')); - BoltQuestion::insert("(create_time, user_id, course_id, name, mode, question, state) values ($now, $user->id, $course->id, '$view->item_name', $view->mode, '$question', 0)"); - page_header(); - echo " - Thanks; we have recorded your question. - Questions help us improve this course. - We aren't able to individually respond to all questions. - Responses are delivered as private messages. -
- Resume course
- ";
- page_footer();
- break;
-default:
- error_page("unknown action: $action");
-}
-
-?>
diff --git a/html/user/bossa_apps.php b/html/user/bossa_apps.php
deleted file mode 100644
index e2593cac38..0000000000
--- a/html/user/bossa_apps.php
+++ /dev/null
@@ -1,69 +0,0 @@
-.
-
-require_once("../inc/util.inc");
-require_once("../inc/bossa_db.inc");
-require_once("../inc/bolt_db.inc");
-
-function show_app($app) {
- global $user;
- if ($app->bolt_course_id) {
- if ($user) {
- switch (bolt_course_status($app->bolt_course_id, $user->id)) {
- case BOLT_COURSE_NOT_STARTED:
- $x = "bolt_course_id>Take training course";
- break;
- case BOLT_COURSE_STARTED:
- $x = "bolt_course_id>Finish training course";
- break;
- case BOLT_COURSE_FINISHED:
- $x = "id>Get job";
- break;
- }
- } else {
- $x = "bolt_course_id>Take training course";
- }
- } else {
- $x = "id>Get job";
- }
- $est = number_format($app->time_estimate/60., 2);
- $limit = number_format($app->time_limit/60., 2);
- row2("$app->name
$app->description
Time: $est min. average, $limit min limit