Exemplo n.º 1
0
}
// Set up the course overview table.
$coursecomptable = new html_table();
$coursecomptable->head = array(get_string('coursename', 'local_report_completion'), get_string('numusers', 'local_report_completion'), get_string('notstartedusers', 'local_report_completion'), get_string('inprogressusers', 'local_report_completion'), get_string('completedusers', 'local_report_completion'));
$coursecomptable->align = array('left', 'center', 'center', 'center', 'center', 'center');
$coursecomptable->width = '95%';
$chartdata = array();
if (!empty($dodownload)) {
    // Set up the Excel workbook.
    header("Content-Type: application/download\n");
    header("Content-Disposition: attachment; filename=\"coursereport.csv\"");
    header("Expires: 0");
    header("Cache-Control: must-revalidate,post-check=0,pre-check=0");
    header("Pragma: public");
}
$courseinfo = iomad::get_course_summary_info($departmentid, 0, $showsuspended);
$chartnumusers = array();
$chartnotstarted = array();
$chartinprogress = array();
$chartcompleted = array();
$chartname = array();
// Iterate over courses.
foreach ($courseinfo as $id => $coursedata) {
    $coursecomptable->data[] = array("<a href='" . new moodle_url($url, array('courseid' => $coursedata->id, 'departmentid' => $departmentid, 'showchart' => 0, 'charttype' => '')) . "'>{$coursedata->coursename}</a>", $coursedata->numenrolled, $coursedata->numnotstarted, $coursedata->numstarted - $coursedata->numcompleted, $coursedata->numcompleted);
    if ($charttype == 'summary') {
        $chartname[] = $coursedata->coursename;
        $chartnumusers[] = $coursedata->numenrolled;
        $chartnotstarted[] = $coursedata->numnotstarted;
        $chartinprogress[] = $coursedata->numstarted - $coursedata->numcompleted;
        $chartcompleted[] = $coursedata->numcompleted;
    } else {