$url = new moodle_url('/mod/oublog/participationlist.php', $params);
$PAGE->set_url($url);
$getposts = true;
$getcomments = false;
$limitnum = OUBLOG_PARTICIPATION_PERPAGE;
$limitfrom = empty($page) ? null : $page * $limitnum;
$cm = get_coursemodule_from_id('oublog', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$oublog = $DB->get_record('oublog', array('id' => $cm->instance), '*', MUST_EXIST);
$PAGE->set_cm($cm);
$context = context_module::instance($cm->id);
$PAGE->set_pagelayout('incourse');
require_course_login($course, true, $cm);
// Create time filter options form.
$customdata = array('cmid' => $cm->id, 'individual' => $curindividual, 'group' => $groupid, 'startyear' => $course->startdate, 'params' => array('tab' => $tab));
$timefilter = new oublog_participation_timefilter_form(null, $customdata);
$start = $end = 0;
// If data has been received from this form.
if ($submitted = $timefilter->get_data()) {
    if ($submitted->start) {
        $start = strtotime('00:00:00', $submitted->start);
    }
    if ($submitted->end) {
        $end = strtotime('23:59:59', $submitted->end);
    }
} else {
    // Recieved via post back for tab useage.
    if ($start = optional_param('start', null, PARAM_INT)) {
        $timefilter->set_data(array('start' => $start));
        $start = strtotime('00:00:00', $start);
    }
$viewonlyown = $canview == OUBLOG_MY_PARTICIPATION && $USER->id != $userid;
if ($oublog->global && $USER->id == $userid) {
    $viewonlyown = false;
    $canview = OUBLOG_MY_PARTICIPATION;
}
if ($canview == OUBLOG_NO_PARTICIPATION || $viewonlyown) {
    print_error('nopermissiontoshow');
}
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
// all enrolled users for table pagination
$coursecontext = context_course::instance($course->id);
// Create time filter options form.
$default = get_user_preferences('mod_oublog_postformfilter', OUBLOG_STATS_TIMEFILTER_ALL);
// Create time filter options form.
$customdata = array('options' => array(), 'cmid' => $cm->id, 'user' => $userid, 'group' => $groupid, 'download' => $download, 'startyear' => $course->startdate, 'params' => array());
$timefilter = new oublog_participation_timefilter_form(null, $customdata);
$start = $end = 0;
// If data has been received from this form.
if ($submitted = $timefilter->get_data()) {
    if ($submitted->start) {
        $start = strtotime('00:00:00', $submitted->start);
    }
    if ($submitted->end) {
        $end = strtotime('23:59:59', $submitted->end);
    }
} else {
    if (!$timefilter->is_submitted()) {
        // Recieved via post back.
        if ($start = optional_param('start', null, PARAM_INT)) {
            $start = strtotime('00:00:00', $start);
        }