Skip to content

Commit

Permalink
MDL-19214 Adding category hidden element Merging from HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
pichetp committed May 24, 2009
1 parent 40bb96d commit 3978521
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions question/type/datasetdependent/datasetdefinitions_form.php
Expand Up @@ -28,6 +28,13 @@ function question_dataset_dependent_definitions_form($submiturl, $question){
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() {
Expand Down Expand Up @@ -107,6 +114,10 @@ function definition() {
$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);
Expand Down
10 changes: 10 additions & 0 deletions question/type/datasetdependent/datasetitems_form.php
Expand Up @@ -32,6 +32,12 @@ function question_dataset_dependent_items_form($submiturl, $question, $regenerat
$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);
Expand Down Expand Up @@ -161,6 +167,10 @@ function definition() {
$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);

Expand Down

0 comments on commit 3978521

Please sign in to comment.