Пример #1
0
            ExportToCSV($data, $filename);
        } else {
            ExportToTableEd($data, $filename, $fromform->format);
        }
        exit;
    } else {
        print_error('Students not found!', 'report.php?id=' . $id);
    }
} else {
    /// Print headers
    $navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id={$id}", 'type' => 'activity');
    $navlinks[] = array('name' => get_string('export', 'quiz'), 'link' => null, 'type' => 'activityinstance');
    $navigation = build_navigation($navlinks);
    print_header("{$course->shortname}: " . $attforblock->name . ' - ' . get_string('export', 'quiz'), $course->fullname, $navigation, "", "", true, " ", navmenu($course));
    show_tabs($cm, $context, 'export');
    $mform_export->display();
}
echo $OUTPUT->footer($course);
/////////////////////////////////////////////////////////////////////////////////
function ExportToTableEd($data, $filename, $format)
{
    global $CFG;
    if ($format === 'excel') {
        require_once "{$CFG->libdir}/excellib.class.php";
        $filename .= ".xls";
        $workbook = new MoodleExcelWorkbook("-");
    } else {
        require_once "{$CFG->libdir}/odslib.class.php";
        $filename .= ".ods";
        $workbook = new MoodleODSWorkbook("-");
    }
Пример #2
0
        if ($formdata->format === 'text') {
            ExportToCSV($data, $filename);
        } else {
            ExportToTableEd($data, $filename, $formdata->format);
        }
        exit;
    } else {
        print_error('studentsnotfound', 'attendance', $att->url_manage());
    }
}
$output = $PAGE->get_renderer('mod_attforblock');
$tabs = new attforblock_tabs($att, attforblock_tabs::TAB_EXPORT);
echo $output->header();
echo $output->heading(get_string('attendanceforthecourse', 'attforblock') . ' :: ' . $course->fullname);
echo $output->render($tabs);
$mform->display();
echo $OUTPUT->footer();
function ExportToTableEd($data, $filename, $format)
{
    global $CFG;
    if ($format === 'excel') {
        require_once "{$CFG->libdir}/excellib.class.php";
        $filename .= ".xls";
        $workbook = new MoodleExcelWorkbook("-");
    } else {
        require_once "{$CFG->libdir}/odslib.class.php";
        $filename .= ".ods";
        $workbook = new MoodleODSWorkbook("-");
    }
    /// Sending HTTP headers
    $workbook->send($filename);