Moodle

moodle_course_create_courses

Details

  • Type: Task Task
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Web Services
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Add one or more courses provided as an array

Issue Links

Activity

Hide
Jordi Piguillem Poch added a comment -

What do you think about this? We forgot about course category....

/**

  • Adds a new course to the course table
  • @private ?
  • @param array $course
  • $course format:
  • <ul>
  • <li>$course[name]</li>
  • <li>$course[shortname]</li>
  • <li>$course[format]</li>
  • <li>$course[idnumber]</li>
  • <li>$course[category]</li>
  • </ul>
  • @return int|boolean new course id or false
    */
    function add_course($course){
    }

/**

  • Adds several new courses to the course table
  • @param array $courses
  • $courses format
  • <ul>
  • <li>$courses[i][name]</li>
  • <li>$courses[i][shortname]</li>
  • <li>$courses[i][format]</li>
  • <li>$courses[i][idnumber]</li>
  • <li>$courses[i][category]</li>
  • </ul>
  • @uses add_course
  • @return array|boolean array containing new courses ids or false
    */
    function add_courses($courses){
    }
Show
Jordi Piguillem Poch added a comment - What do you think about this? We forgot about course category.... /**
  • Adds a new course to the course table
  • @private ?
  • @param array $course
  • $course format:
  • <ul>
  • <li>$course[name]</li>
  • <li>$course[shortname]</li>
  • <li>$course[format]</li>
  • <li>$course[idnumber]</li>
  • <li>$course[category]</li>
  • </ul>
  • @return int|boolean new course id or false */ function add_course($course){ }
/**
  • Adds several new courses to the course table
  • @param array $courses
  • $courses format
  • <ul>
  • <li>$courses[i][name]</li>
  • <li>$courses[i][shortname]</li>
  • <li>$courses[i][format]</li>
  • <li>$courses[i][idnumber]</li>
  • <li>$courses[i][category]</li>
  • </ul>
  • @uses add_course
  • @return array|boolean array containing new courses ids or false */ function add_courses($courses){ }
Hide
Carlos Alexandre S. da Fonseca added a comment -

i think the course category should be passed by unique identifier (id, name), and have functions, like add_course, to course_categories too (I.E. add_course_category, delete_course_category, ... )
If no category parameter not specified, pass to a default category (0) ...

In the function thats remove a course_category, could have a flag(true/false), like cascade, thats set to do a delete cascade, removing all courses with associate couse_categories if it's set to true, the default could be false.

Show
Carlos Alexandre S. da Fonseca added a comment - i think the course category should be passed by unique identifier (id, name), and have functions, like add_course, to course_categories too (I.E. add_course_category, delete_course_category, ... ) If no category parameter not specified, pass to a default category (0) ... In the function thats remove a course_category, could have a flag(true/false), like cascade, thats set to do a delete cascade, removing all courses with associate couse_categories if it's set to true, the default could be false.
Hide
David Castro added a comment -

This funcionality is completed in CVS.
We have commit a simpletest.

Show
David Castro added a comment - This funcionality is completed in CVS. We have commit a simpletest.
Hide
Adam Olley added a comment -

A commit made by Petr on 17th of September to fix undefined course config variables appears to have been taken care of wrong.

The $courseconfig variable didn't exist in the create_courses function because it appears to have been accidentally declared in the create_courses_parameters function instead.
92f2e446df8038bf7654cfebe8aed5f48a42296d

This:
$courseconfig = get_config('moodlecourse'); //needed for many default values
Needs to be moved from the parameters function to the create_courses.

Show
Adam Olley added a comment - A commit made by Petr on 17th of September to fix undefined course config variables appears to have been taken care of wrong. The $courseconfig variable didn't exist in the create_courses function because it appears to have been accidentally declared in the create_courses_parameters function instead. 92f2e446df8038bf7654cfebe8aed5f48a42296d This: $courseconfig = get_config('moodlecourse'); //needed for many default values Needs to be moved from the parameters function to the create_courses.
Hide
Adam Olley added a comment -

I've opened a bug for what I mentioned in my previous comment: MDL-24926

Show
Adam Olley added a comment - I've opened a bug for what I mentioned in my previous comment: MDL-24926

Dates

  • Created:
    Updated:
    Resolved: