Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 403]

Private resource module utility functions

Copyright: 2009 Petr Skoda {@link http://skodak.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 525 lines (19 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

resource_content_file_info:: (3 methods):
  get_parent()
  get_visible_name()
  resource_set_mainfile()

Defines 3 functions


Class: resource_content_file_info  - X-Ref

File browsing support class

get_parent()   X-Ref
No description

get_visible_name()   X-Ref
No description

resource_set_mainfile($data)   X-Ref
No description

Functions that are not part of a class:

resource_redirect_if_migrated($oldid, $cmid)   X-Ref
Redirected to migrated resource if needed,
return if incorrect parameters specified

param: int $oldid
param: int $cmid
return: void

resource_display_embed($resource, $cm, $course, $file)   X-Ref
Display embedded resource file.

param: object $resource
param: object $cm
param: object $course
param: stored_file $file main file
return: does not return

resource_display_frame($resource, $cm, $course, $file)   X-Ref
Display resource frames.

param: object $resource
param: object $cm
param: object $course
param: stored_file $file main file
return: does not return

resource_get_clicktoopen($file, $revision, $extra='')   X-Ref
Internal function - create click to open text with link.


resource_get_clicktodownload($file, $revision)   X-Ref
Internal function - create click to open text with link.


resource_print_workaround($resource, $cm, $course, $file)   X-Ref
Print resource info and workaround link when JS not available.

param: object $resource
param: object $cm
param: object $course
param: stored_file $file main file
return: does not return

resource_print_header($resource, $cm, $course)   X-Ref
Print resource header.

param: object $resource
param: object $cm
param: object $course
return: void

resource_get_file_details($resource, $cm)   X-Ref
Gets details of the file to cache in course cache to be displayed using {@link resource_get_optional_details()}

param: object $resource Resource table row (only property 'displayoptions' is used here)
param: object $cm Course-module table row
return: string Size and type or empty string if show options are not enabled

resource_get_optional_details($resource, $cm)   X-Ref
Gets optional details for a resource, depending on resource settings.

Result may include the file size and type if those settings are chosen,
or blank if none.

param: object $resource Resource table row (only property 'displayoptions' is used here)
param: object $cm Course-module table row
return: string Size and type or empty string if show options are not enabled

resource_get_intro(object $resource, object $cm, bool $ignoresettings = false)   X-Ref
Get resource introduction.

param: object $resource
param: object $cm
param: bool $ignoresettings print even if not specified in modedit
return: string

resource_print_tobemigrated($resource, $cm, $course)   X-Ref
Print warning that instance not migrated yet.

param: object $resource
param: object $cm
param: object $course
return: void, does not return

resource_print_filenotfound($resource, $cm, $course)   X-Ref
Print warning that file can not be found.

param: object $resource
param: object $cm
param: object $course
return: void, does not return

resource_get_final_display_type($resource)   X-Ref
Decide the best display format.

param: object $resource
return: int display type constant