MDL-54623 mod_assign: Unit test for list_participants()
[moodle.git] / mod / glossary / export.php
blobaf790b6b4f2c857f77b0323fbcdd5523852dacb7
1 <?php
3 require_once("../../config.php");
4 require_once("lib.php");
6 $id = required_param('id', PARAM_INT); // Course Module ID
8 $mode= optional_param('mode', '', PARAM_ALPHA); // term entry cat date letter search author approval
9 $hook= optional_param('hook', '', PARAM_CLEAN); // the term, entry, cat, etc... to look for based on mode
10 $cat = optional_param('cat',0, PARAM_ALPHANUM);
12 $url = new moodle_url('/mod/glossary/export.php', array('id'=>$id));
13 if ($cat !== 0) {
14 $url->param('cat', $cat);
16 if ($mode !== '') {
17 $url->param('mode', $mode);
20 $PAGE->set_url($url);
22 if (! $cm = get_coursemodule_from_id('glossary', $id)) {
23 print_error('invalidcoursemodule');
26 if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
27 print_error('coursemisconf');
30 if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
31 print_error('invalidid', 'glossary');
34 require_login($course, false, $cm);
36 $context = context_module::instance($cm->id);
37 require_capability('mod/glossary:export', $context);
39 $strglossaries = get_string("modulenameplural", "glossary");
40 $strglossary = get_string("modulename", "glossary");
41 $strallcategories = get_string("allcategories", "glossary");
42 $straddentry = get_string("addentry", "glossary");
43 $strnoentries = get_string("noentries", "glossary");
44 $strsearchindefinition = get_string("searchindefinition", "glossary");
45 $strsearch = get_string("search");
46 $strexportfile = get_string("exportfile", "glossary");
47 $strexportentries = get_string('exportentriestoxml', 'glossary');
49 $PAGE->set_url('/mod/glossary/export.php', array('id'=>$cm->id));
50 $PAGE->navbar->add($strexportentries);
51 $PAGE->set_title($glossary->name);
52 $PAGE->set_heading($course->fullname);
54 echo $OUTPUT->header();
55 echo $OUTPUT->heading($strexportentries);
56 echo $OUTPUT->box_start('glossarydisplay generalbox');
57 $exporturl = moodle_url::make_pluginfile_url($context->id, 'mod_glossary', 'export', 0, "/$cat/", 'export.xml', true);
60 <form action="<?php echo $exporturl->out(); ?>" method="post">
61 <table border="0" cellpadding="6" cellspacing="6" width="100%">
62 <tr><td align="center">
63 <input type="submit" value="<?php p($strexportfile)?>" />
64 </td></tr></table>
65 <div>
66 </div>
67 </form>
68 <?php
69 // don't need cap check here, we share with the general export.
70 if (!empty($CFG->enableportfolios) && $DB->count_records('glossary_entries', array('glossaryid' => $glossary->id))) {
71 require_once($CFG->libdir . '/portfoliolib.php');
72 $button = new portfolio_add_button();
73 $button->set_callback_options('glossary_full_portfolio_caller', array('id' => $cm->id), 'mod_glossary');
74 $button->render();
76 echo $OUTPUT->box_end();
77 echo $OUTPUT->footer();