<?php

// $Id: mod.php,v 1.0 Exp $
if (!defined('MOODLE_INTERNAL')) {
    die('Direct access to this script is forbidden.');
    ///  It must be included from a Moodle page
}
require_once $CFG->dirroot . '/course/lib.php';
require_once $CFG->dirroot . '/course/report/dates/lib.php';
//    if (has_capability('coursereport/log:view', $context)) {
print_heading(get_string('choosesummeryreport', 'report_dates') . ':');
print_log_selector_form1($course);
//  }
                print_footer($course);
            }
            exit;
        case 'downloadasods':
            if (!print_log_ods1($course, $user, $date, $date1, 'l.time DESC', $modname, $modid, $modaction, $group)) {
                notify("No logs found!");
                print_footer($course);
            }
            exit;
        case 'downloadasexcel':
            if (!print_log_xls1($course, $user, $date, $date1, 'l.time DESC', $modname, $modid, $modaction, $group)) {
                notify("No logs found!");
                print_footer($course);
            }
            exit;
    }
} else {
    if ($hostid != $CFG->mnet_localhost_id || $course->id == SITEID) {
        admin_externalpage_setup('reportlog');
        admin_externalpage_print_header();
    } else {
        $navlinks[] = array('name' => $strreports, 'link' => "{$CFG->wwwroot}/course/report.php?id={$course->id}", 'type' => 'misc');
        $navlinks[] = array('name' => $strlogs, 'link' => null, 'type' => 'misc');
        $navigation = build_navigation($navlinks);
        print_header($course->shortname . ': ' . $strlogs, $course->fullname, $navigation, '');
    }
    print_heading(get_string('chooselogs') . ':');
    print_log_selector_form1($course, $user, $date, $date1, $modname, $modid, $modaction, $group, $showcourses, $showusers, $logformat);
}
print_footer($course);
exit;