Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
mod_subsection

Namespaces

namespace  mod_subsection
  
 
namespace  mod_subsection\courseformat
  
 
namespace  mod_subsection\event
  
 
namespace  mod_subsection\local\callbacks
  
 
namespace  mod_subsection\output
  
 
namespace  mod_subsection\privacy
  
 

Classes

class  backup_subsection_activity_structure_step
 Define the complete structure for backup, with file and id annotations. More...
 
class  backup_subsection_activity_task
 Provides all the settings and steps to perform a complete backup of mod_subsection. More...
 
class  mod_subsection\courseformat\sectiondelegate
 
class  mod_subsection\event\course_module_instance_list_viewed
 
class  mod_subsection\event\course_module_viewed
 
class  mod_subsection\local\callbacks\after_cm_name_edited_handler
 
class  mod_subsection\local\callbacks\before_activitychooserbutton_exported_handler
 
class  mod_subsection\manager
 
class  mod_subsection\output\mobile
 Mobile output class for subsection. More...
 
class  mod_subsection\permission
 
class  mod_subsection\privacy\provider
 
class  mod_subsection_generator
 
class  mod_subsection_mod_form
 Module instance settings form. More...
 
class  mod_subsection_renderer
 
class  restore_subsection_activity_structure_step
 Defines the structure step to restore one mod_subsection activity. More...
 
class  restore_subsection_activity_task
 Restore task for mod_subsection. More...
 

Functions

 mod_subsection_get_course_content_items (core_course\local\entity\content_item $contentitem, stdClass $user, stdClass $course)
 Get the course content items for the subsection module.
 
 mod_subsection_get_fontawesome_icon_map ()
 Get icon mapping for font-awesome.
 
 subsection_add_instance ($moduleinstance, $mform=null)
 Saves a new instance of the mod_subsection into the database.
 
 subsection_cm_info_dynamic (cm_info $cm)
 Sets dynamic information about a course module.
 
 subsection_cm_info_view (cm_info $cm)
 Sets the special subsection display on course page.
 
 subsection_delete_instance ($id)
 Removes an instance of the mod_subsection from the database.
 
 subsection_extend_navigation ($subsectionnode, $course, $module, $cm)
 Extends the global navigation tree by adding mod_subsection nodes if there is a relevant content.
 
 subsection_extend_settings_navigation ($settingsnav, $subsectionnode=null)
 Extends the settings navigation with the mod_subsection settings.
 
 subsection_get_coursemodule_info (stdClass $coursemodule)
 Add a get_coursemodule_info function to add 'extra' information for the course (see resource).
 
 subsection_get_file_areas ($course, $cm, $context)
 Returns the lists of all browsable file areas within the given module context.
 
 subsection_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)
 File browsing support for mod_subsection file areas.
 
 subsection_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, $options=[])
 Serves the files from the mod_subsection file areas.
 
 subsection_supports ($feature)
 Return if the plugin supports $feature.
 
 subsection_update_instance ($moduleinstance, $mform=null)
 Updates an instance of the mod_subsection in the database.
 
 xmldb_subsection_uninstall ()
 Custom uninstallation procedure.
 
 xmldb_subsection_upgrade ($oldversion)
 Execute mod_subsection upgrade from the given old version.
 

Variables

 $addons
 
 $callbacks
 
 $capabilities
 
 $plugin = 2025040800
 
$plugin component = 'mod_subsection'
 
$plugin maturity = MATURITY_STABLE
 
$plugin version = 2025041401
 

Detailed Description

Function Documentation

◆ mod_subsection_get_course_content_items()

mod_subsection_get_course_content_items ( core_course\local\entity\content_item $contentitem,
stdClass $user,
stdClass $course )

Get the course content items for the subsection module.

This function is called when the course content is being generated for the activity chooser. However, here this module is never shown in the activity chooser so we return an empty array.

Parameters
core_course\local\entity\content_item$contentitem
stdClass$user
stdClass$course
Return values
array

◆ subsection_add_instance()

subsection_add_instance ( $moduleinstance,
$mform = null )

Saves a new instance of the mod_subsection into the database.

Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the instance.

Parameters
object$moduleinstanceAn object from the form.
mod_subsection_mod_form$mformThe form.
Return values
intThe id of the newly inserted record.

◆ subsection_cm_info_dynamic()

subsection_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_subsection can be displayed inline on course page and therefore have no course link

Parameters
cm_info$cm

◆ subsection_cm_info_view()

subsection_cm_info_view ( cm_info $cm)

Sets the special subsection display on course page.

Parameters
cm_info$cmCourse-module object

◆ subsection_delete_instance()

subsection_delete_instance ( $id)

Removes an instance of the mod_subsection from the database.

Parameters
int$idId of the module instance.
Return values
boolTrue if successful, false on failure.

◆ subsection_extend_navigation()

subsection_extend_navigation ( $subsectionnode,
$course,
$module,
$cm )

Extends the global navigation tree by adding mod_subsection nodes if there is a relevant content.

This can be called by an AJAX request so do not rely on $PAGE as it might not be set up properly.

Parameters
navigation_node$subsectionnodeAn object representing the navigation tree node.
stdClass$course
stdClass$module
cm_info$cm

◆ subsection_extend_settings_navigation()

subsection_extend_settings_navigation ( $settingsnav,
$subsectionnode = null )

Extends the settings navigation with the mod_subsection settings.

This function is called when the context for the page is a mod_subsection module. This is not called by AJAX so it is safe to rely on the $PAGE.

Parameters
settings_navigation$settingsnav{
See also
settings_navigation}
Parameters
navigation_node$subsectionnode{
See also
navigation_node}

◆ subsection_get_coursemodule_info()

subsection_get_coursemodule_info ( stdClass $coursemodule)

Add a get_coursemodule_info function to add 'extra' information for the course (see resource).

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$coursemoduleThe coursemodule object (record).
Return values
cached_cm_info|boolAn object on information that the courses will know about. False if not found.

◆ subsection_get_file_areas()

subsection_get_file_areas ( $course,
$cm,
$context )

Returns the lists of all browsable file areas within the given module context.

The file area 'intro' for the activity introduction field is added automatically by {

See also
file_browser\get_file_info_context_module()}.
Parameters
stdClass$course
stdClass$cm
stdClass$context
Return values
string[].

◆ subsection_get_file_info()

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

File browsing support for mod_subsection file areas.

Parameters
file_browser$browser
array$areas
stdClass$course
stdClass$cm
stdClass$context
string$filearea
int$itemid
string$filepath
string$filename
Return values
file_info|nullfile_info instance or null if not found.

◆ subsection_pluginfile()

subsection_pluginfile ( $course,
$cm,
$context,
$filearea,
$args,
$forcedownload,
$options = [] )

Serves the files from the mod_subsection file areas.

Parameters
stdClass$courseThe course object.
stdClass$cmThe course module object.
stdClass$contextThe mod_subsection's context.
string$fileareaThe name of the file area.
array$argsExtra arguments (itemid, path).
bool$forcedownloadWhether or not force download.
array$optionsAdditional options affecting the file serving.

◆ subsection_supports()

subsection_supports ( $feature)

Return if the plugin supports $feature.

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

◆ subsection_update_instance()

subsection_update_instance ( $moduleinstance,
$mform = null )

Updates an instance of the mod_subsection in the database.

Given an object containing all the necessary data (defined in mod_form.php), this function will update an existing instance with new data.

Parameters
object$moduleinstanceAn object from the form in mod_form.php.
mod_subsection_mod_form$mformThe form.
Return values
boolTrue if successful, false otherwise.

◆ xmldb_subsection_uninstall()

xmldb_subsection_uninstall ( )

Custom uninstallation procedure.

License
https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

◆ xmldb_subsection_upgrade()

xmldb_subsection_upgrade ( $oldversion)

Execute mod_subsection upgrade from the given old version.

License
https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Parameters
int$oldversion
Return values
bool

Variable Documentation

◆ $addons

$addons
Initial value:
= [
'mod_subsection' => [
'handlers' => [
'subsection' => [
'delegate' => '',
'init' => 'mobile_init',
'styles' => [
'url' => $CFG->wwwroot . '/mod/subsection/mobileapp/styles.css',
'version' => '1',
],
],
],
],
]

◆ $callbacks

$callbacks
Initial value:
= [
[
'hook' => core_courseformat\hook\after_cm_name_edited::class,
'callback' => 'mod_subsection\local\callbacks\after_cm_name_edited_handler::callback',
'priority' => 0,
],
[
'hook' => core_course\hook\before_activitychooserbutton_exported::class,
'callback' => [mod_subsection\local\callbacks\before_activitychooserbutton_exported_handler::class, 'callback'],
],
]

◆ $capabilities

$capabilities
Initial value:
= [
'mod/subsection:addinstance' => [
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => [
'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