Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
mod_h5pactivity

Namespaces

namespace  mod_h5pactivity\event
  
 
namespace  mod_h5pactivity\external
  
 
namespace  mod_h5pactivity\local
  
 
namespace  mod_h5pactivity\local\report
  
 
namespace  mod_h5pactivity\output
  
 
namespace  mod_h5pactivity\output\result
  
 
namespace  mod_h5pactivity\privacy
  
 
namespace  mod_h5pactivity\search
  
 
namespace  mod_h5pactivity\xapi
  
 

Classes

class  backup_h5pactivity_activity_structure_step
 Define the complete structure for backup, with file and id annotations. More...
 
class  backup_h5pactivity_activity_task
 The class provides all the settings and steps to perform one complete backup of mod_h5pactivity. More...
 
class  behat_mod_h5pactivity_generator
 
class  mod_h5pactivity\event\course_module_instance_list_viewed
 The course_module_instance_list_viewed event class. More...
 
class  mod_h5pactivity\event\course_module_viewed
 The course_module_viewed event class. More...
 
class  mod_h5pactivity\event\statement_received
 The statement_received event class. More...
 
class  mod_h5pactivity\external\get_attempts
 
class  mod_h5pactivity\external\get_results
 
class  mod_h5pactivity\external\get_user_attempts
 
class  mod_h5pactivity\external\h5pactivity_summary_exporter
 Class for exporting h5p activity data. More...
 
class  mod_h5pactivity\external\log_report_viewed
 
class  mod_h5pactivity\external\log_report_viewed_testcase
 External function test for log_report_viewed. More...
 
class  mod_h5pactivity\external\view_h5pactivity
 
class  mod_h5pactivity\local\attempt
 Class attempt for H5P activity. More...
 
class  mod_h5pactivity\local\grader
 Class for handling H5P activity grading. More...
 
class  mod_h5pactivity\local\manager
 Class manager for H5P activity. More...
 
interface  mod_h5pactivity\local\report
 Interface for any mod_h5pactivity report. More...
 
class  mod_h5pactivity\local\report\attempts
 Class H5P activity attempts report. More...
 
class  mod_h5pactivity\local\report\participants
 Class H5P activity participants report. More...
 
class  mod_h5pactivity\local\report\results
 Class H5P activity results report. More...
 
class  mod_h5pactivity\output\attempt
 Class to help display report link in mod_h5pactivity. More...
 
class  mod_h5pactivity\output\reportattempts
 Class to output an attempts report on mod_h5pactivity. More...
 
class  mod_h5pactivity\output\reportlink
 Class to help display report link in mod_h5pactivity. More...
 
class  mod_h5pactivity\output\reportresults
 Class to display the result report in mod_h5pactivity. More...
 
class  mod_h5pactivity\output\result
 Class to display an attempt tesult in mod_h5pactivity. More...
 
class  mod_h5pactivity\output\result\choice
 Class to display H5P choice result. More...
 
class  mod_h5pactivity\output\result\fillin
 Class to display H5P fill-in result. More...
 
class  mod_h5pactivity\output\result\longfillin
 Class to display H5P long fill in result. More...
 
class  mod_h5pactivity\output\result\matching
 Class to display H5P matching result. More...
 
class  mod_h5pactivity\output\result\other
 Class to display H5P other result. More...
 
class  mod_h5pactivity\output\result\sequencing
 Class to display H5P sequencing result. More...
 
class  mod_h5pactivity\output\result\truefalse
 Class to display H5P choice result. More...
 
class  mod_h5pactivity\privacy\provider
 
class  mod_h5pactivity\search\activity
 Search area for mod_h5pactivity activities. More...
 
class  mod_h5pactivity\xapi\handler
 
class  mod_h5pactivity_generator
 h5pactivity module data generator class. More...
 
class  mod_h5pactivity_mod_form
 Module instance settings form. More...
 
class  restore_h5pactivity_activity_structure_step
 Defines the structure step to restore one mod_h5pactivity activity. More...
 
class  restore_h5pactivity_activity_task
 Restore task for mod_h5pactivity. More...
 

Functions

 h5pactivity_add_instance (stdClass $data, mod_h5pactivity_mod_form $mform=null)
 Saves a new instance of the mod_h5pactivity into the database.
 
 h5pactivity_check_updates_since (cm_info $cm, int $from, array $filter=[])
 Check if the module has any update that affects the current user since a given time.
 
 h5pactivity_delete_instance (int $id)
 Removes an instance of the mod_h5pactivity from the database.
 
 h5pactivity_dndupload_handle ($uploadinfo)
 Handle a file that has been uploaded.
 
 h5pactivity_dndupload_register ()
 Register the ability to handle drag and drop file uploads.
 
 h5pactivity_extend_settings_navigation (settings_navigation $settingsnav, navigation_node $h5pactivitynode=null)
 Extends the settings navigation with the H5P activity settings.
 
 h5pactivity_fetch_recent_activity (array $submissions, int $courseid)
 Fetches recent activity for course module.
 
 h5pactivity_get_file_areas (stdClass $course, stdClass $cm, stdClass $context)
 Returns the lists of all browsable file areas within the given module context.
 
 h5pactivity_get_file_info (file_browser $browser, array $areas, stdClass $course, stdClass $cm, context $context, string $filearea, ?int $itemid=null, ?string $filepath=null, ?string $filename=null)
 File browsing support for data module.
 
 h5pactivity_get_recent_mod_activity (array &$activities, int &$index, int $timestart, int $courseid, int $cmid, int $userid=0, int $groupid=0)
 Returns all h5pactivities since a given time.
 
 h5pactivity_grade_item_delete (stdClass $moduleinstance)
 Delete grade item for given mod_h5pactivity instance.
 
 h5pactivity_grade_item_update (stdClass $moduleinstance, $grades=null)
 Creates or updates grade item for the given mod_h5pactivity instance.
 
 h5pactivity_page_type_list (string $pagetype, ?stdClass $parentcontext, stdClass $currentcontext)
 Return a list of page types.
 
 h5pactivity_pluginfile ($course, $cm, context $context, string $filearea, array $args, bool $forcedownload, array $options=[])
 Serves the files from the mod_h5pactivity file areas.
 
 h5pactivity_print_recent_activity ($course, bool $viewfullnames, int $timestart)
 Print recent activity from all h5pactivities in a given course.
 
 h5pactivity_print_recent_mod_activity (stdClass $activity, int $courseid, bool $detail, array $modnames)
 Print recent activity from all h5pactivities in a given course.
 
 h5pactivity_rescale_activity_grades (stdClass $course, stdClass $cm, float $oldmin, float $oldmax, float $newmin, float $newmax)
 Rescale all grades for this activity and push the new grades to the gradebook.
 
 h5pactivity_reset_course_form_defaults (stdClass $course)
 Course reset form defaults.
 
 h5pactivity_reset_course_form_definition (&$mform)
 Implementation of the function for printing the form elements that control whether the course reset functionality affects the H5P activity.
 
 h5pactivity_reset_gradebook (int $courseid, string $type='')
 Removes all grades from gradebook.
 
 h5pactivity_reset_userdata (stdClass $data)
 This function is used by the reset_course_userdata function in moodlelib.
 
 h5pactivity_scale_used_anywhere (int $scaleid)
 Checks if scale is being used by any instance of mod_h5pactivity.
 
 h5pactivity_set_mainfile (stdClass $data)
 Saves draft files as the activity package.
 
 h5pactivity_supports (string $feature)
 Checks if H5P activity supports a specific feature.
 
 h5pactivity_update_grades (stdClass $moduleinstance, int $userid=0)
 Update mod_h5pactivity grades in the gradebook.
 
 h5pactivity_update_instance (stdClass $data, mod_h5pactivity_mod_form $mform=null)
 Updates an instance of the mod_h5pactivity in the database.
 
 xmldb_h5pactivity_upgrade ($oldversion)
 Function to upgrade mod_h5pactivity.
 

Variables

 $capabilities
 
global $CFG
 
global mod_h5pactivity\external::$CFG
 
global mod_h5pactivity\local\report::$CFG
 
global mod_h5pactivity\xapi::$CFG
 
 $functions
 
 $plugin = 2023041800
 
$plugin component = 'mod_h5pactivity'
 
$plugin version = 2023042402
 

Detailed Description

Function Documentation

◆ h5pactivity_add_instance()

h5pactivity_add_instance ( stdClass $data,
mod_h5pactivity_mod_form $mform = null )

Saves a new instance of the mod_h5pactivity 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
stdClass$dataAn object from the form.
mod_h5pactivity_mod_form$mformThe form.
Return values
intThe id of the newly inserted record.

◆ h5pactivity_check_updates_since()

h5pactivity_check_updates_since ( cm_info $cm,
int $from,
array $filter = [] )

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

◆ h5pactivity_delete_instance()

h5pactivity_delete_instance ( int $id)

Removes an instance of the mod_h5pactivity from the database.

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

◆ h5pactivity_dndupload_handle()

h5pactivity_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

◆ h5pactivity_dndupload_register()

h5pactivity_dndupload_register ( )

Register the ability to handle drag and drop file uploads.

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

◆ h5pactivity_extend_settings_navigation()

h5pactivity_extend_settings_navigation ( settings_navigation $settingsnav,
navigation_node $h5pactivitynode = null )

Extends the settings navigation with the H5P activity settings.

This function is called when the context for the page is an H5P activity. This is not called by AJAX so it is safe to rely on the $PAGE.

Parameters
settings_navigation$settingsnavThe settings navigation object
navigation_node$h5pactivitynodeThe node to add module settings to

◆ h5pactivity_fetch_recent_activity()

h5pactivity_fetch_recent_activity ( array $submissions,
int $courseid )

Fetches recent activity for course module.

Parameters
array$submissionsThe activity submissions
int$courseidLimit the search to this course
Return values
array\$recentactivityrecent activity in a course.

◆ h5pactivity_get_file_areas()

h5pactivity_get_file_areas ( stdClass $course,
stdClass $cm,
stdClass $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 file_browser::get_file_info_context_module().

Parameters
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Return values
string[]array of pair file area => human file area name

◆ h5pactivity_get_file_info()

h5pactivity_get_file_info ( file_browser $browser,
array $areas,
stdClass $course,
stdClass $cm,
context $context,
string $filearea,
?int $itemid = null,
?string $filepath = null,
?string $filename = null )

File browsing support for data module.

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

◆ h5pactivity_get_recent_mod_activity()

h5pactivity_get_recent_mod_activity ( array & $activities,
int & $index,
int $timestart,
int $courseid,
int $cmid,
int $userid = 0,
int $groupid = 0 )

Returns all h5pactivities since a given time.

Parameters
array$activitiesThe activity information is returned in this array
int$indexThe current index in the activities array
int$timestartThe earliest activity to show
int$courseidLimit the search to this course
int$cmidThe course module id
int$useridOptional user id
int$groupidOptional group id
Return values
void

◆ h5pactivity_grade_item_delete()

h5pactivity_grade_item_delete ( stdClass $moduleinstance)

Delete grade item for given mod_h5pactivity instance.

Parameters
stdClass$moduleinstanceInstance object.
Return values
intReturns GRADE_UPDATE_OK, GRADE_UPDATE_FAILED, GRADE_UPDATE_MULTIPLE or GRADE_UPDATE_ITEM_LOCKED

◆ h5pactivity_grade_item_update()

h5pactivity_grade_item_update ( stdClass $moduleinstance,
$grades = null )

Creates or updates grade item for the given mod_h5pactivity instance.

Needed by grade_update_mod_grades().

Parameters
stdClass$moduleinstanceInstance object with extra cmidnumber and modname property.
mixed$gradesoptional array/object of grade(s); 'reset' means reset grades in gradebook
Return values
intint 0 if ok, error code otherwise

◆ h5pactivity_page_type_list()

h5pactivity_page_type_list ( string $pagetype,
?stdClass $parentcontext,
stdClass $currentcontext )

Return a list of page types.

Parameters
string$pagetypecurrent page type
stdClass | null$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block
Return values
arrayarray of page types and it's names

◆ h5pactivity_pluginfile()

h5pactivity_pluginfile ( $course,
$cm,
context $context,
string $filearea,
array $args,
bool $forcedownload,
array $options = [] )

Serves the files from the mod_h5pactivity file areas.

Parameters
mixed$coursecourse or id of the course
mixed$cmcourse module or id of the course module
context$context
string$filearea
array$args
bool$forcedownload
array$optionsadditional options affecting the file serving
Return values
boolfalse if file not found, does not return if found - just send the file

◆ h5pactivity_print_recent_activity()

h5pactivity_print_recent_activity ( $course,
bool $viewfullnames,
int $timestart )

Print recent activity from all h5pactivities in a given course.

This is used by the recent activity block

Parameters
mixed$coursethe course to print activity for
bool$viewfullnamesboolean to determine whether to show full names or not
int$timestartthe time the rendering started
Return values
booltrue if activity was printed, false otherwise.

◆ h5pactivity_print_recent_mod_activity()

h5pactivity_print_recent_mod_activity ( stdClass $activity,
int $courseid,
bool $detail,
array $modnames )

Print recent activity from all h5pactivities in a given course.

This is used by course/recent.php

Parameters
stdClass$activity
int$courseid
bool$detail
array$modnames

◆ h5pactivity_rescale_activity_grades()

h5pactivity_rescale_activity_grades ( stdClass $course,
stdClass $cm,
float $oldmin,
float $oldmax,
float $newmin,
float $newmax )

Rescale all grades for this activity and push the new grades to the gradebook.

Parameters
stdClass$courseCourse db record
stdClass$cmCourse module db record
float$oldmin
float$oldmax
float$newmin
float$newmax
Return values
booltrue if reescale is successful

◆ h5pactivity_reset_course_form_defaults()

h5pactivity_reset_course_form_defaults ( stdClass $course)

Course reset form defaults.

Parameters
stdClass$coursethe course object
Return values
array

◆ h5pactivity_reset_course_form_definition()

h5pactivity_reset_course_form_definition ( & $mform)

Implementation of the function for printing the form elements that control whether the course reset functionality affects the H5P activity.

Parameters
MoodleQuickForm$mformform passed by reference

◆ h5pactivity_reset_gradebook()

h5pactivity_reset_gradebook ( int $courseid,
string $type = '' )

Removes all grades from gradebook.

Parameters
int$courseidCoude ID
string$typeoptional type (default '')

◆ h5pactivity_reset_userdata()

h5pactivity_reset_userdata ( stdClass $data)

This function is used by the reset_course_userdata function in moodlelib.

This function will remove all H5P attempts in the database and clean up any related data.

Parameters
stdClass$datathe data submitted from the reset course.
Return values
arrayof reseting status

◆ h5pactivity_scale_used_anywhere()

h5pactivity_scale_used_anywhere ( int $scaleid)

Checks if scale is being used by any instance of mod_h5pactivity.

This is used to find out if scale used anywhere.

Parameters
int$scaleidID of the scale.
Return values
boolTrue if the scale is used by any mod_h5pactivity instance.

◆ h5pactivity_set_mainfile()

h5pactivity_set_mainfile ( stdClass $data)

Saves draft files as the activity package.

Parameters
stdClass$dataan object from the form

◆ h5pactivity_supports()

h5pactivity_supports ( string $feature)

Checks if H5P activity supports a specific feature.

@uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_SHOW_DESCRIPTION @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_COMPLETION_HAS_RULES @uses FEATURE_MODEDIT_DEFAULT_COMPLETION @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES @uses FEATURE_BACKUP_MOODLE2

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.

◆ h5pactivity_update_grades()

h5pactivity_update_grades ( stdClass $moduleinstance,
int $userid = 0 )

Update mod_h5pactivity grades in the gradebook.

Needed by grade_update_mod_grades().

Parameters
stdClass$moduleinstanceInstance object with extra cmidnumber and modname property.
int$useridUpdate grade of specific user only, 0 means all participants.

◆ h5pactivity_update_instance()

h5pactivity_update_instance ( stdClass $data,
mod_h5pactivity_mod_form $mform = null )

Updates an instance of the mod_h5pactivity 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
stdClass$dataAn object from the form in mod_form.php.
mod_h5pactivity_mod_form$mformThe form.
Return values
boolTrue if successful, false otherwise.

◆ xmldb_h5pactivity_upgrade()

xmldb_h5pactivity_upgrade ( $oldversion)

Function to upgrade mod_h5pactivity.

Parameters
int$oldversionthe version we are upgrading from
Return values
boolresult