MDL-20636 Fix top of file boilerplate in mod/quiz.
[moodle.git] / question / export_form.php
CommitLineData
aeb15530 1<?php
515ed4c3 2
bfebaf64
MD
3if (!defined('MOODLE_INTERNAL')) {
4 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
5}
6
515ed4c3 7require_once($CFG->libdir.'/formslib.php');
8
9class question_export_form extends moodleform {
10
11 function definition() {
12 $mform =& $this->_form;
13
14 $defaultcategory = $this->_customdata['defaultcategory'];
15 $contexts = $this->_customdata['contexts'];
45b68eef 16//--------------------------------------------------------------------------------
17 $mform->addElement('header','fileformat',get_string('fileformat','quiz'));
18 $fileformatnames = get_import_export_formats('export');
19 $radioarray = array();
05f7f7c1 20 $i = 0 ;
f94902db 21 foreach ($fileformatnames as $shortname => $fileformatname) {
05f7f7c1 22 $currentgrp1 = array();
5fcefc97 23 $currentgrp1[] = &$mform->createElement('radio','format','',$fileformatname,$shortname);
05f7f7c1 24 $mform->addGroup($currentgrp1,"formathelp[$i]",'',array('<br />'),false);
5fcefc97 25 $mform->addHelpButton("formathelp[$i]", $shortname, 'qformat_'.$shortname);
05f7f7c1 26 $i++ ;
45b68eef 27 }
5a5487ff 28 $mform->addRule("formathelp[0]",null,'required',null,'client');
515ed4c3 29//--------------------------------------------------------------------------------
30 $mform->addElement('header','general', get_string('general', 'form'));
31
5fcefc97 32 $mform->addElement('questioncategory', 'category', get_string('exportcategory', 'question'), compact('contexts'));
515ed4c3 33 $mform->setDefault('category', $defaultcategory);
5fcefc97 34 $mform->addHelpButton('category', 'exportcategory', 'question');
515ed4c3 35
36 $categorygroup = array();
37 $categorygroup[] =& $mform->createElement('checkbox', 'cattofile', '', get_string('tofilecategory', 'question'));
38 $categorygroup[] =& $mform->createElement('checkbox', 'contexttofile', '', get_string('tofilecontext', 'question'));
39 $mform->addGroup($categorygroup, 'categorygroup', '', '', false);
40 $mform->disabledIf('categorygroup', 'cattofile', 'notchecked');
41 $mform->setDefault('cattofile', 1);
42 $mform->setDefault('contexttofile', 1);
aeb15530 43
45b68eef 44// $fileformatnames = get_import_export_formats('export');
45// $mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
46// $mform->setDefault('format', 'gift');
515ed4c3 47
aeb15530 48 // set a template for the format select elements
79e3dd8e 49 $renderer =& $mform->defaultRenderer();
50 $template = "{help} {element}\n";
51 $renderer->setGroupElementTemplate($template, 'format');
515ed4c3 52
53//--------------------------------------------------------------------------------
54 $this->add_action_buttons(false, get_string('exportquestions', 'quiz'));
55//--------------------------------------------------------------------------------
56 }
57}