function show_courses() { $courses = BoltCourse::enum(); start_table(); table_header("Course", "Tools"); foreach ($courses as $course) { show_course($course); } end_table(); }
// 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/>. 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}\n <br>Last visit: {$ago} ago\n <br>{$pct}% done\n "; if ($view->fraction_done < 1) { $status .= "<br><a href=bolt_sched.php?course_id={$course->id}&action=resume>Resume</a>\n ";
$score = number_format($result->score * 100); $x = "<br>Score: {$score}%\n\t\t\t<br><a href=bolt_sched.php?{$qs}>Answer page</a>"; } echo "<tr>\n\t\t<td valign=top>{$view->id}</td>\n\t\t<td valign=top>" . time_str($view->start_time) . "</td>\n\t\t<td valign=top>{$dur}</td>\n\t\t<td valign=top>{$view->item_name}</td>\n\t\t<td valign=top>" . mode_name($view->mode) . " {$x}</td>\n\t"; //<td valign=top>".phase_name($view->phase)."</td> echo "\n\t\t<td valign=top>" . action_name($view->action) . "</td>\n\t\t</tr>\n\t"; } function show_views() { global $user; global $course; $views = BoltView::enum("user_id={$user->id} and course_id={$course->id} order by id"); start_table(); table_header("ID", "Time", "Duration", "Item", "Mode", "Action"); foreach ($views as $view) { show_view($view); } end_table(); } require_once "../inc/bolt_db.inc"; require_once "../inc/bolt_util.inc"; $course_id = get_int('course_id'); $course = BoltCourse::lookup_id($course_id); if (!$course) { error_page("No such course"); } page_head("Your history in {$course->name}"); show_views(); show_refreshes(); echo "\n\t<a href=bolt_sched.php?course_id={$course_id}&action=resume>Resume course</a>\n\t<p>\n"; page_tail();
admin_page_head("Create Bossa database"); $db_name = $db->db_name; echo "\n The database tables for Bossa don't seem to exist.\n To create them, go to ~/boinc/db and type\n <pre>\nmysql {$db_name} < bossa_schema.sql\nmysql {$db_name} < bossa_constraints.sql\n</pre>\n Then <a href=bossa_admin.php>reload this page</a>.\n "; admin_page_tail(); exit; } BossaUser::lookup($user); $action = get_str('action', true); switch ($action) { case 'add_app': $name = BossaDb::escape_string(get_str('app_name')); $short_name = get_str('short_name'); $description = BossaDb::escape_string(get_str('description')); $training_course = get_str('training_course', true); if (strlen($training_course)) { $course = BoltCourse::lookup_name($training_course); if (!$course) { error_page("No course named {$training_course}"); } $courseid = $course->id; } else { $courseid = 0; } $time_estimate = get_str('time_estimate'); if (!$time_estimate) { $time_estimate = 60; } $time_limit = get_str('time_limit'); if (!$time_limit) { $time_limit = 3600; }
} $mode = BOLT_MODE_LESSON; BoltView::insert("(user_id, course_id, item_name, action, mode, start_time, end_time) values ({$uid}, {$course->id}, '{$unit->name}', {$action}, {$mode}, {$now}, {$t})"); return $action == BOLT_ACTION_NEXT; } function clear() { global $course; $db = BoltDb::get(); $db->do_query("delete from DBNAME.bolt_view where course_id={$course->id}"); $db->do_query("delete from DBNAME.bolt_result where course_id={$course->id}"); $db->do_query("delete from DBNAME.bolt_xset_result where course_id={$course->id}"); $db->do_query("delete from DBNAME.bolt_select_finished where course_id={$course->id}"); } // put your course ID here: $course = BoltCourse::lookup_id(4); if (!$course) { error_page("no such course"); } $now = time(); if (1) { clear(); } if (1) { compare_gen('Conifer/deciduous alternative', 'Intro exercises', 50, 0.5, 0.3, 'conifer_decid2.php', 0.8, 0.2); } if (0) { $sb1->attr = 0.1; $sb1->time_mean = 20; $sb1->time_dev = 10; $sb1->score_mean = 0.8;
<?php // 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/>. $cli_only = true; require_once "../inc/bolt_db.inc"; require_once "../inc/util_ops.inc"; $short_name = 'test_course'; $name = 'Test course'; $description = 'This course is a demonstration of Bolt'; $doc_file = 'bolt_course_sample.php'; $now = time(); if (BoltCourse::insert("(create_time, short_name, name, description, doc_file) values ({$now}, '{$short_name}', '{$name}', '{$description}', '{$doc_file}')")) { echo "all done\n"; } else { echo "database error\n"; }