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

    • Type: Sub-task
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.9
    • Fix Version/s: STABLE backlog
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      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. questiontype.php.patch
          2 kB
        2. questionlib.php.patch
          3 kB
        3. question_type_questiontype_diff.zip
          2 kB
        4. moving_associated_data_with_questions.patch.txt
          5 kB
        5. movecategory.zip
          4 kB
        6. category_edit.jpg
          category_edit.jpg
          86 kB
        7. category_delete.jpg
          category_delete.jpg
          87 kB
        8. calculatedsimplequestiontype.php.patch
          0.6 kB
        9. calculatedquestiontype.php.patch
          18 kB

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              ppichet Pierre Pichet
              Tester:
              Pierre Pichet
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated: