XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Backup, Web Services
    • Labels:
    • Testing Instructions:
      Hide

      For testing this new webservice:

      Use this client:
      https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/client.php

      functionname
      core_course_duplicate_course

      /// PARAMETERS
      $params = array(
      'courseid' => 4, // Course to be duplicated idnumber // CHANGE IT FOR AN EXISTING COURSE ID
      'fullname' => 'Nuevo curso', // New course full name
      'shortname' => 'NuevoCurso'.rand(), // New course shortname
      'categoryid' => 1, // New course category id
      'visible' => 1, // Make the course visible after duplicating
      'options' => array(array('name'=>'blocks', 'value'=>1), array('name'=>'activities', 'value'=>1), array('name'=>'filters', 'value'=>1)) // Backup options
      );

      Show
      For testing this new webservice: Use this client: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/client.php functionname core_course_duplicate_course /// PARAMETERS $params = array( 'courseid' => 4, // Course to be duplicated idnumber // CHANGE IT FOR AN EXISTING COURSE ID 'fullname' => 'Nuevo curso', // New course full name 'shortname' => 'NuevoCurso'.rand(), // New course shortname 'categoryid' => 1, // New course category id 'visible' => 1, // Make the course visible after duplicating 'options' => array(array('name'=>'blocks', 'value'=>1), array('name'=>'activities', 'value'=>1), array('name'=>'filters', 'value'=>1)) // Backup options );
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-32233-core_course_duplicate_course-usersdata

      Description

      This web service function will duplicate a course creating a new one.
      It will perform a backup of an existing course and a restore to a new one

      Parameters:
      ----------

      course id - int The course id to duplicate
      fullname - string The new course (duplicated) fullname
      shortname - string The new course shortname
      category id - int The category id of the new course - Optional, default to Miscellaneous
      backup settings - struct of backup settings:
      'users' => 'Default to true',
      'role_assignments' => 'Default to true',
      'user_files' => 'Default to true',
      'activities' => 'Default to true',
      'blocks' => 'Default to true',
      'filters' => 'Default to true',
      'comments' => 'Default to true',
      'completion_information' => 'Default to true',
      'logs' => 'Default to true',
      'histories' => 'Default to true'

      Return value:
      -----------
      The new course created

      struct{
      course struct [id, fullname, shortname, timemodified]
      }

      Note:
      I don't know who is the core_course maintainer (moodle.com ?)
      This functionality is currently not present in Moodle, the most similar is duplicate activity at course level

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Jun/12