Пример #1
0
$PAGE->set_title(format_string($mootyper->name));
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_context($context);
$PAGE->set_cacheable(false);
echo $OUTPUT->header();
echo '<link rel="stylesheet" type="text/css" href="style.css">';
echo $OUTPUT->heading($mootyper->name);
$htmlout = '';
$htmlout .= '<div id="mainDiv">';
if (has_capability('mod/mootyper:viewgrades', context_module::instance($cm->id))) {
    if ($mootyper->isexam) {
        //$grds = get_typergradesfull($_GET['n'], $orderBy, $des);
        if ($des == -1) {
            $des = 0;
        }
        $grds = get_typergradesfull($mootyper->id, $orderBy, $des);
        if ($des == -1 || $des == 1) {
            $lnkAdd = "&desc=0";
        } else {
            $lnkAdd = "&desc=1";
        }
        $arrTextAdds = array();
        $arrTextAdds[2] = '<span class="arrow-s" style="font-size:1em;"></span>';
        $arrTextAdds[4] = '<span class="arrow-s" style="font-size:1em;"></span>';
        $arrTextAdds[5] = '<span class="arrow-s" style="font-size:1em;"></span>';
        $arrTextAdds[6] = '<span class="arrow-s" style="font-size:1em;"></span>';
        $arrTextAdds[7] = '<span class="arrow-s" style="font-size:1em;"></span>';
        $arrTextAdds[8] = '<span class="arrow-s" style="font-size:1em;"></span>';
        $arrTextAdds[9] = '<span class="arrow-s" style="font-size:1em;"></span>';
        $arrTextAdds[12] = '<span class="arrow-s" style="font-size:1em;"></span>';
        $arrTextAdds[$orderBy] = $des == -1 || $des == 1 ? '<span class="arrow-s" style="font-size:1em;"></span>' : '<span class="arrow-n" style="font-size:1em;"></span>';
Пример #2
0
<?php

function array_to_csv_download($array, $filename = "export.csv", $delimiter = ";")
{
    header('Content-Type: application/csv');
    header('Content-Disposition: attachement; filename="' . $filename . '";');
    header("Pragma: no-cache");
    header("Expires: 0");
    $f = fopen('php://output', 'w');
    $headings = array(get_string('student', 'mootyper'), get_string('vmistakes', 'mootyper'), get_string('timeinseconds', 'mootyper'), get_string('hitsperminute', 'mootyper'), get_string('fullhits', 'mootyper'), get_string('precision', 'mootyper'), get_string('timetaken', 'mootyper'), get_string('wpm', 'mootyper'));
    fputcsv($f, $headings, $delimiter);
    foreach ($array as $gr) {
        $fields = array($gr->firstname . ' ' . $gr->lastname, $gr->mistakes, $gr->timeinseconds . ' s', $gr->hitsperminute, $gr->fullhits, $gr->precisionfield . '%', date('d. M Y G:i', $gr->timetaken), $gr->wpm);
        fputcsv($f, $fields, $delimiter);
    }
    fclose($f);
}
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once dirname(__FILE__) . '/lib.php';
require_once dirname(__FILE__) . '/locallib.php';
$m_id = optional_param('mootyperid', 0, PARAM_INT);
$m_is_exam = optional_param('isexam', 0, PARAM_INT);
if ($m_is_exam) {
    $grds = get_typergradesfull($m_id, 2, 0);
} else {
    $grds = get_typer_grades_adv($m_id, 0, 0, 2, 0);
}
array_to_csv_download($grds, get_string('gradesfilename', 'mootyper'));