Select Git revision
Gemfile.lock
-
Imran Iqbal authored
* Automated using https://github.com/myii/ssf-formula/pull/449
Imran Iqbal authored* Automated using https://github.com/myii/ssf-formula/pull/449
This project manages its dependencies using Bundler.
Learn more
action_download.php 1.88 KiB
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Wrapper script redirecting user operations to correct destination.
*
* @copyright 1999 Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package local_hshexport
*/
use local_hshexport\local\helpers\download;
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir.'/csvlib.class.php');
$PAGE->set_url('/local/hshexport/action_download.php');
if (!confirm_sesskey()) {
throw new \moodle_exception('confirmsesskeybad');
}
$course_code = optional_param('course_code', null, PARAM_ALPHANUMEXT);
$courseid = required_param('courseid', PARAM_INT);
$coursecontextid = required_param('coursecontextid', PARAM_INT);
$roles = required_param_array('roles',PARAM_INT);
$roleids = array_values(array_filter($roles));
$filename = download::get_evaluation_filename($courseid, $course_code);
$users = local_hshexport\local\helpers\user_query::get_users_by_role($courseid, $coursecontextid, $roleids);
if (!$course_code) {
$course = get_course($courseid);
$course_code = $course->shortname;
}
$rows = local_hshexport\local\helpers\download::get_rows($users, $course_code);
\csv_export_writer::download_array($filename, $rows, $delimiter='semicolon');