public static function create_new_course($fullname, $shortname, $categoryid) {
        global $DB;
        $category = $DB->get_record('course_categories', array('id'=>$categoryid), '*', MUST_EXIST);

        $course = new stdClass;
        $course->fullname = $fullname;
        $course->shortname = $shortname;
        $course->category = $category->id;
        $course->sortorder = 0;
        $course->timecreated  = time();
        $course->timemodified = $course->timecreated;
        // forcing skeleton courses to be hidden instead of going by $category->visible , until MDL-27790 is resolved.
        $course->visible = 0;

        $courseid = $DB->insert_record('course', $course);

        $category->coursecount++;
        $DB->update_record('course_categories', $category);

        return $courseid;
    }
public static function create_new_course($fullname, $shortname, $categoryid) {
        global $DB;
        $category = $DB->get_record('course_categories', array('id'=>$categoryid), '*', MUST_EXIST);

        $course = new stdClass;
        $course->fullname = $fullname;
        $course->shortname = $shortname;
        $course->category = $category->id;
        $course->sortorder = 0;
        $course->timecreated  = time();
        $course->timemodified = $course->timecreated;
        // forcing skeleton courses to be hidden instead of going by $category->visible , until MDL-27790 is resolved.
        $course->visible = 0;

        $courseid = $DB->insert_record('course', $course);

        $category->coursecount++;
        $DB->update_record('course_categories', $category);

        return $courseid;
    }
public static function create_new_course ( $ fullname , $ shortname , $ categoryid ) { global $ DB ; $ category = $ DB -> get_record ( 'course_categories' , array ( 'id' => $ categoryid ) , '*' , MUST_EXIST ) ; $ course = new stdClass ; $ course -> fullname = $ fullname ; $ course -> shortname = $ shortname ; $ course -> category = $ category -> id ; $ course -> sortorder = 0 ; $ course -> timecreated = time ( ) ; $ course -> timemodified = $ course -> timecreated ; // forcing skeleton courses to be hidden instead of going by $category->visible , until MDL-27790 is resolved. $ course -> visible = 0 ; $ courseid = $ DB -> insert_record ( 'course' , $ course ) ; $ category -> coursecount ++ ; $ DB -> update_record ( 'course_categories' , $ category ) ; return $ courseid ; }
Creates a skeleton record within the database using the passed parameters
and returns the new course id.

@global moodle_database $DB
@param string $fullname
@param string $shortname
@param int $categoryid
@return int The new course id
Creates a skeleton record within the database using the passed parameters and returns the new course id .