function definition() { $mform =& $this->_form; $qcreate = $this->_customdata['qcreate']; if ($qcreate->graderatio != 100) { //-------------------------------------------------------------------------------- $mform->addElement('header', 'exportselection', get_string('exportselection', 'qcreate')); $menu = make_grades_menu($qcreate->grade); unset($menu[0]); $menu += array(0 => get_string('allquestions', 'qcreate')); $mform->addElement('select', 'betterthangrade', get_string('betterthangrade', 'qcreate'), $menu); $mform->setDefault('betterthangrade', 0); } $mform->addElement('header', 'exportnaming', get_string('exportnaming', 'qcreate')); $cbarray3 = array(); $cbarray3[] =& MoodleQuickForm::createElement('checkbox', 'naming[other]', '', get_string('specifictext', 'qcreate')); $cbarray3[] =& MoodleQuickForm::createElement('text', 'naming[othertext]'); $mform->addGroup($cbarray3, 'naming3', '', array(' '), false); $mform->disabledIf('naming3', 'naming[other]'); $cbarray1 = array(); $cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[firstname]', '', get_string('firstname')); $cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[lastname]', '', get_string('lastname')); $cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[username]', '', get_string('username', 'qcreate')); $mform->addGroup($cbarray1, 'naming1', '', array(' '), false); $cbarray2 = array(); $cbarray2[] =& MoodleQuickForm::createElement('checkbox', 'naming[activityname]', '', get_string('activityname', 'qcreate')); $cbarray2[] =& MoodleQuickForm::createElement('checkbox', 'naming[timecreated]', '', get_string('timecreated', 'qcreate')); $mform->addGroup($cbarray2, 'naming2', '', array(' '), false); parent::definition(); }
// get display strings $strexportquestions = get_string('exportquestions', 'question'); // make sure we are using the user's most recent category choice if (empty($categoryid)) { $categoryid = $pagevars['cat']; } 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); $PAGE->set_heading($COURSE->fullname); echo $OUTPUT->header(); $export_form = new question_export_form($thispageurl, array('contexts' => $contexts->having_one_edit_tab_cap('export'), 'defaultcategory' => $pagevars['cat'])); if ($from_form = $export_form->get_data()) { $thiscontext = $contexts->lowest(); if (!is_readable("format/{$from_form->format}/format.php")) { print_error('unknowformat', '', '', $from_form->format); } $withcategories = 'nocategories'; if (!empty($from_form->cattofile)) { $withcategories = 'withcategories'; } $withcontexts = 'nocontexts'; if (!empty($from_form->contexttofile)) { $withcontexts = 'withcontexts'; } $classname = 'qformat_' . $from_form->format; $qformat = new $classname();