Beispiel #1
0
$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->set_data(compact('cpdyearid'));
} else {
    $filter->set_data((array) $filter_data);
}
$jsmodule = array('name' => 'report_cpd', 'fullpath' => '/' . $CFG->admin . '/report/cpd/module.js', 'requires' => array('base', 'node'));
if (empty($print)) {
    // Print the header.
    admin_externalpage_setup('cpdrecord');
    // Include styles
    $printparams = (array) $filter_data + array('print' => 1);
    $printlink = new moodle_url('/admin/report/cpd/index.php', $printparams);
    $PAGE->requires->string_for_js('printlandscape', 'report_cpd');
    $PAGE->requires->js_init_call('M.report_cpd.init', array(false, $printlink->out(false)));
} else {
Beispiel #2
0
    $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();
        $navlinks[] = array('name' => get_string('reports', 'report_cpd'), 'link' => null, 'type' => 'misc');
        $navlinks[] = array('name' => get_string('cpddevreport', 'report_cpd'), 'link' => null, 'type' => 'misc');
        $navigation = build_navigation($navlinks);
        // Include styles