$filter_data->userid = $USER->id; if (($cpd_records = get_cpd_records($filter_data)) && !empty($download)) { // Add disclaimer $cpd_records[] = array(); $cpd_records[] = array(get_string('confirmstatement', 'report_cpd') . ':', ''); $cpd_records[] = array(get_string('date') . ':', ''); download_csv('cpd_record', $columns, $cpd_records); exit; } } else { $columns['edit'] = get_string('edit'); $columns['delete'] = get_string('delete'); } $cpd_years = get_cpd_menu('years'); $userid = $USER->id; $filter = new cpd_filter_form('index.php', compact('cpd_years', 'userid'), 'post', '', array('class' => 'cpdfilter')); if (empty($cpd_records)) { $filter_data = $filter->get_data(); if (empty($filter_data)) { // Filter object $filter_data = new stdClass(); $filter_data->userid = $USER->id; $cpdyearid = empty($cpdyearid) ? get_current_cpd_year() : $cpdyearid; $filter_data->cpdyearid = $cpdyearid; // Set cpd year id always needs to be set $filter_data->from = null; $filter_data->to = null; } if (!($errors = validate_filter($filter_data))) { $cpd_records = get_cpd_records($filter_data, true); }
$filter_data->cpdyearid = optional_param('cpdyearid', null, PARAM_INT); $filter_data->filterbydate = optional_param('filterbydate', null, PARAM_BOOL); $filter_data->from = optional_param('from', null, PARAM_INT); $filter_data->to = optional_param('to', null, PARAM_INT); $filter_data->activitytypeid = optional_param('activitytypeid', null, PARAM_INT); $filter_data->userid = optional_param('userid', null, PARAM_INT); $cpd_records = get_cpd_records($filter_data, false, $extra_columns, $returned); if ($cpd_records && !empty($download)) { download_csv('cpd_record', $columns, $cpd_records); exit; } } $cpd_years = get_cpd_menu('years'); $activity_types = get_cpd_menu('activity_types'); $users = get_users_by_capability($systemcontext, 'report/cpd:userview', 'u.id, u.firstname, u.lastname', 'lastname ASC'); $filter = new cpd_filter_form('adminview.php', compact('cpd_years', 'activity_types', 'users'), 'post', '', array('class' => 'cpdfilter')); if (empty($cpd_records)) { if ($filter_data = $filter->get_data()) { if (!($errors = validate_filter($filter_data))) { $cpd_records = get_cpd_records($filter_data, false, $extra_columns, $returned); } } } // Print the header. if (has_capability('report/cpd:superadminview', $systemcontext) && empty($print)) { admin_externalpage_setup('cpdadminview'); // Include styles $CFG->stylesheets[] = $CFG->wwwroot . '/admin/report/cpd/css/style.css'; } else { if (empty($print)) { $navlinks = array();