~ubuntu-branches/ubuntu/utopic/moodle/utopic

« back to all changes in this revision

Viewing changes to report/loglive/index.php

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-05-12 16:10:38 UTC
  • mfrom: (36.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140512161038-puyqf65k4e0s8ytz
Tags: 2.6.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
40
40
 
41
 
require_login($course);
 
41
if ($course->id == SITEID) {
 
42
    require_login();
 
43
    $PAGE->set_context(context_system::instance());
 
44
} else {
 
45
    require_login($course);
 
46
}
42
47
 
43
48
$context = context_course::instance($course->id);
44
49
require_capability('report/loglive:view', $context);
45
50
 
46
51
$strlivelogs = get_string('livelogs', 'report_loglive');
 
52
if (!empty($page)) {
 
53
    $strlogs = get_string('logs'). ": ". get_string('page', 'report_loglive', $page + 1);
 
54
} else {
 
55
    $strlogs = get_string('logs');
 
56
}
47
57
 
48
58
if ($inpopup) {
49
 
    session_get_instance()->write_close();
50
 
 
51
 
    add_to_log($course->id, 'course', 'report live', "report/loglive/index.php?id=$course->id", $course->id);
 
59
    \core\session\manager::write_close();
52
60
 
53
61
    $date = time() - 3600;
54
62
 
65
73
    $PAGE->set_heading($strlivelogs);
66
74
    echo $OUTPUT->header();
67
75
 
 
76
    // Trigger a content view event.
 
77
    $event = \report_loglive\event\content_viewed::create(array('courseid' => $course->id,
 
78
                                                                'other'    => array('content' => 'loglive')));
 
79
    $event->set_page_detail();
 
80
    $event->set_legacy_logdata(array($course->id, 'course', 'report live', "report/loglive/index.php?id=$course->id", $course->id));
 
81
    $event->trigger();
 
82
 
68
83
    print_log($course, 0, $date, "l.time DESC", $page, 500, $url);
69
84
 
70
85
    echo $OUTPUT->footer();
78
93
 
79
94
} else {
80
95
    $PAGE->set_url('/report/log/live.php', array('id'=>$course->id));
81
 
    $PAGE->set_title($course->shortname .': '. $strlogs);
 
96
    $PAGE->set_title($course->shortname .': '. $strlivelogs);
82
97
    $PAGE->set_heading($course->fullname);
83
98
    echo $OUTPUT->header();
84
99
}