Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 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: 555 lines (20 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, bool $showtype = true)   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
param: bool $showtype Whether the file type should be displayed or not (regardless the display option is enabled).
return: string Size and type or empty string if show options are not enabled

resource_get_optional_filetype($resource, $cm)   X-Ref
Gets optional file type extension for a resource, depending on resource settings.

param: object $resource Resource table row (only property 'displayoptions' is used here)
param: object $cm Course-module table row
return: string File extension or null if showtype option is 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