History | Log In     View a printable version of the current page.  
We are currently focused especially on Moodle 2.0, Moodle 1.9.x bugs and Moodle 1.9.x testing.    Confused? Lost? Please read this introduction to the Tracker.
Issue Details (XML | Word | Printable)

Key: MDL-13129
Type: Sub-task Sub-task
Status: Reopened Reopened
Priority: Minor Minor
Assignee: David Castro
Reporter: Martin Dougiamas
Votes: 0
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
Moodle
MDL-12886

add_courses

Created: 24/Jan/08 02:58 PM   Updated: 06/Nov/08 07:27 PM
Component/s: Administration
Affects Version/s: 1.9
Fix Version/s: None

Participants: Carlos Alexandre S. da Fonseca, David Castro, Jordi Piguillem Poch and Martin Dougiamas
Security Level: None


 Description  « Hide
Add one or more courses provided as an array

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Jordi Piguillem Poch - 09/Jul/08 07:43 PM
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){
}

Carlos Alexandre S. da Fonseca - 01/Aug/08 02:04 AM
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.



David Castro - 08/Oct/08 12:28 AM
This funcionality is completed in CVS.
We have commit a simpletest.