Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-9785 Improve Flexibility of Question Category Sharing and Permissions
  3. MDL-10899

Moving questions by using a call to a qtype->movingtocategory() function

    XMLWordPrintable

Details

    • Sub-task
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 1.9
    • STABLE backlog
    • Questions
    • None
    • MOODLE_19_STABLE

    Description

      Actually (as in older version) moving a question in another category is done by modifying the question->category parameter as in
      line 486 of question/editlib.php
      //move question
      if (!set_field('question', 'category', $tocategory->id, 'id', $questionid))

      { error('Could not update category field'); }

      Calculated question can use category shared dataitems sets and just changing the category is not sufficient.
      I suggest that a moving_to_category() function being created in questiontype and that the default function could be the one used.
      I let you create the function and I will work on a specific one for calculated question.
      I suggest that the entire list i.e. $questionids be passed to the function because if you move all or part of the calculated questions that are in a category, the moving process is different.

      Attachments

        1. calculatedquestiontype.php.patch
          18 kB
        2. calculatedsimplequestiontype.php.patch
          0.6 kB
        3. category_delete.jpg
          category_delete.jpg
          87 kB
        4. category_edit.jpg
          category_edit.jpg
          86 kB
        5. movecategory.zip
          4 kB
        6. moving_associated_data_with_questions.patch.txt
          5 kB
        7. question_type_questiontype_diff.zip
          2 kB
        8. questionlib.php.patch
          3 kB
        9. questiontype.php.patch
          2 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ppichet Pierre Pichet
              Pierre Pichet Pierre Pichet
              Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: