Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19214

Adding category hidden element on datasetdefinitions_form.php and datasetitems_form.php

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 1.9.6
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      question.php expect that there is a fromform->category elements on each question editng form.
      So this will be added as an hiddne element

        Gliffy Diagrams

          Activity

          Hide
          ppichet Pierre Pichet added a comment -

          Dans C:\server\moodle\moodle_head\question\type\calculated : "C:\Program Files\CVSNT\cvs.exe" -q
          diff -u -r 1.2 datasetdefinitions_form.php
          CVSROOT=:ext:pichetp@cvs.moodle.org:/cvsroot/moodle

          Index: datasetdefinitions_form.php
          ===================================================================
          RCS file: /cvsroot/moodle/moodle/question/type/calculated/datasetdefinitions_form.php,v
          retrieving revision 1.2
          retrieving revision 1.3
          diff -u -r1.2 -r1.3
          — datasetdefinitions_form.php 10 Dec 2008 07:24:13 -0000 1.2
          +++ datasetdefinitions_form.php 24 May 2009 02:33:42 -0000 1.3
          @@ -25,9 +25,15 @@

          • @param MoodleQuickForm $mform the form being built.
            */
            function question_dataset_dependent_definitions_form($submiturl, $question){
          • global $QTYPES;
            + global $QTYPES, $DB;
            $this->question = $question;
            $this->qtypeobj =& $QTYPES[$this->question->qtype];
            + // Validate the question category.
            + if (!$category = $DB->get_record('question_categories', array('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() {
            @@ -99,6 +105,10 @@
            $mform->addElement('hidden', 'id');
            $mform->setType('id', PARAM_INT);

          + $mform->addElement('hidden', 'category');
          + $mform->setType('category', PARAM_RAW);
          + $mform->setDefault('category', array('contexts' => array($this->categorycontext)));
          +
          $mform->addElement('hidden', 'courseid');
          $mform->setType('courseid', PARAM_INT);
          $mform->setDefault('courseid', 0);

          Succès : opération CVS terminée

          Similar changes on the other file.
          Tested OK

          Show
          ppichet Pierre Pichet added a comment - Dans C:\server\moodle\moodle_head\question\type\calculated : "C:\Program Files\CVSNT\cvs.exe" -q diff -u -r 1.2 datasetdefinitions_form.php CVSROOT=:ext:pichetp@cvs.moodle.org:/cvsroot/moodle Index: datasetdefinitions_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/calculated/datasetdefinitions_form.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 — datasetdefinitions_form.php 10 Dec 2008 07:24:13 -0000 1.2 +++ datasetdefinitions_form.php 24 May 2009 02:33:42 -0000 1.3 @@ -25,9 +25,15 @@ @param MoodleQuickForm $mform the form being built. */ function question_dataset_dependent_definitions_form($submiturl, $question){ global $QTYPES; + global $QTYPES, $DB; $this->question = $question; $this->qtypeobj =& $QTYPES [$this->question->qtype] ; + // Validate the question category. + if (!$category = $DB->get_record('question_categories', array('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() { @@ -99,6 +105,10 @@ $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_INT); + $mform->addElement('hidden', 'category'); + $mform->setType('category', PARAM_RAW); + $mform->setDefault('category', array('contexts' => array($this->categorycontext))); + $mform->addElement('hidden', 'courseid'); $mform->setType('courseid', PARAM_INT); $mform->setDefault('courseid', 0); Succès : opération CVS terminée Similar changes on the other file. Tested OK
          Hide
          ppichet Pierre Pichet added a comment -

          Reopen as this should be merged to 1.9

          Show
          ppichet Pierre Pichet added a comment - Reopen as this should be merged to 1.9
          Hide
          ppichet Pierre Pichet added a comment -

          Merge on 1. Stable done

          Show
          ppichet Pierre Pichet added a comment - Merge on 1. Stable done
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Tested and works Thanks

          Show
          samhemelryk Sam Hemelryk added a comment - Tested and works Thanks

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                21/Oct/09