MDL-11082 Improved groups upgrade performance 1.8x -> 1.9; thanks Eloy for telling...
[moodle-pu.git] / mod / glossary / exportfile.php
blobb88059b5ce2548df966cfd3edc3af47a8d0a057e
1 <?php // $Id$
3 require_once("../../config.php");
4 require_once("lib.php");
6 // disable moodle specific debug messages
7 disable_debugging();
9 $id = required_param('id', PARAM_INT); // Course Module ID
11 $l = optional_param('l','', PARAM_ALPHANUM);
12 $cat = optional_param('cat',0, PARAM_ALPHANUM);
14 if (! $cm = get_coursemodule_from_id('glossary', $id)) {
15 error("Course Module ID was incorrect");
18 if (! $course = get_record("course", "id", $cm->course)) {
19 error("Course is misconfigured");
22 if (! $glossary = get_record("glossary", "id", $cm->instance)) {
23 error("Course module is incorrect");
26 require_login($course->id, false, $cm);
28 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
29 require_capability('mod/glossary:export', $context);
31 $filename = clean_filename(strip_tags(format_string($glossary->name,true)).'.xml');
32 $content = glossary_generate_export_file($glossary,$l,$cat);
34 send_file($content, $filename, 0, 0, true, true);