MDL-19214 Adding category hidden element Merging from HEAD
This commit is contained in:
@@ -28,6 +28,13 @@ class question_dataset_dependent_definitions_form extends moodleform {
|
||||
global $QTYPES;
|
||||
$this->question = $question;
|
||||
$this->qtypeobj =& $QTYPES[$this->question->qtype];
|
||||
// Validate the question category.
|
||||
if (!$category = get_record('question_categories', 'id', $question->category)) {
|
||||
print_error('categorydoesnotexist', 'question', $returnurl);
|
||||
}
|
||||
$this->category = $category;
|
||||
$this->categorycontext = get_context_instance_by_id($category->contextid);
|
||||
|
||||
parent::moodleform($submiturl);
|
||||
}
|
||||
function definition() {
|
||||
@@ -107,6 +114,10 @@ class question_dataset_dependent_definitions_form extends moodleform {
|
||||
$mform->setType('cmid', PARAM_INT);
|
||||
$mform->setDefault('cmid', 0);
|
||||
|
||||
$mform->addElement('hidden', 'category');
|
||||
$mform->setType('category', PARAM_RAW);
|
||||
$mform->setDefault('category', array('contexts' => array($this->categorycontext)));
|
||||
|
||||
$mform->setType('id', PARAM_INT);
|
||||
$mform->addElement('hidden', 'wizard', 'datasetitems');
|
||||
$mform->setType('wizard', PARAM_ALPHA);
|
||||
|
||||
@@ -32,6 +32,12 @@ class question_dataset_dependent_items_form extends moodleform {
|
||||
$this->regenerate = $regenerate;
|
||||
$this->question = $question;
|
||||
$this->qtypeobj =& $QTYPES[$this->question->qtype];
|
||||
// Validate the question category.
|
||||
if (!$category = get_record('question_categories', 'id', $question->category)) {
|
||||
print_error('categorydoesnotexist', 'question', $returnurl);
|
||||
}
|
||||
$this->category = $category;
|
||||
$this->categorycontext = get_context_instance_by_id($category->contextid);
|
||||
//get the dataset defintions for this question
|
||||
if (empty($question->id)) {
|
||||
$this->datasetdefs = $this->qtypeobj->get_dataset_definitions($question->id, $SESSION->datasetdependent->definitionform->dataset);
|
||||
@@ -161,6 +167,10 @@ class question_dataset_dependent_items_form extends moodleform {
|
||||
$mform->setType('cmid', PARAM_INT);
|
||||
$mform->setDefault('cmid', 0);
|
||||
|
||||
$mform->addElement('hidden', 'category');
|
||||
$mform->setType('category', PARAM_RAW);
|
||||
$mform->setDefault('category', array('contexts' => array($this->categorycontext)));
|
||||
|
||||
$mform->addElement('hidden', 'wizard', 'datasetitems');
|
||||
$mform->setType('wizard', PARAM_ALPHA);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user