2009-11-04 11:57:52 +00:00
|
|
|
<?php
|
2007-08-09 22:44:14 +00:00
|
|
|
|
2010-05-13 02:02:05 +00:00
|
|
|
if (!defined('MOODLE_INTERNAL')) {
|
|
|
|
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
|
|
|
}
|
|
|
|
|
2007-08-09 22:44:14 +00:00
|
|
|
require_once($CFG->libdir.'/formslib.php');
|
|
|
|
|
|
|
|
class question_export_form extends moodleform {
|
|
|
|
|
|
|
|
function definition() {
|
|
|
|
$mform =& $this->_form;
|
|
|
|
|
|
|
|
$defaultcategory = $this->_customdata['defaultcategory'];
|
|
|
|
$contexts = $this->_customdata['contexts'];
|
2007-08-17 15:15:21 +00:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
$mform->addElement('header','fileformat',get_string('fileformat','quiz'));
|
|
|
|
$fileformatnames = get_import_export_formats('export');
|
|
|
|
$radioarray = array();
|
2010-04-24 09:25:32 +00:00
|
|
|
$i = 0 ;
|
2008-07-10 15:06:19 +00:00
|
|
|
foreach ($fileformatnames as $shortname => $fileformatname) {
|
2010-04-24 09:25:32 +00:00
|
|
|
$currentgrp1 = array();
|
MDL-21695 question: replaced help files with new help strings
AMOS BEGIN
HLP question/categoryparent.html,[parentcategory_help,core_question]
HLP question/categories.html,[editcategories_help,core_question]
HLP quiz/export.html,[exportquestions_help,core_question]
HLP quiz/exportcategory.html,[exportcategory_help,core_question]
HLP quiz/exportcategory.html,[exportcategory_help,core_question]
HLP quiz/importcategory.html,[importcategory_help,core_question]
HLP quiz/matchgrades.html,[matchgrades_help,core_question]
HLP quiz/quiz/stoponerror.html,[stoponerror_help,core_question]
HLP qtype_multichoice/multichoiceshuffle.html,[shuffleanswers_help,qtype_multichoice]
HLP quiz/matchshuffle.html,[shuffle_help,qtype_match]
HLP quiz/generalfeedback.html,[generalfeedback_help,mod_quiz]
AMOS END
2010-08-02 21:24:32 +00:00
|
|
|
$currentgrp1[] = &$mform->createElement('radio','format','',$fileformatname,$shortname);
|
2010-04-24 09:25:32 +00:00
|
|
|
$mform->addGroup($currentgrp1,"formathelp[$i]",'',array('<br />'),false);
|
MDL-21695 question: replaced help files with new help strings
AMOS BEGIN
HLP question/categoryparent.html,[parentcategory_help,core_question]
HLP question/categories.html,[editcategories_help,core_question]
HLP quiz/export.html,[exportquestions_help,core_question]
HLP quiz/exportcategory.html,[exportcategory_help,core_question]
HLP quiz/exportcategory.html,[exportcategory_help,core_question]
HLP quiz/importcategory.html,[importcategory_help,core_question]
HLP quiz/matchgrades.html,[matchgrades_help,core_question]
HLP quiz/quiz/stoponerror.html,[stoponerror_help,core_question]
HLP qtype_multichoice/multichoiceshuffle.html,[shuffleanswers_help,qtype_multichoice]
HLP quiz/matchshuffle.html,[shuffle_help,qtype_match]
HLP quiz/generalfeedback.html,[generalfeedback_help,mod_quiz]
AMOS END
2010-08-02 21:24:32 +00:00
|
|
|
$mform->addHelpButton("formathelp[$i]", $shortname, 'qformat_'.$shortname);
|
2010-04-24 09:25:32 +00:00
|
|
|
$i++ ;
|
2007-08-17 15:15:21 +00:00
|
|
|
}
|
2010-04-24 09:48:37 +00:00
|
|
|
$mform->addRule("formathelp[0]",null,'required',null,'client');
|
2007-08-09 22:44:14 +00:00
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
$mform->addElement('header','general', get_string('general', 'form'));
|
|
|
|
|
MDL-21695 question: replaced help files with new help strings
AMOS BEGIN
HLP question/categoryparent.html,[parentcategory_help,core_question]
HLP question/categories.html,[editcategories_help,core_question]
HLP quiz/export.html,[exportquestions_help,core_question]
HLP quiz/exportcategory.html,[exportcategory_help,core_question]
HLP quiz/exportcategory.html,[exportcategory_help,core_question]
HLP quiz/importcategory.html,[importcategory_help,core_question]
HLP quiz/matchgrades.html,[matchgrades_help,core_question]
HLP quiz/quiz/stoponerror.html,[stoponerror_help,core_question]
HLP qtype_multichoice/multichoiceshuffle.html,[shuffleanswers_help,qtype_multichoice]
HLP quiz/matchshuffle.html,[shuffle_help,qtype_match]
HLP quiz/generalfeedback.html,[generalfeedback_help,mod_quiz]
AMOS END
2010-08-02 21:24:32 +00:00
|
|
|
$mform->addElement('questioncategory', 'category', get_string('exportcategory', 'question'), compact('contexts'));
|
2007-08-09 22:44:14 +00:00
|
|
|
$mform->setDefault('category', $defaultcategory);
|
MDL-21695 question: replaced help files with new help strings
AMOS BEGIN
HLP question/categoryparent.html,[parentcategory_help,core_question]
HLP question/categories.html,[editcategories_help,core_question]
HLP quiz/export.html,[exportquestions_help,core_question]
HLP quiz/exportcategory.html,[exportcategory_help,core_question]
HLP quiz/exportcategory.html,[exportcategory_help,core_question]
HLP quiz/importcategory.html,[importcategory_help,core_question]
HLP quiz/matchgrades.html,[matchgrades_help,core_question]
HLP quiz/quiz/stoponerror.html,[stoponerror_help,core_question]
HLP qtype_multichoice/multichoiceshuffle.html,[shuffleanswers_help,qtype_multichoice]
HLP quiz/matchshuffle.html,[shuffle_help,qtype_match]
HLP quiz/generalfeedback.html,[generalfeedback_help,mod_quiz]
AMOS END
2010-08-02 21:24:32 +00:00
|
|
|
$mform->addHelpButton('category', 'exportcategory', 'question');
|
2007-08-09 22:44:14 +00:00
|
|
|
|
|
|
|
$categorygroup = array();
|
|
|
|
$categorygroup[] =& $mform->createElement('checkbox', 'cattofile', '', get_string('tofilecategory', 'question'));
|
|
|
|
$categorygroup[] =& $mform->createElement('checkbox', 'contexttofile', '', get_string('tofilecontext', 'question'));
|
|
|
|
$mform->addGroup($categorygroup, 'categorygroup', '', '', false);
|
|
|
|
$mform->disabledIf('categorygroup', 'cattofile', 'notchecked');
|
|
|
|
$mform->setDefault('cattofile', 1);
|
|
|
|
$mform->setDefault('contexttofile', 1);
|
2009-11-04 11:57:52 +00:00
|
|
|
|
2007-08-17 15:15:21 +00:00
|
|
|
// $fileformatnames = get_import_export_formats('export');
|
|
|
|
// $mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
|
|
|
|
// $mform->setDefault('format', 'gift');
|
2007-08-09 22:44:14 +00:00
|
|
|
|
2009-11-04 11:57:52 +00:00
|
|
|
// set a template for the format select elements
|
2008-07-09 13:07:29 +00:00
|
|
|
$renderer =& $mform->defaultRenderer();
|
|
|
|
$template = "{help} {element}\n";
|
|
|
|
$renderer->setGroupElementTemplate($template, 'format');
|
2007-08-09 22:44:14 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
$this->add_action_buttons(false, get_string('exportquestions', 'quiz'));
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
}
|
|
|
|
}
|