Skip to content

Commit

Permalink
MDL-30986 external API, check and update DocBlock
Browse files Browse the repository at this point in the history
Conflicts:

	group/externallib.php
  • Loading branch information
mouneyrac committed Apr 30, 2012
1 parent aa753ac commit 4615817
Show file tree
Hide file tree
Showing 9 changed files with 794 additions and 239 deletions.
87 changes: 71 additions & 16 deletions course/externallib.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
Expand All @@ -15,12 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.


/**
* External course API
*
* @package core
* @subpackage course
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
* @package core_course
* @category external
* @copyright 2009 Petr Skodak
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand All @@ -29,13 +29,21 @@
require_once("$CFG->libdir/externallib.php");

/**
* Course functions
* Course external functions
*
* @package core_course
* @category external
* @copyright 2011 Jerome Mouneyrac
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.2
*/
class core_course_external extends external_api {

/**
* Returns description of method parameters
*
* @return external_function_parameters
* @since Moodle 2.2
*/
public static function get_course_contents_parameters() {
return new external_function_parameters(
Expand All @@ -52,9 +60,11 @@ public static function get_course_contents_parameters() {

/**
* Get course contents
* @param int $courseid
* @param array $options, not used yet, might be used in later version
*
* @param int $courseid course id
* @param array $options These options are not used yet, might be used in later version
* @return array
* @since Moodle 2.2
*/
public static function get_course_contents($courseid, $options) {
global $CFG, $DB;
Expand Down Expand Up @@ -183,7 +193,9 @@ public static function get_course_contents($courseid, $options) {

/**
* Returns description of method result value
*
* @return external_description
* @since Moodle 2.2
*/
public static function get_course_contents_returns() {
return new external_multiple_structure(
Expand Down Expand Up @@ -238,7 +250,9 @@ public static function get_course_contents_returns() {

/**
* Returns description of method parameters
*
* @return external_function_parameters
* @since Moodle 2.2
*/
public static function get_courses_parameters() {
return new external_function_parameters(
Expand All @@ -255,8 +269,10 @@ public static function get_courses_parameters() {

/**
* Get courses
* @param array $options
*
* @param array $options It contains an array (list of ids)
* @return array
* @since Moodle 2.2
*/
public static function get_courses($options) {
global $CFG, $DB;
Expand Down Expand Up @@ -336,7 +352,9 @@ public static function get_courses($options) {

/**
* Returns description of method result value
*
* @return external_description
* @since Moodle 2.2
*/
public static function get_courses_returns() {
return new external_multiple_structure(
Expand Down Expand Up @@ -402,7 +420,9 @@ public static function get_courses_returns() {

/**
* Returns description of method parameters
*
* @return external_function_parameters
* @since Moodle 2.2
*/
public static function create_courses_parameters() {
$courseconfig = get_config('moodlecourse'); //needed for many default values
Expand Down Expand Up @@ -471,8 +491,10 @@ public static function create_courses_parameters() {

/**
* Create courses
*
* @param array $courses
* @return array courses (id and shortname only)
* @since Moodle 2.2
*/
public static function create_courses($courses) {
global $CFG, $DB;
Expand Down Expand Up @@ -556,7 +578,9 @@ public static function create_courses($courses) {

/**
* Returns description of method result value
*
* @return external_description
* @since Moodle 2.2
*/
public static function create_courses_returns() {
return new external_multiple_structure(
Expand All @@ -572,62 +596,93 @@ public static function create_courses_returns() {
}

/**
* Deprecated course functions
* @deprecated since Moodle 2.2 please use core_course_external instead
* Deprecated course external functions
*
* @package core_course
* @copyright 2009 Petr Skodak
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
* @deprecated Moodle 2.2 MDL-29106 - Please do not use this class any more.
* @todo MDL-31194 This will be deleted in Moodle 2.5.
* @see core_course_external
*/
class moodle_course_external extends external_api {

/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_course_external::get_courses_parameters instead
*
* @return external_function_parameters
* @since Moodle 2.0
* @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
* @todo MDL-31194 This will be deleted in Moodle 2.5.
* @see core_course_external::get_courses_parameters()
*/
public static function get_courses_parameters() {
return core_course_external::get_courses_parameters();
}

/**
* Get courses
*
* @param array $options
* @deprecated since Moodle 2.2 please use core_course_external::get_courses instead
* @return array
* @since Moodle 2.0
* @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
* @todo MDL-31194 This will be deleted in Moodle 2.5.
* @see core_course_external::get_courses()
*/
public static function get_courses($options) {
return core_course_external::get_courses($options);
}

/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_course_external::get_courses_returns instead
*
* @return external_description
* @since Moodle 2.0
* @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
* @todo MDL-31194 This will be deleted in Moodle 2.5.
* @see core_course_external::get_courses_returns()
*/
public static function get_courses_returns() {
return core_course_external::get_courses_returns();
}

/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_course_external::create_courses_parameters instead
*
* @return external_function_parameters
* @since Moodle 2.0
* @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
* @todo MDL-31194 This will be deleted in Moodle 2.5.
* @see core_course_external::create_courses_parameters()
*/
public static function create_courses_parameters() {
return core_course_external::create_courses_parameters();
}

/**
* Create courses
* @deprecated since Moodle 2.2 please use core_course_external::create_courses instead
*
* @param array $courses
* @return array courses (id and shortname only)
* @since Moodle 2.0
* @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
* @todo MDL-31194 This will be deleted in Moodle 2.5.
* @see core_course_external::create_courses()
*/
public static function create_courses($courses) {
return core_course_external::create_courses($courses);
}

/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_course_external::create_courses_returns instead
*
* @return external_description
* @since Moodle 2.0
* @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
* @todo MDL-31194 This will be deleted in Moodle 2.5.
* @see core_course_external::create_courses_returns()
*/
public static function create_courses_returns() {
return core_course_external::create_courses_returns();
Expand Down
Loading

0 comments on commit 4615817

Please sign in to comment.