Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
mod_folder

Namespaces

namespace  mod_folder\analytics\indicator
  
 
namespace  mod_folder\completion
  
 
namespace  mod_folder\content
  
 
namespace  mod_folder\event
  
 
namespace  mod_folder\privacy
  
 
namespace  mod_folder\search
  
 

Classes

class  backup_folder_activity_structure_step
 Define the complete folder structure for backup, with file and id annotations. More...
 
class  backup_folder_activity_task
 Provides the steps to perform one complete backup of the Folder instance. More...
 
class  folder_content_file_info
 File browsing support class. More...
 
class  folder_tree
 
class  mod_folder\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_folder\analytics\indicator\cognitive_depth
 Cognitive depth indicator - folder. More...
 
class  mod_folder\analytics\indicator\social_breadth
 Social breadth indicator - folder. More...
 
class  mod_folder\completion\custom_completion
 
class  mod_folder\content\exporter
 A class which assists a component to export content. More...
 
class  mod_folder\event\all_files_downloaded
 The mod_folder course module viewed event class. More...
 
class  mod_folder\event\course_module_instance_list_viewed
 The mod_folder instance list viewed event class. More...
 
class  mod_folder\event\course_module_viewed
 The mod_folder course module viewed event class. More...
 
class  mod_folder\event\folder_updated
 The mod_folder folder updated event class. More...
 
class  mod_folder\privacy\provider
 The mod_folder module does not store any data. More...
 
class  mod_folder\search\activity
 Search area for mod_folder activities. More...
 
class  mod_folder_edit_form
 
class  mod_folder_external
 
class  mod_folder_generator
 mod_folder data generator class. More...
 
class  mod_folder_mod_form
 
class  mod_folder_renderer
 
class  moodle1_mod_folder_handler
 Folder conversion handler. More...
 
class  restore_folder_activity_structure_step
 Define all the restore steps that will be used by the restore_folder_activity_task. More...
 
class  restore_folder_activity_task
 folder restore task that provides all the settings and steps to perform one complete restore of the activity More...
 

Functions

 folder_add_instance ($data, $mform)
 Add folder instance.
 
 folder_archive_available ($folder, $cm)
 Check if the folder can be zipped and downloaded.
 
 folder_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.
 
 folder_cm_info_dynamic (cm_info $cm)
 Sets dynamic information about a course module.
 
 folder_cm_info_view (cm_info $cm)
 Overwrites the content in the course-module object with the folder files list if folder.display == FOLDER_DISPLAY_INLINE.
 
 folder_delete_instance ($id)
 Delete folder instance.
 
 folder_dndupload_handle ($uploadinfo)
 Handle a file that has been uploaded.
 
 folder_dndupload_register ()
 Register the ability to handle drag and drop file uploads.
 
 folder_downloaded ($folder, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the all_files_downloaded event.
 
 folder_export_contents ($cm, $baseurl)
 Export folder resource contents.
 
 folder_get_coursemodule_info ($cm)
 Given a coursemodule object, this function returns the extra information needed to print this activity in various places.
 
 folder_get_directory_size ($directory)
 Recursively measure the size of the files in a directory.
 
 folder_get_file_areas ($course, $cm, $context)
 Lists all browsable file areas.
 
 folder_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)
 File browsing support for folder module content area.
 
 folder_get_post_actions ()
 List the actions that correspond to a post of this module.
 
 folder_get_recent_activity ($context, $timestart, $userid=0)
 Gets recent file uploads in a given folder.
 
 folder_get_recent_mod_activity (&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0)
 Returns all uploads since a given time in specified folder.
 
 folder_get_view_actions ()
 List the actions that correspond to a view of this module.
 
 folder_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types.
 
 folder_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 Serves the folder files.
 
 folder_print_recent_activity ($course, $viewfullnames, $timestart)
 Given a course and a date, prints a summary of all the new files posted in folder resources since that date.
 
 folder_print_recent_mod_activity ($activity, $courseid, $detail, $modnames, $viewfullnames)
 Outputs the folder uploads indicated by $activity.
 
 folder_reset_userdata ($data)
 This function is used by the reset_course_userdata function in moodlelib.
 
 folder_supports ($feature)
 List of features supported in Folder module.
 
 folder_update_instance ($data, $mform)
 Update folder instance.
 
 folder_view ($folder, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event.
 
 mod_folder_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none.
 
 mod_folder_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.
 
 xmldb_folder_install ()
 
 xmldb_folder_upgrade ($oldversion)
 

Variables

 $capabilities
 
 $functions
 
 $logs
 
 $plugin = 2024041600
 
$plugin component = 'mod_folder'
 
$plugin cron = 0
 
const FOLDER_DISPLAY_INLINE 1
 Display folder contents inline in a course.
 
const FOLDER_DISPLAY_PAGE 0
 Display folder contents on a separate page.
 
$plugin version = 2024042200
 

Detailed Description

Function Documentation

◆ folder_add_instance()

folder_add_instance ( $data,
$mform )

Add folder instance.

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

◆ folder_archive_available()

folder_archive_available ( $folder,
$cm )

Check if the folder can be zipped and downloaded.

Parameters
stdClass$folder
context_module$cm
Return values
boolTrue if the folder can be zipped and downloaded.
Exceptions
dml_exception

◆ folder_check_updates_since()

folder_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

◆ folder_cm_info_dynamic()

folder_cm_info_dynamic ( cm_info $cm)

Sets dynamic information about a course module.

This function is called from cm_info when displaying the module mod_folder can be displayed inline on course page and therefore have no course link

Parameters
cm_info$cm

◆ folder_cm_info_view()

folder_cm_info_view ( cm_info $cm)

Overwrites the content in the course-module object with the folder files list if folder.display == FOLDER_DISPLAY_INLINE.

Parameters
cm_info$cm

◆ folder_delete_instance()

folder_delete_instance ( $id)

Delete folder instance.

Parameters
int$id
Return values
booltrue

◆ folder_dndupload_handle()

folder_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

◆ folder_dndupload_register()

folder_dndupload_register ( )

Register the ability to handle drag and drop file uploads.

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

◆ folder_downloaded()

folder_downloaded ( $folder,
$course,
$cm,
$context )

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

Parameters
stdClass$folderfolder object
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Since
Moodle 3.1

◆ folder_export_contents()

folder_export_contents ( $cm,
$baseurl )

Export folder resource contents.

Return values
arrayof file content

◆ folder_get_coursemodule_info()

folder_get_coursemodule_info ( $cm)

Given a coursemodule object, this function returns the extra information needed to print this activity in various places.

If folder needs to be displayed inline we store additional information in customdata, so functions folder_cm_info_dynamic() and folder_cm_info_view() do not need to do DB queries

Parameters
cm_info$cm
Return values
cached_cm_infoinfo

◆ folder_get_directory_size()

folder_get_directory_size ( $directory)

Recursively measure the size of the files in a directory.

Parameters
array$directory
Return values
intsize of directory contents in bytes

◆ folder_get_file_areas()

folder_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

◆ folder_get_file_info()

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

File browsing support for folder module content area.

Parameters
file_browser$browserfile browser instance
array$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

◆ folder_get_post_actions()

folder_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

◆ folder_get_recent_activity()

folder_get_recent_activity ( $context,
$timestart,
$userid = 0 )

Gets recent file uploads in a given folder.

Does not perform security checks.

Parameters
object$context
int$timestart
int$userid
Return values
array

◆ folder_get_recent_mod_activity()

folder_get_recent_mod_activity ( & $activities,
& $index,
$timestart,
$courseid,
$cmid,
$userid = 0,
$groupid = 0 )

Returns all uploads since a given time in specified folder.

Parameters
array$activities
int$index
int$timestart
int$courseid
int$cmid
int$userid
int$groupidnot used, but required for compatibilty with other modules

◆ folder_get_view_actions()

folder_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

◆ folder_page_type_list()

folder_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

◆ folder_pluginfile()

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

Serves the folder files.

Parameters
stdClass$coursecourse object
stdClass$cmcourse module
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

◆ folder_print_recent_activity()

folder_print_recent_activity ( $course,
$viewfullnames,
$timestart )

Given a course and a date, prints a summary of all the new files posted in folder resources since that date.

@uses CONTEXT_MODULE

Parameters
object$course
bool$viewfullnamescapability
int$timestart
Return values
boolsuccess

◆ folder_print_recent_mod_activity()

folder_print_recent_mod_activity ( $activity,
$courseid,
$detail,
$modnames,
$viewfullnames )

Outputs the folder uploads indicated by $activity.

Parameters
object$activitythe activity object the folder resides in
int$courseidthe id of the course the folder resides in
bool$detailnot used, but required for compatibilty with other modules
int$modnamesnot used, but required for compatibilty with other modules
bool$viewfullnamesnot used, but required for compatibilty with other modules

◆ folder_reset_userdata()

folder_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

◆ folder_supports()

folder_supports ( $feature)

List of features supported in Folder 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.

◆ folder_update_instance()

folder_update_instance ( $data,
$mform )

Update folder instance.

Parameters
object$data
object$mform
Return values
booltrue

◆ folder_view()

folder_view ( $folder,
$course,
$cm,
$context )

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

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

◆ mod_folder_core_calendar_provide_event_action()

mod_folder_core_calendar_provide_event_action ( calendar_event $event,
core_calendar\action_factory $factory,
int $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
int$useridUser id to use for all capability checks, etc. Set to 0 for current user (default).
Return values
core_calendar\local\event\entities\action_interface|null

◆ mod_folder_get_path_from_pluginfile()

mod_folder_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.

Variable Documentation

◆ $functions

$functions
Initial value:
= array(
'mod_folder_view_folder' => array(
'classname' => 'mod_folder_external',
'methodname' => 'view_folder',
'description' => 'Simulate the view.php web interface folder: trigger events, completion, etc...',
'type' => 'write',
'capabilities' => 'mod/folder:view',
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
'mod_folder_get_folders_by_courses' => array(
'classname' => 'mod_folder_external',
'methodname' => 'get_folders_by_courses',
'description' => 'Returns a list of folders in a provided list of courses, if no list is provided all folders that
the user can view will be returned. Please note that this WS is not returning the folder contents.',
'type' => 'read',
'capabilities' => 'mod/folder:view',
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
)
const MOODLE_OFFICIAL_MOBILE_SERVICE
Moodle mobile app service name.
Definition moodlelib.php:555

◆ $logs

$logs
Initial value:
= array(
array('module'=>'folder', 'action'=>'view', 'mtable'=>'folder', 'field'=>'name'),
array('module'=>'folder', 'action'=>'view all', 'mtable'=>'folder', 'field'=>'name'),
array('module'=>'folder', 'action'=>'update', 'mtable'=>'folder', 'field'=>'name'),
array('module'=>'folder', 'action'=>'add', 'mtable'=>'folder', 'field'=>'name'),
)