Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Static Public Member Functions | List of all members
external_util Class Reference

Utility functions for the external API. More...

Static Public Member Functions

static get_area_files ($contextid, $component, $filearea, $itemid=false, $useitemidinurl=true)
 Returns all area files (optionally limited by itemid). More...
 
static validate_courses ($courseids, $courses=array(), $addcontext=false, $keepfails=false)
 Validate a list of courses, returning the complete course objects for valid courses. More...
 

Detailed Description

Utility functions for the external API.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Since
Moodle 3.0

Member Function Documentation

◆ get_area_files()

static external_util::get_area_files (   $contextid,
  $component,
  $filearea,
  $itemid = false,
  $useitemidinurl = true 
)
static

Returns all area files (optionally limited by itemid).

Parameters
int$contextidcontext ID
string$componentcomponent
string$fileareafile area
int$itemiditem ID or all files if not specified
bool$useitemidinurlwether to use the item id in the file URL (modules intro don't use it)
Return values
arrayof files, compatible with the external_files structure.
Since
Moodle 3.2

◆ validate_courses()

static external_util::validate_courses (   $courseids,
  $courses = array(),
  $addcontext = false,
  $keepfails = false 
)
static

Validate a list of courses, returning the complete course objects for valid courses.

Each course has an additional 'contextvalidated' field, this will be set to true unless you set $keepfails, in which case it will be false if validation fails for a course.

Parameters
array$courseidsA list of course ids
array$coursesAn array of courses already pre-fetched, indexed by course id.
bool$addcontextTrue if the returned course object should include the full context object.
bool$keepfailsTrue to keep all the course objects even if validation fails
Return values
arrayAn array of courses and the validation warnings

The documentation for this class was generated from the following file: