function notify_users() { $now = time(); $rs = BoltRefresh::enum("due_time < {$now}"); $users = array(); foreach ($rs as $r) { $view = BoltView::lookup_id($r->view_id); $user_id = $view->user_id; if (!key_exists($user_id)) { $user = BoincUser::lookup_id($user_id); BoltUser::lookup($user); $user->refresh = array(); $users[$user_id] = $user; } $users[$user_id]->refresh[] = $r; } foreach ($users as $user) { notify_user($user); } }
// 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/>. 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 ";
function map_gen($n, $sb1, $sb2, $sel, $sel_cat) { global $course; $top_unit = (require_once $course->doc_file()); for ($i = 0; $i < $n; $i++) { $uid = random_student(); $user = BoincUser::lookup_id($uid); BoltUser::lookup($user); $sb = $sel->categorize($user) == $sel_cat ? $sb2 : $sb1; map_gen_uid($uid, $top_unit, $sb); } }