id"); list($catid, $catcontext) = explode(',', $pagevars['cat']); if (!$category = $DB->get_record("question_categories", array("id" => $catid, 'contextid' => $catcontext))) { print_error('nocategory','quiz'); } /// Header $PAGE->set_url($thispageurl->out()); $PAGE->set_title($strexportquestions); if ($cm!==null) { $PAGE->navbar->add($strexportquestions); echo $OUTPUT->header(); $currenttab = 'edit'; $mode = 'export'; ${$cm->modname} = $module; include($CFG->dirroot."/mod/$cm->modname/tabs.php"); } else { // Print basic page layout. $PAGE->navbar->add($strexportquestions); echo $OUTPUT->header(); // print tabs $currenttab = 'export'; include('tabs.php'); } $exportfilename = default_export_filename($COURSE, $category); $export_form = new question_export_form($thispageurl, array('contexts'=>$contexts->having_one_edit_tab_cap('export'), 'defaultcategory'=>$pagevars['cat'], 'defaultfilename'=>$exportfilename)); if ($from_form = $export_form->get_data()) { /// Filename if (! is_readable("format/$from_form->format/format.php")) { print_error('unknowformat', '', '', $from_form->format); } // load parent class for import/export require_once("format.php"); // and then the class for the selected format require_once("format/$from_form->format/format.php"); $classname = "qformat_$from_form->format"; $qformat = new $classname(); $qformat->setContexts($contexts->having_one_edit_tab_cap('export')); $qformat->setCategory($category); $qformat->setCourse($COURSE); if (empty($from_form->exportfilename)) { $from_form->exportfilename = default_export_filename($COURSE, $category); } $qformat->setFilename($from_form->exportfilename); $canaccessbackupdata = has_capability('moodle/backup:backupcourse', $contexts->lowest()); $qformat->set_can_access_backupdata($canaccessbackupdata); $qformat->setCattofile(!empty($from_form->cattofile)); $qformat->setContexttofile(!empty($from_form->contexttofile)); if (! $qformat->exportpreprocess()) { // Do anything before that we need to print_error('exporterror', 'question', $thispageurl->out()); } if (! $qformat->exportprocess()) { // Process the export data print_error('exporterror', 'question', $thispageurl->out()); } if (! $qformat->exportpostprocess()) { // In case anything needs to be done after print_error('exporterror', 'question', $thispageurl->out()); } echo "