Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Files | Namespaces | Classes | Functions | Variables
mod_resource

Files

file  access.php
 Resource module capability definition.
 
file  activity.php
 Search area for mod_resource activities.
 
file  activity_base.php
 Activity base class.
 
file  backup_resource_activity_task.class.php
 Defines backup_resource_activity_task class.
 
file  backup_resource_stepslib.php
 Define all the backup steps that will be used by the backup_resource_activity_task.
 
file  cognitive_depth.php
 Cognitive depth indicator - resource.
 
file  course_module_instance_list_viewed.php
 The mod_resource instance list viewed event.
 
file  course_module_viewed.php
 The mod_resource course module viewed event.
 
file  external.php
 Resource external API.
 
file  lib.php
 Data generator.
 
file  lib.php
 
file  lib.php
 Provides support for the conversion of moodle1 backup to the moodle2 format.
 
file  locallib.php
 Private resource module utility functions.
 
file  log.php
 Definition of log events.
 
file  mod_form.php
 Resource configuration form.
 
file  provider.php
 Privacy Subsystem implementation for mod_resource.
 
file  restore_resource_activity_task.class.php
 @subpackage backup-moodle2
 
file  restore_resource_stepslib.php
 @subpackage backup-moodle2
 
file  services.php
 Resource external functions and service definitions.
 
file  settings.php
 Resource module admin settings and defaults.
 
file  social_breadth.php
 Social breadth indicator - resource.
 
file  upgrade.php
 Resource module upgrade code.
 
file  version.php
 Resource module version information.
 

Namespaces

 mod_resource\analytics\indicator
  
 
 mod_resource\event
  
 
 mod_resource\privacy
  
 
 mod_resource\search
  
 

Classes

class  backup_resource_activity_structure_step
 Define the complete resource structure for backup, with file and id annotations. More...
 
class  backup_resource_activity_task
 Provides the steps to perform one complete backup of the Resource instance. 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\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\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_external
 
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

 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. More...
 
 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. More...
 
 resource_add_instance ($data, $mform)
 Add resource instance. More...
 
 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. More...
 
 resource_cm_info_view (cm_info $cm)
 Called when viewing course page. More...
 
 resource_delete_instance ($id)
 Delete resource instance. More...
 
 resource_display_embed ($resource, $cm, $course, $file)
 Display embedded resource file. More...
 
 resource_display_frame ($resource, $cm, $course, $file)
 Display resource frames. More...
 
 resource_dndupload_handle ($uploadinfo)
 Handle a file that has been uploaded. More...
 
 resource_dndupload_register ()
 Register the ability to handle drag and drop file uploads. More...
 
 resource_export_contents ($cm, $baseurl)
 Export file resource contents. More...
 
 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_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. More...
 
 resource_get_file_areas ($course, $cm, $context)
 
 resource_get_file_details ($resource, $cm)
 Gets details of the file to cache in course cache to be displayed using resource_get_optional_details(). More...
 
 resource_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)
 
 resource_get_final_display_type ($resource)
 Decide the best display format. More...
 
 resource_get_optional_details ($resource, $cm)
 Gets optional details for a resource, depending on resource settings. More...
 
 resource_get_post_actions ()
 List the actions that correspond to a post of this module. More...
 
 resource_get_view_actions ()
 List the actions that correspond to a view of this module. More...
 
 resource_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types. More...
 
 resource_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 
 resource_print_filenotfound ($resource, $cm, $course)
 Print warning that file can not be found. More...
 
 resource_print_header ($resource, $cm, $course)
 Print resource header. More...
 
 resource_print_heading ($resource, $cm, $course, $notused=false)
 Print resource heading. More...
 
 resource_print_intro ($resource, $cm, $course, $ignoresettings=false)
 Print resource introduction. More...
 
 resource_print_tobemigrated ($resource, $cm, $course)
 Print warning that instance not migrated yet. More...
 
 resource_print_workaround ($resource, $cm, $course, $file)
 Print resource info and workaround link when JS not available. More...
 
 resource_redirect_if_migrated ($oldid, $cmid)
 Redirected to migrated resource if needed, return if incorrect parameters specified. More...
 
 resource_reset_userdata ($data)
 This function is used by the reset_course_userdata function in moodlelib. More...
 
 resource_set_display_options ($data)
 Updates display options based on form input. More...
 
 resource_set_mainfile ($data)
 
 resource_supports ($feature)
 List of features supported in Resource module. More...
 
 resource_update_instance ($data, $mform)
 Update resource instance. More...
 
 resource_view ($resource, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event. More...
 
 xmldb_resource_upgrade ($oldversion)
 

Variables

 $capabilities
 
 $functions
 
 $logs
 
$plugin component = 'mod_resource'
 
$plugin cron = 0
 
$plugin requires = 2019111200
 
$plugin version = 2019111800
 

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

◆ 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_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_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 get_array_of_activities() in course/lib.php

Parameters
stdClass$coursemodule
Return values
cached_cm_infoinfo

◆ 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_optional_details()

resource_get_optional_details (   $resource,
  $cm 
)

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
Return values
stringSize and type or empty string if show options are not enabled

◆ 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_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 
)

Print resource heading.

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.

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

◆ 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

◆ 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

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'
),
)

◆ $functions

$functions
Initial value:
= array(
'mod_resource_view_resource' => array(
'classname' => 'mod_resource_external',
'methodname' => 'view_resource',
'description' => 'Simulate the view.php web interface resource: trigger events, completion, etc...',
'type' => 'write',
'capabilities' => 'mod/resource:view',
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
'mod_resource_get_resources_by_courses' => array(
'classname' => 'mod_resource_external',
'methodname' => 'get_resources_by_courses',
'description' => 'Returns a list of files in a provided list of courses, if no list is provided all files that
the user can view will be returned.',
'type' => 'read',
'capabilities' => 'mod/resource:view',
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
)

◆ $logs

$logs
Initial value:
= array(
array('module'=>'resource', 'action'=>'view', 'mtable'=>'resource', 'field'=>'name'),
array('module'=>'resource', 'action'=>'view all', 'mtable'=>'resource', 'field'=>'name'),
array('module'=>'resource', 'action'=>'update', 'mtable'=>'resource', 'field'=>'name'),
array('module'=>'resource', 'action'=>'add', 'mtable'=>'resource', 'field'=>'name'),
)
MOODLE_OFFICIAL_MOBILE_SERVICE
const MOODLE_OFFICIAL_MOBILE_SERVICE
Moodle mobile app service name.
Definition: moodlelib.php:501
CONTEXT_COURSE
const CONTEXT_COURSE
Course context level - one instances for each course.
Definition: accesslib.php:128
CAP_ALLOW
const CAP_ALLOW
Allow permission, overrides CAP_PREVENT defined in parent contexts.
Definition: accesslib.php:115
CONTEXT_MODULE
const CONTEXT_MODULE
Course module context level - one instance for each course module.
Definition: accesslib.php:130
RISK_XSS
const RISK_XSS
Capability allows user to add scripted content - see http://docs.moodle.org/dev/Hardening_new_Roles_s...
Definition: accesslib.php:143