public function definition() { global $CFG, $USER, $OUTPUT, $COURSE; $strrequired = get_string('required'); $mform =& $this->_form; $bmh = new local_quedit_manager(); $cats = $bmh->get_question_categories(); $options = array(); foreach ($cats as $cat) { $options[$cat->id] = $cat->name; } $mform->addElement('select', 'catid', get_string('select_category', 'local_quedit'), $options); $mform->setType('catid', PARAM_INT); $options = array(); $options['videoproctormc'] = 'Video Proctor Multi-Choice'; $options['multichoice'] = 'Multi-Choice'; $mform->addElement('select', 'qtype', get_string('qtype', 'local_quedit'), $options); $mform->setType('groupid', PARAM_INT); $mform->addElement('advcheckbox', 'includechildren', get_string('includechildren', 'local_quedit'), '', null, array(0, 1)); $mform->setType('includechildren', PARAM_INT); $mform->addElement('hidden', 'action', 'dogetcategory'); $mform->setType('action', PARAM_TEXT); $mform->addElement('submit', 'submitbutton', get_string('docat_label', 'local_quedit')); }
/** * Show *all* families * @param string $message any status messages can be displayed */ function local_quedit_show_all_questions($catid, $includechildren, $qtype, $renderer, $message = false) { if ($message) { echo $renderer->heading($message, 5, 'main'); } $gdata = new stdClass(); $catform = new local_quedit_category_form(); $gdata->catid = $catid; $gdata->includechildren = $includechildren; $catform->set_data($gdata); $catform->display(); $bfm = new local_quedit_manager($catid); $queditdata = $bfm->get_qanda2($catid, $includechildren, $qtype); //print_r($queditdata); $fieldcount = count($queditdata['qid']); if ($fieldcount > 0) { $manyform = new local_quedit_many_form(null, array('fieldcount' => $fieldcount)); $manyform->set_data($queditdata); $manyform->display(); } else { echo $renderer->heading(get_string('noquestions', 'local_quedit'), 5, 'main'); } //print_r($queditdata); //$renderer->show_families_list($queditdata, $message); }