Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Files | Namespaces | Classes | Functions | Variables
mod_folder

Files

file  access.php
 Capability definitions for the folder module.
 
file  activity.php
 Search area for mod_folder activities.
 
file  activity_base.php
 Activity base class.
 
file  all_files_downloaded.php
 The mod_folder course module downloaded event.
 
file  backup_folder_activity_task.class.php
 Defines backup_folder_activity_task class.
 
file  backup_folder_stepslib.php
 Define all the backup steps that will be used by the backup_folder_activity_task.
 
file  cognitive_depth.php
 Cognitive depth indicator - folder.
 
file  course_module_instance_list_viewed.php
 The mod_folder instance list viewed event.
 
file  course_module_viewed.php
 The mod_folder course module viewed event.
 
file  edit_form.php
 A moodle form to manage folder files.
 
file  external.php
 folder external API
 
file  folder_updated.php
 The mod_folder folder updated event.
 
file  install.php
 Post installation and migration code.
 
file  lib.php
 Provides support for the conversion of moodle1 backup to the moodle2 format.
 
file  lib.php
 Mandatory public API of folder module.
 
file  lib.php
 mod_folder data generator.
 
file  locallib.php
 Private folder module utility functions.
 
file  log.php
 Definition of log events.
 
file  mod_form.php
 Folder configuration form.
 
file  provider.php
 Privacy Subsystem implementation for mod_folder.
 
file  renderer.php
 Folder module renderer.
 
file  restore_folder_activity_task.class.php
 @subpackage backup-moodle2
 
file  restore_folder_stepslib.php
 @subpackage backup-moodle2
 
file  services.php
 folder external functions and service definitions.
 
file  settings.php
 Folder module admin settings and defaults.
 
file  social_breadth.php
 Social breadth indicator - folder.
 
file  upgrade.php
 Folder module upgrade code.
 
file  version.php
 Folder module version information.
 

Namespaces

namespace  mod_folder\analytics\indicator
  
 
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\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
 
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. More...
 
 folder_archive_available ($folder, $cm)
 Check if the folder can be zipped and downloaded. More...
 
 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. More...
 
 folder_cm_info_dynamic (cm_info $cm)
 Sets dynamic information about a course module. More...
 
 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. More...
 
 folder_delete_instance ($id)
 Delete folder instance. More...
 
 folder_dndupload_handle ($uploadinfo)
 Handle a file that has been uploaded. More...
 
 folder_dndupload_register ()
 Register the ability to handle drag and drop file uploads. More...
 
 folder_downloaded ($folder, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the all_files_downloaded event. More...
 
 folder_export_contents ($cm, $baseurl)
 Export folder resource contents. More...
 
 folder_get_coursemodule_info ($cm)
 Given a coursemodule object, this function returns the extra information needed to print this activity in various places. More...
 
 folder_get_directory_size ($directory)
 Recursively measure the size of the files in a directory. More...
 
 folder_get_file_areas ($course, $cm, $context)
 
 folder_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)
 
 folder_get_post_actions ()
 List the actions that correspond to a post of this module. More...
 
 folder_get_recent_activity ($context, $timestart, $userid=0)
 Gets recent file uploads in a given folder. More...
 
 folder_get_recent_mod_activity (&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0)
 Returns all uploads since a given time in specified folder. More...
 
 folder_get_view_actions ()
 List the actions that correspond to a view of this module. More...
 
 folder_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types. More...
 
 folder_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 
 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. More...
 
 folder_print_recent_mod_activity ($activity, $courseid, $detail, $modnames, $viewfullnames)
 Outputs the folder uploads indicated by $activity. More...
 
 folder_reset_userdata ($data)
 This function is used by the reset_course_userdata function in moodlelib. More...
 
 folder_supports ($feature)
 List of features supported in Folder module. More...
 
 folder_update_instance ($data, $mform)
 Update folder instance. More...
 
 folder_view ($folder, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event. More...
 
 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. More...
 
 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. More...
 
 xmldb_folder_install ()
 
 xmldb_folder_upgrade ($oldversion)
 

Variables

 $capabilities
 
 $functions
 
 $logs
 
 $plugin = 2020060900
 
$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 = 2020061500
 

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

◆ 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:501

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