|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00026 require('../../config.php'); 00027 require_once($CFG->libdir.'/adminlib.php'); 00028 require_once($CFG->dirroot.'/course/lib.php'); 00029 00030 if (!defined('REPORT_LOGLIVE_REFRESH')) { 00031 define('REPORT_LOGLIVE_REFRESH', 60); // Seconds 00032 } 00033 00034 $id = optional_param('id', $SITE->id, PARAM_INT); 00035 $page = optional_param('page', 0, PARAM_INT); 00036 $inpopup = optional_param('inpopup', 0, PARAM_BOOL); 00037 00038 $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST); 00039 00040 require_login($course); 00041 00042 $context = context_course::instance($course->id); 00043 require_capability('report/loglive:view', $context); 00044 00045 $strlivelogs = get_string('livelogs', 'report_loglive'); 00046 00047 if ($inpopup) { 00048 session_get_instance()->write_close(); 00049 00050 add_to_log($course->id, 'course', 'report live', "report/loglive/index.php?id=$course->id", $course->id); 00051 00052 $date = time() - 3600; 00053 00054 $url = new moodle_url('/report/loglive/index.php', array('id'=>$course->id, 'user'=>0, 'date'=>$date, 'inpopup'=>1)); 00055 00056 $strupdatesevery = get_string('updatesevery', 'moodle', REPORT_LOGLIVE_REFRESH); 00057 00058 $coursename = format_string($course->fullname, true, array('context'=>$context)); 00059 00060 $PAGE->set_url($url); 00061 $PAGE->set_pagelayout('popup'); 00062 $PAGE->set_title("$coursename: $strlivelogs ($strupdatesevery)"); 00063 $PAGE->set_periodic_refresh_delay(REPORT_LOGLIVE_REFRESH); 00064 $PAGE->set_heading($strlivelogs); 00065 echo $OUTPUT->header(); 00066 00067 print_log($course, 0, $date, "l.time DESC", $page, 500, $url); 00068 00069 echo $OUTPUT->footer(); 00070 exit; 00071 } 00072 00073 00074 if ($course->id == SITEID) { 00075 admin_externalpage_setup('reportloglive', '', null, '', array('pagelayout'=>'report')); 00076 echo $OUTPUT->header(); 00077 00078 } else { 00079 $PAGE->set_url('/report/log/live.php', array('id'=>$course->id)); 00080 $PAGE->set_title($course->shortname .': '. $strlogs); 00081 $PAGE->set_heading($course->fullname); 00082 echo $OUTPUT->header(); 00083 } 00084 00085 echo $OUTPUT->heading(get_string('pluginname', 'report_loglive')); 00086 00087 echo $OUTPUT->container_start('info'); 00088 $link = new moodle_url('/report/loglive/index.php', array('id'=>$course->id, 'inpopup'=>1)); 00089 echo $OUTPUT->action_link($link, $strlivelogs, new popup_action('click', $link, 'livelog', array('height' => 500, 'width' => 800))); 00090 echo $OUTPUT->container_end(); 00091 00092 echo $OUTPUT->footer();