Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)

Functions

 mod_wiki_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_wiki_get_fontawesome_icon_map ()
 Get icon mapping for font-awesome.
 
 wiki_add_instance ($wiki)
 Given an object containing all the necessary data, (defined by the form in mod.html) this function will create a new instance and return the id number of the new instance.
 
 wiki_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.
 
 wiki_cm_info_dynamic (cm_info $cm)
 Sets dynamic information about a course module.
 
 wiki_comment_permissions ($comment_param)
 Running addtional permission check on plugin, for example, plugins may have switch to turn on/off comments option, this callback will affect UI display, not like pluginname_comment_validate only throw exceptions.
 
 wiki_comment_validate ($comment_param)
 Validate comment parameter before perform other comments actions.
 
 wiki_delete_instance ($id)
 Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.
 
 wiki_extend_navigation (navigation_node $navref, stdClass $course, stdClass $instance, cm_info $cm)
 Extends the global navigation tree by adding wiki nodes if there is a relevant content.
 
 wiki_get_extra_capabilities ()
 Returns all other caps used in wiki module.
 
 wiki_grades ($wikiid)
 Must return an array of grades for a given instance of this module, indexed by user.
 
 wiki_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types.
 
 wiki_page_view ($wiki, $page, $course, $cm, $context, $uid=null, $other=null, $subwiki=null)
 Mark the activity completed (if required) and trigger the page_viewed event.
 
 wiki_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 file serving callback
 
$CFG wiki_print_recent_activity ($course, $viewfullnames, $timestart)
 Given a course and a time, this module should find recent activity that has occurred in wiki activities and print it out.
 
 wiki_reset_course_form_definition (&$mform)
 
 wiki_reset_userdata ($data)
 Implements callback to reset course.
 
 wiki_scale_used ()
 
 wiki_scale_used_anywhere ($scaleid)
 Checks if scale is being used by any instance of wiki.
 
 wiki_search_form ($cm, $search='', $subwiki=null)
 Search for wiki.
 
 wiki_supports ($feature)
 Indicates API features that the wiki supports.
 
 wiki_update_instance ($wiki)
 Given an object containing all the necessary data, (defined by the form in mod.html) this function will update an existing instance with new data.
 
 wiki_view ($wiki, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event.
 

Detailed Description

Function Documentation

◆ mod_wiki_core_calendar_provide_event_action()

mod_wiki_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

◆ wiki_add_instance()

wiki_add_instance ( $wiki)

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

Parameters
object$instanceAn object from the form in mod.html
Return values
intThe id of the newly inserted wiki record

◆ wiki_check_updates_since()

wiki_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

◆ wiki_cm_info_dynamic()

wiki_cm_info_dynamic ( cm_info $cm)

Sets dynamic information about a course module.

This callback is called from cm_info when checking module availability (incl. $cm->uservisible)

Main viewing capability in mod_wiki is 'mod/wiki:viewpage' instead of the expected standardised 'mod/wiki:view'. The method cm_info\is_user_access_restricted_by_capability() does not work for wiki, we need to implement this callback.

Parameters
cm_info$cm

◆ wiki_comment_permissions()

wiki_comment_permissions ( $comment_param)

Running addtional permission check on plugin, for example, plugins may have switch to turn on/off comments option, this callback will affect UI display, not like pluginname_comment_validate only throw exceptions.

Capability check has been done in comment->check_permissions(), we don't need to do it again here.

Parameters
stdClass$comment_param{ context => context the context object courseid => int course id cm => stdClass course module object commentarea => string comment area itemid => int itemid }
Return values
array

◆ wiki_comment_validate()

wiki_comment_validate ( $comment_param)

Validate comment parameter before perform other comments actions.

Parameters
stdClass$comment_param{ context => context the context object courseid => int course id cm => stdClass course module object commentarea => string comment area itemid => int itemid }
Return values
boolean

◆ wiki_delete_instance()

wiki_delete_instance ( $id)

Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.

Parameters
int$idId of the module instance
Return values
booleanSuccess/Failure

◆ wiki_extend_navigation()

wiki_extend_navigation ( navigation_node $navref,
stdClass $course,
stdClass $instance,
cm_info $cm )

Extends the global navigation tree by adding wiki 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$navrefAn object representing the navigation tree node of the workshop module instance
stdClass$coursethe course object
stdClass$instancethe activity record object
cm_info$cmthe course module object

◆ wiki_get_extra_capabilities()

wiki_get_extra_capabilities ( )

Returns all other caps used in wiki module.

Return values
array

◆ wiki_grades()

wiki_grades ( $wikiid)

Must return an array of grades for a given instance of this module, indexed by user.

It also returns a maximum allowed grade.

Example: $return->grades = array of grades; $return->maxgrade = maximum allowed grade;

return $return;

Parameters
int$wikiidID of an instance of this module
Return values
mixedNull or object with an array of grades and with the maximum grade

◆ wiki_page_type_list()

wiki_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

◆ wiki_page_view()

wiki_page_view ( $wiki,
$page,
$course,
$cm,
$context,
$uid = null,
$other = null,
$subwiki = null )

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

Parameters
stdClass$wikiWiki object.
stdClass$pagePage object.
stdClass$courseCourse object.
stdClass$cmCourse module object.
stdClass$contextContext object.
int$uidOptional User ID.
array$otherOptional Other params: title, wiki ID, group ID, groupanduser, prettyview.
stdClass$subwikiOptional Subwiki.
Since
Moodle 3.1

◆ wiki_pluginfile()

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

file serving callback

Parameters
stdClass$coursecourse object
stdClass$cmcourse module object
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 the file was not found, just send the file otherwise and do not return anything

◆ wiki_print_recent_activity()

$CFG wiki_print_recent_activity ( $course,
$viewfullnames,
$timestart )

Given a course and a time, this module should find recent activity that has occurred in wiki activities and print it out.

Return true if there was output, or false is there was none.

@global $DB @uses CONTEXT_MODULE @uses VISIBLEGROUPS

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

◆ wiki_reset_userdata()

wiki_reset_userdata ( $data)

Implements callback to reset course.

Parameters
stdClass$data
Return values
boolean|array

◆ wiki_scale_used()

wiki_scale_used ( )
Deprecated
since Moodle 3.8

◆ wiki_scale_used_anywhere()

wiki_scale_used_anywhere ( $scaleid)

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

This function was added in 1.9

This is used to find out if scale used anywhere

Parameters
$scaleidint
Return values
booleanTrue if the scale is used by any wiki

◆ wiki_search_form()

wiki_search_form ( $cm,
$search = '',
$subwiki = null )

Search for wiki.

Parameters
stdClass$cmcourse module object
string$searchsearchword.
stdClass$subwikiOptional Subwiki.
Return values
Searchwiki input form

◆ wiki_supports()

wiki_supports ( $feature)

Indicates API features that the wiki supports.

@uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_COMPLETION_HAS_RULES @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES

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

◆ wiki_update_instance()

wiki_update_instance ( $wiki)

Given an object containing all the necessary data, (defined by the form in mod.html) this function will update an existing instance with new data.

Parameters
object$instanceAn object from the form in mod.html
Return values
booleanSuccess/Fail

◆ wiki_view()

wiki_view ( $wiki,
$course,
$cm,
$context )

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

Parameters
stdClass$wikiWiki object.
stdClass$courseCourse object.
stdClass$cmCourse module object.
stdClass$contextContext object.
Since
Moodle 3.1