Select Git revision
-
Alexander Bias authoredAlexander Bias authored
To find the state of this project's repository at the time of any of these versions, check out the tags.
action_download.php 1.72 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');
$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);
$roleids = required_param_array('select_roles', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$coursecontextid = required_param('coursecontextid', PARAM_INT);
$filename = download::get_evaluation_filename($courseid, $course_code);
$rows = local_hshexport\local\helpers\user_query::get_users_by_role($courseid, $coursecontextid, $roleids);
if ($course_code != null) {
$rows = local_hshexport\local\helpers\download::get_rows($rows, $course_code);
}
\core\dataformat::download_data($filename, 'csv', [], $rows);