Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)

Functions

 mod_resource_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none.
 
 mod_resource_get_path_from_pluginfile (string $filearea, array $args)
 Given an array with a file path, it returns the itemid and the filepath for the defined filearea.
 
 resource_add_instance ($data, $mform)
 Add resource instance.
 
 resource_check_updates_since (cm_info $cm, $from, $filter=array())
 Check if the module has any update that affects the current user since a given time.
 
 resource_cm_info_view (cm_info $cm)
 Called when viewing course page.
 
 resource_delete_instance ($id)
 Delete resource instance.
 
 resource_dndupload_handle ($uploadinfo)
 Handle a file that has been uploaded.
 
 resource_dndupload_register ()
 Register the ability to handle drag and drop file uploads.
 
 resource_export_contents ($cm, $baseurl)
 Export file resource contents.
 
 resource_get_coursemodule_info ($coursemodule)
 Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing.
 
 resource_get_file_areas ($course, $cm, $context)
 Lists all browsable file areas.
 
 resource_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)
 File browsing support for resource module content area.
 
 resource_get_post_actions ()
 List the actions that correspond to a post of this module.
 
 resource_get_view_actions ()
 List the actions that correspond to a view of this module.
 
 resource_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types.
 
 resource_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 Serves the resource files.
 
 resource_reset_userdata ($data)
 This function is used by the reset_course_userdata function in moodlelib.
 
 resource_set_display_options ($data)
 Updates display options based on form input.
 
 resource_supports ($feature)
 List of features supported in Resource module.
 
 resource_update_instance ($data, $mform)
 Update resource instance.
 
 resource_view ($resource, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event.
 

Detailed Description

Function Documentation

◆ mod_resource_core_calendar_provide_event_action()

mod_resource_core_calendar_provide_event_action ( calendar_event $event,
core_calendar\action_factory $factory,
$userid = 0 )

This function receives a calendar event and returns the action associated with it, or null if there is none.

This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.

Parameters
calendar_event$event
core_calendar\action_factory$factory
Return values
core_calendar\local\event\entities\action_interface|null

◆ mod_resource_get_path_from_pluginfile()

mod_resource_get_path_from_pluginfile ( string $filearea,
array $args )

Given an array with a file path, it returns the itemid and the filepath for the defined filearea.

Parameters
string$fileareaThe filearea.
array$argsThe path (the part after the filearea and before the filename).
Return values
arrayThe itemid and the filepath inside the $args path, for the defined filearea.

◆ resource_add_instance()

resource_add_instance ( $data,
$mform )

Add resource instance.

Parameters
object$data
object$mform
Return values
intnew resource instance id

◆ resource_check_updates_since()

resource_check_updates_since ( cm_info $cm,
$from,
$filter = array() )

Check if the module has any update that affects the current user since a given time.

Parameters
cm_info$cmcourse module data
int$fromthe time to check updates from
array$filterif we need to check only specific updates
Return values
stdClassan object with the different type of areas indicating if they were updated or not
Since
Moodle 3.2

◆ resource_cm_info_view()

resource_cm_info_view ( cm_info $cm)

Called when viewing course page.

Shows extra details after the link if enabled.

Parameters
cm_info$cmCourse module information

◆ resource_delete_instance()

resource_delete_instance ( $id)

Delete resource instance.

Parameters
int$id
Return values
booltrue

◆ resource_dndupload_handle()

resource_dndupload_handle ( $uploadinfo)

Handle a file that has been uploaded.

Parameters
object$uploadinfodetails of the file / content that has been uploaded
Return values
intinstance id of the newly created mod

◆ resource_dndupload_register()

resource_dndupload_register ( )

Register the ability to handle drag and drop file uploads.

Return values
arraycontaining details of the files / types the mod can handle

◆ resource_export_contents()

resource_export_contents ( $cm,
$baseurl )

Export file resource contents.

Return values
arrayof file content

◆ resource_get_coursemodule_info()

resource_get_coursemodule_info ( $coursemodule)

Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing.

See course_modinfo::get_array_of_activities()

Parameters
stdClass$coursemodule
Return values
cached_cm_infoinfo

◆ resource_get_file_areas()

resource_get_file_areas ( $course,
$cm,
$context )

Lists all browsable file areas.

Parameters
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Return values
array

◆ resource_get_file_info()

resource_get_file_info ( $browser,
$areas,
$course,
$cm,
$context,
$filearea,
$itemid,
$filepath,
$filename )

File browsing support for resource module content area.

Parameters
file_browser$browserfile browser instance
stdClass$areasfile areas
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
string$fileareafile area
int$itemiditem ID
string$filepathfile path
string$filenamefile name
Return values
file_infoinstance or null if not found

◆ resource_get_post_actions()

resource_get_post_actions ( )

List the actions that correspond to a post of this module.

This is used by the participation report.

Note: This is not used by new logging system. Event with crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING will be considered as post action.

Return values
array

◆ resource_get_view_actions()

resource_get_view_actions ( )

List the actions that correspond to a view of this module.

This is used by the participation report.

Note: This is not used by new logging system. Event with crud = 'r' and edulevel = LEVEL_PARTICIPATING will be considered as view action.

Return values
array

◆ resource_page_type_list()

resource_page_type_list ( $pagetype,
$parentcontext,
$currentcontext )

Return a list of page types.

Parameters
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

◆ resource_pluginfile()

resource_pluginfile ( $course,
$cm,
$context,
$filearea,
$args,
$forcedownload,
array $options = array() )

Serves the resource files.

Parameters
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
string$fileareafile area
array$argsextra arguments
bool$forcedownloadwhether or not force download
array$optionsadditional options affecting the file serving
Return values
boolfalse if file not found, does not return if found - just send the file

◆ resource_reset_userdata()

resource_reset_userdata ( $data)

This function is used by the reset_course_userdata function in moodlelib.

Parameters
$datathe data submitted from the reset course.
Return values
arraystatus array

◆ resource_set_display_options()

resource_set_display_options ( $data)

Updates display options based on form input.

Shared code used by resource_add_instance and resource_update_instance.

Parameters
object$dataData object

◆ resource_supports()

resource_supports ( $feature)

List of features supported in Resource module.

Parameters
string$featureFEATURE_xx constant for requested feature
Return values
mixedTrue if module supports feature, false if not, null if doesn't know or string for the module purpose.

◆ resource_update_instance()

resource_update_instance ( $data,
$mform )

Update resource instance.

Parameters
object$data
object$mform
Return values
booltrue

◆ resource_view()

resource_view ( $resource,
$course,
$cm,
$context )

Mark the activity completed (if required) and trigger the course_module_viewed event.

Parameters
stdClass$resourceresource object
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Since
Moodle 3.0