Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
mod_resource

Topics

 backup
 
 
 external
 
 
 files
 
 
 log
 
 

Directories

directory backup
  
 

Namespaces

namespace  mod_resource\analytics\indicator
 Activity base class.
 
namespace  mod_resource\completion
  
 
namespace  mod_resource\content
 Content export definition.
 
namespace  mod_resource\event
 The mod_resource instance list viewed event.
 
namespace  mod_resource\output\courseformat
  
 
namespace  mod_resource\privacy
 Privacy Subsystem implementation for mod_resource.
 
namespace  mod_resource\search
 Search area for mod_resource activities.
 

Classes

class  backup_resource_activity_structure_step
 Define the complete resource structure for backup, with file and id annotations. More...
 
class  mod_resource\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_resource\analytics\indicator\cognitive_depth
 Cognitive depth indicator - resource. More...
 
class  mod_resource\analytics\indicator\social_breadth
 Social breadth indicator - resource. More...
 
class  mod_resource\completion\custom_completion
 Activity custom completion subclass for the resource. More...
 
class  mod_resource\content\exporter
 A class which assists a component to export content. More...
 
class  mod_resource\event\course_module_instance_list_viewed
 The mod_resource instance list viewed event class. More...
 
class  mod_resource\event\course_module_viewed
 The mod_resource course module viewed event class. More...
 
class  mod_resource\output\courseformat\activitybadge
 Activity badge resource class, used for displaying the file type. More...
 
class  mod_resource\privacy\provider
 The mod_resource module does not store any data. More...
 
class  mod_resource\search\activity
 Search area for mod_resource activities. More...
 
class  mod_resource_generator
 Resource module data generator class. More...
 
class  mod_resource_mod_form
 
class  moodle1_mod_resource_handler
 Resource conversion handler. More...
 
class  resource_content_file_info
 File browsing support class. More...
 
class  restore_resource_activity_structure_step
 Define all the restore steps that will be used by the restore_resource_activity_task. More...
 
class  restore_resource_activity_task
 resource restore task that provides all the settings and steps to perform one complete restore of the activity More...
 

Functions

 resource_display_embed ($resource, $cm, $course, $file)
 Display embedded resource file.
 
 resource_display_frame ($resource, $cm, $course, $file)
 Display resource frames.
 
 resource_get_clicktodownload ($file, $revision)
 Internal function - create click to open text with link.
 
 resource_get_clicktoopen ($file, $revision, $extra='')
 Internal function - create click to open text with link.
 
 resource_get_file_details ($resource, $cm)
 Gets details of the file to cache in course cache to be displayed using resource_get_optional_details().
 
 resource_get_final_display_type ($resource)
 Decide the best display format.
 
 resource_get_intro (object $resource, object $cm, bool $ignoresettings=false)
 Get resource introduction.
 
 resource_get_optional_details ($resource, $cm, bool $showtype=true)
 Gets optional details for a resource, depending on resource settings.
 
 resource_get_optional_filetype ($resource, $cm)
 Gets optional file type extension for a resource, depending on resource settings.
 
 resource_print_filenotfound ($resource, $cm, $course)
 Print warning that file can not be found.
 
 resource_print_header ($resource, $cm, $course)
 Print resource header.
 
 resource_print_heading ($resource, $cm, $course, $notused=false)
 List of deprecated mod_resource functions.
 
 resource_print_intro ($resource, $cm, $course, $ignoresettings=false)
 Print resource introduction.
 
 resource_print_tobemigrated ($resource, $cm, $course)
 Print warning that instance not migrated yet.
 
 resource_print_workaround ($resource, $cm, $course, $file)
 Print resource info and workaround link when JS not available.
 
 resource_redirect_if_migrated ($oldid, $cmid)
 Redirected to migrated resource if needed, return if incorrect parameters specified.
 
 resource_set_mainfile ($data)
 
 xmldb_resource_upgrade ($oldversion)
 

Variables

 $capabilities
 
 $plugin = 2023100400
 
$plugin component = 'mod_resource'
 
$plugin cron = 0
 
$plugin version = 2023100900
 

Detailed Description

Function Documentation

◆ resource_display_embed()

resource_display_embed ( $resource,
$cm,
$course,
$file )

Display embedded resource file.

Parameters
object$resource
object$cm
object$course
stored_file$filemain file
Return values
doesnot return

◆ resource_display_frame()

resource_display_frame ( $resource,
$cm,
$course,
$file )

Display resource frames.

Parameters
object$resource
object$cm
object$course
stored_file$filemain file
Return values
doesnot return

◆ resource_get_file_details()

resource_get_file_details ( $resource,
$cm )

Gets details of the file to cache in course cache to be displayed using resource_get_optional_details().

Parameters
object$resourceResource table row (only property 'displayoptions' is used here)
object$cmCourse-module table row
Return values
stringSize and type or empty string if show options are not enabled

◆ resource_get_final_display_type()

resource_get_final_display_type ( $resource)

Decide the best display format.

Parameters
object$resource
Return values
intdisplay type constant

◆ resource_get_intro()

resource_get_intro ( object $resource,
object $cm,
bool $ignoresettings = false )

Get resource introduction.

Parameters
object$resource
object$cm
bool$ignoresettingsprint even if not specified in modedit
Return values
string

◆ resource_get_optional_details()

resource_get_optional_details ( $resource,
$cm,
bool $showtype = true )

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.

Parameters
object$resourceResource table row (only property 'displayoptions' is used here)
object$cmCourse-module table row
bool$showtypeWhether the file type should be displayed or not (regardless the display option is enabled).
Return values
stringSize and type or empty string if show options are not enabled

◆ resource_get_optional_filetype()

resource_get_optional_filetype ( $resource,
$cm )

Gets optional file type extension for a resource, depending on resource settings.

Parameters
object$resourceResource table row (only property 'displayoptions' is used here)
object$cmCourse-module table row
Return values
stringFile extension or null if showtype option is not enabled

◆ resource_print_filenotfound()

resource_print_filenotfound ( $resource,
$cm,
$course )

Print warning that file can not be found.

Parameters
object$resource
object$cm
object$course
Return values
void,doesnot return

◆ resource_print_header()

resource_print_header ( $resource,
$cm,
$course )

Print resource header.

Parameters
object$resource
object$cm
object$course
Return values
void

◆ resource_print_heading()

resource_print_heading ( $resource,
$cm,
$course,
$notused = false )

List of deprecated mod_resource functions.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later Print resource heading.
Deprecated
since Moodle 4.0
Parameters
object$resource
object$cm
object$course
bool$notusedThis variable is no longer used
Return values
void

◆ resource_print_intro()

resource_print_intro ( $resource,
$cm,
$course,
$ignoresettings = false )

Print resource introduction.

Deprecated
since Moodle 4.0
Parameters
object$resource
object$cm
object$course
bool$ignoresettingsprint even if not specified in modedit
Return values
void

◆ resource_print_tobemigrated()

resource_print_tobemigrated ( $resource,
$cm,
$course )

Print warning that instance not migrated yet.

Parameters
object$resource
object$cm
object$course
Return values
void,doesnot return

◆ resource_print_workaround()

resource_print_workaround ( $resource,
$cm,
$course,
$file )

Print resource info and workaround link when JS not available.

Parameters
object$resource
object$cm
object$course
stored_file$filemain file
Return values
doesnot return

◆ resource_redirect_if_migrated()

resource_redirect_if_migrated ( $oldid,
$cmid )

Redirected to migrated resource if needed, return if incorrect parameters specified.

Parameters
int$oldid
int$cmid
Return values
void

Variable Documentation

◆ $capabilities

$capabilities
Initial value:
= array(
'mod/resource:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'guest' => CAP_ALLOW,
'user' => CAP_ALLOW,
)
),
'mod/resource:addinstance' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/course:manageactivities'
),
)
const CONTEXT_COURSE
Course context level - one instances for each course.
Definition accesslib.php:128
const CAP_ALLOW
Allow permission, overrides CAP_PREVENT defined in parent contexts.
Definition accesslib.php:115
const RISK_XSS
Capability allows user to add scripted content - see
Definition accesslib.php:143
const CONTEXT_MODULE
Course module context level - one instance for each course module.
Definition accesslib.php:130