Moodle PHP Documentation 4.1
Moodle 4.1dev (Build: 20220512) (5e5e12e0)
Namespaces | Classes | Functions | Variables
mod_wiki

Namespaces

namespace  mod_wiki\analytics\indicator
  
 
namespace  mod_wiki\event
  
 
namespace  mod_wiki\output
  
 
namespace  mod_wiki\privacy
  
 
namespace  mod_wiki\search
  
 

Classes

class  backup_wiki_activity_structure_step
 Define all the backup steps that will be used by the backup_wiki_activity_task. More...
 
class  backup_wiki_activity_task
 Provides all the settings and steps to perform one complete backup of the activity. More...
 
class  creole_parser
 
class  generic_parser
 
class  html_parser
 
class  mod_wiki\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_wiki\analytics\indicator\cognitive_depth
 Cognitive depth indicator - wiki. More...
 
class  mod_wiki\analytics\indicator\social_breadth
 Social breadth indicator - wiki. More...
 
class  mod_wiki\event\comment_created
 The mod_wiki comment created event class. More...
 
class  mod_wiki\event\comment_deleted
 The mod_wiki comment deleted event class. More...
 
class  mod_wiki\event\comments_viewed
 The mod_wiki comments viewed event class. More...
 
class  mod_wiki\event\course_module_instance_list_viewed
 The mod_wiki instance list viewed event class. More...
 
class  mod_wiki\event\course_module_viewed
 The mod_wiki course module viewed event class. More...
 
class  mod_wiki\event\page_created
 The mod_wiki page created event class. More...
 
class  mod_wiki\event\page_deleted
 
class  mod_wiki\event\page_diff_viewed
 
class  mod_wiki\event\page_history_viewed
 The mod_wiki history viewed event class. More...
 
class  mod_wiki\event\page_locks_deleted
 
class  mod_wiki\event\page_map_viewed
 
class  mod_wiki\event\page_updated
 
class  mod_wiki\event\page_version_deleted
 
class  mod_wiki\event\page_version_restored
 
class  mod_wiki\event\page_version_viewed
 
class  mod_wiki\event\page_viewed
 
class  mod_wiki\output\action_bar
 
class  mod_wiki\privacy\provider
 Data provider class. More...
 
class  mod_wiki\search\activity
 Search area for mod_wiki activities. More...
 
class  mod_wiki\search\collaborative_page
 Search area for mod_wiki collaborative pages. More...
 
class  mod_wiki_create_form
 
class  mod_wiki_edit_form
 
class  mod_wiki_external
 
class  mod_wiki_filesedit_form
 
class  mod_wiki_generator
 
class  mod_wiki_mod_form
 
class  mod_wiki_renderer
 
class  moodle1_mod_wiki_handler
 Wiki conversion handler. More...
 
class  MoodleQuickForm_wikieditor
 
class  MoodleQuickForm_wikifiletable
 
class  nwiki_parser
 
class  page_wiki
 Class page_wiki contains the common code between all pages. More...
 
class  page_wiki_admin
 This class will let user to delete wiki pages and page versions. More...
 
class  page_wiki_comments
 Class that models the behavior of wiki's view comments page. More...
 
class  page_wiki_confirmrestore
 
class  page_wiki_create
 Class that models the behavior of wiki's create page. More...
 
class  page_wiki_deletecomment
 Class that models the behavior of wiki's delete comment confirmation page. More...
 
class  page_wiki_diff
 Class that models the behavior of wiki's view differences. More...
 
class  page_wiki_edit
 Wiki page editing page. More...
 
class  page_wiki_editcomment
 Class that models the behavior of wiki's edit comment. More...
 
class  page_wiki_handlecomments
 
class  page_wiki_history
 Class that models the behavior of wiki's history page. More...
 
class  page_wiki_lock
 
class  page_wiki_map
 Class that models the behavior of wiki's map page. More...
 
class  page_wiki_overridelocks
 
class  page_wiki_prettyview
 
class  page_wiki_preview
 
class  page_wiki_restoreversion
 Class that models the behavior of wiki's restore version page. More...
 
class  page_wiki_save
 Class that models the behavior of wiki's save page. More...
 
class  page_wiki_search
 Wiki page search page. More...
 
class  page_wiki_view
 View a wiki page. More...
 
class  page_wiki_viewversion
 Class that models the behavior of wiki's view an old version of a page. More...
 
class  parser_utils
 
class  restore_wiki_activity_structure_step
 Define all the restore steps that will be used by the restore_wiki_activity_task. More...
 
class  restore_wiki_activity_task
 wiki restore task that provides all the settings and steps to perform one complete restore of the activity More...
 
class  wiki_files_tree
 
class  wiki_parser_proxy
 Generic parser implementation. More...
 

Functions

 after_parsing ()
 
 before_parsing ()
 Before and after parsing...
 
 format_image ($src, $alt, $caption="", $align='left')
 
 format_link ($text)
 Format links.
 
 generate_header ($text, $level)
 Header generation.
 
 generate_list ($listitems)
 List generation function from an array of array(level, text)
 
 generate_table ($table)
 Table generation functions.
 
 get_repeated_sections (&$text, $repeated=array())
 
 get_repeated_sections_callback ($match)
 
 get_section ($header, $text, $clean=false)
 Section editing.
 
 line_break_block_rule ($match)
 Generic block rules.
 
 link ($link, $anchor="")
 Link internal callback.
 
 list_block_rule ($match)
 
 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. More...
 
 mod_wiki_get_fontawesome_icon_map ()
 Get icon mapping for font-awesome.
 
 mod_wiki_get_tagged_pages ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=1, $page=0)
 Returns wiki pages tagged with a specified tag. More...
 
 nowiki_block_rule ($match)
 
 nowiki_tag_rule ($match)
 Generic tag rules.
 
 process_toc ()
 Table of contents processing after parsing.
 
 real_path ($url)
 
 set_options ($options)
 Set options.
 
 wiki_add_comment ($context, $pageid, $content, $editor)
 Add comments ro database. More...
 
 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. More...
 
 wiki_add_progress ($pageid, $oldversionid, $versionid, $progress)
 
 wiki_add_subwiki ($wikiid, $groupid, $userid=0)
 Add a new sub wiki instance. More...
 
 wiki_build_tree ($page, $node, &$keys)
 Generate wiki's page tree. More...
 
 wiki_can_create_pages ($context, $user=null)
 Check if the user can create pages in a certain wiki. More...
 
 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. More...
 
 wiki_cm_info_dynamic (cm_info $cm)
 Sets dynamic information about a course module. More...
 
 wiki_comment_permissions ($comment_param)
 
 wiki_comment_validate ($comment_param)
 
 wiki_count_wiki_page_versions ($pageid)
 Count the number of page version. More...
 
 wiki_create_page ($swid, $title, $format, $userid)
 Create a new wiki page, if the page exists, return existing pageid. More...
 
 wiki_delete_comment ($idcomment, $context, $pageid)
 Delete comments from database. More...
 
 wiki_delete_comments_wiki ()
 Delete al comments from wiki.
 
 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. More...
 
mixed wiki_delete_links ($linkid=null, $topageid=null, $frompageid=null, $subwikiid=null)
 Deletes wiki_links. More...
 
 wiki_delete_locks ($pageid, $userid=null, $section=null, $delete_from_db=true, $delete_section_and_page=false)
 Deletes wiki_locks that are not in use. More...
 
 wiki_delete_old_locks ()
 Deletes wiki_locks that expired 1 hour ago.
 
 wiki_delete_page_versions ($deleteversions, $context=null)
 Delete specificed versions of a page or versions created by users if version is 0 then it will remove all versions of the page. More...
 
 wiki_delete_pages ($context, $pageids=null, $subwikiid=null)
 Delete pages and all related data. More...
 
 wiki_delete_synonym ($subwikiid, $pageid=null)
 Delete wiki synonyms related to subwikiid or page. More...
 
 wiki_extend_navigation (navigation_node $navref, $course, $module, $cm)
 
 wiki_get_comment ($commentid)
 
 wiki_get_comments ($contextid, $pageid)
 Returns all comments by context and pageid. More...
 
 wiki_get_contributions ($swid, $userid)
 Get pages which user have been edited. More...
 
 wiki_get_current_version ($pageid)
 Get latest version of wiki page. More...
 
 wiki_get_extra_capabilities ()
 Returns all other caps used in wiki module. More...
 
 wiki_get_first_page ($subwikid, $module=null)
 Get first page of wiki instace. More...
 
 wiki_get_formats ()
 Text format supported by wiki module.
 
 wiki_get_last_version ($pageid)
 Alias of wiki_get_current_version @TODO, does the exactly same thing as wiki_get_current_version, should be removed. More...
 
 wiki_get_linked_from_pages ($pageid)
 Get linked from page. More...
 
 wiki_get_linked_pages ($pageid)
 Get linked pages from page. More...
 
 wiki_get_linked_to_pages ($pageid)
 Get linked from page. More...
 
 wiki_get_missing_or_empty_pages ($swid)
 Get missing or empty pages in wiki. More...
 
object wiki_get_orphaned_pages ($swid)
 Return a list of orphaned wikis for one specific subwiki. More...
 
 wiki_get_page ($pageid)
 Get a wiki page by pageid. More...
 
 wiki_get_page_by_title ($swid, $title)
 Get a wiki page by page title. More...
 
 wiki_get_page_list ($swid, $sort='title ASC')
 Get pages list in wiki. More...
 
 wiki_get_possible_subwiki_by_group ($wikiid, $groupid, $userid=0)
 Get a sub wiki instance by wiki id, group id and user id. More...
 
 wiki_get_section_page ($page, $section)
 Get page section. More...
 
 wiki_get_subwiki ($subwikiid)
 Get a sub wiki instace by instance id. More...
 
 wiki_get_subwiki_by_group ($wikiid, $groupid, $userid=0)
 Get a sub wiki instance by wiki id and group id. More...
 
 wiki_get_subwiki_by_group_and_user_with_validation ($wiki, $groupid, $userid)
 Utility function for getting a subwiki by group and user, validating that the user can view it. More...
 
 wiki_get_subwikis ($wikiid)
 Get sub wiki instances with same wiki id. More...
 
 wiki_get_updated_pages_by_subwiki ($swid)
 Get updated pages from wiki. More...
 
 wiki_get_user_info ($userid)
 Get user data.
 
 wiki_get_version ($versionid)
 Get a version record by record id. More...
 
 wiki_get_visible_subwikis ($wiki, $cm=null, $context=null)
 Get all the possible subwikis visible to the user in a wiki. More...
 
 wiki_get_wiki ($wikiid)
 Get a wiki instance. More...
 
 wiki_get_wiki_from_pageid ($pageid)
 Get a wiki instance by pageid. More...
 
 wiki_get_wiki_page_id ($pageid, $id)
 
 wiki_get_wiki_page_version ($pageid, $version)
 Get a specific version of page. More...
 
 wiki_get_wiki_page_versions ($pageid, $limitfrom, $limitnum)
 Get version list. More...
 
 wiki_grades ($wikiid)
 Must return an array of grades for a given instance of this module, indexed by user. More...
 
 wiki_increment_pageviews ($page)
 Increase page view nubmer. More...
 
 wiki_is_page_section_locked ($pageid, $userid, $section=null)
 Checks if a page-section is locked. More...
 
 wiki_make_cache_expire ($pagename)
 
 wiki_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types. More...
 
 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. More...
 
 wiki_parse_content ($markup, $pagecontent, $options=array())
 Parses a string with the wiki markup language in $markup. More...
 
 wiki_parser_get_token ($markup, $name)
 Returns the token used by a wiki language to represent a given tag or "object" (bold -> **) More...
 
 wiki_parser_link ($link, $options=null)
 This function is the parser callback to parse wiki links. More...
 
 wiki_parser_real_path ($url, $context, $component, $filearea, $swid)
 Returns an absolute path link, unless there is no such link. More...
 
 wiki_parser_table ($table)
 Returns the table fully parsed (HTML) More...
 
 wiki_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 
 wiki_print_edit_form_default_fields ($format, $pageid, $version=-1, $upload=false, $deleteuploads=array())
 Prints default edit form fields and buttons. More...
 
 wiki_print_page_content ($page, $context, $subwikiid)
 
$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. More...
 
 wiki_print_upload_table ($context, $filearea, $fileitemid, $deleteuploads=array())
 Prints a table with the files attached to a wiki page. More...
 
 wiki_refresh_cachedcontent ($page, $newcontent=null)
 
 wiki_refresh_page_links ($page, $links)
 
 wiki_reset_course_form_definition (&$mform)
 
 wiki_reset_userdata ($data)
 Implements callback to reset course. More...
 
 wiki_restore_page ($wikipage, $version, $context)
 Restore a page with specified version. More...
 
 wiki_save_page ($wikipage, $newcontent, $userid)
 Save page content. More...
 
 wiki_save_section ($wikipage, $sectiontitle, $sectioncontent, $userid)
 
 wiki_scale_used ()
 
 wiki_scale_used_anywhere ($scaleid)
 Checks if scale is being used by any instance of wiki. More...
 
 wiki_search_all ($swid, $search)
 Search wiki title and content. More...
 
 wiki_search_content ($swid, $search)
 Search wiki content. More...
 
 wiki_search_form ($cm, $search='', $subwiki=null)
 Search for wiki. More...
 
 wiki_search_title ($swid, $search)
 Search wiki title. More...
 
 wiki_set_lock ($pageid, $userid, $section=null, $insert=false)
 Inserts or updates a wiki_locks record.
 
 wiki_supports ($feature)
 Indicates API features that the wiki supports. More...
 
 wiki_trim_string ($text, $limit=25)
 This function trims any given text and returns it with some dots at the end. More...
 
 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. More...
 
 wiki_user_can_edit ($subwiki)
 Checks if current user can edit a subwiki. More...
 
 wiki_user_can_view ($subwiki, $wiki=null)
 Checks if current user can view a subwiki. More...
 
 wiki_view ($wiki, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event. More...
 
 xmldb_wiki_upgrade ($oldversion)
 

Variables

 $capabilities
 
*author Jordi Piguillem *author Kenneth Riba **license $comesfrom = 'editorview'
 
*author Jordi Piguillem *author Kenneth Riba **license $content
 
*author Jordi Piguillem *author Kenneth Riba **license $deleteuploads = array()
 
*author Jordi Piguillem *author Kenneth Riba **license $editor
 
 $functions
 
 $maxheaderdepth = 3
 
 $plugin = 2022041200
 
 $printable = false
 
 $repeated_sections
 
*author Jordi Piguillem *author Kenneth Riba **license $section = null
 
 $section_editing = true
 
 $tagareas
 
 $toc = array()
 
*author Jordi Piguillem *author Kenneth Riba **license $upload = false
 
*author Jordi Piguillem *author Kenneth Riba **license $version = -1
 
 $wiki_page_id
 
$plugin component = 'mod_wiki'
 
const EQUAL '='
 
const FORMAT_CREOLE '37'
 
const FORMAT_NWIKI '38'
 
*author Jordi Piguillem *author Kenneth Riba **license http
 
**author Josep Arús **license http
 
**author Josep Arús **license http
 
**author Josep Arús **license http
 
**author Josep Arús **license http
 
**author Josep Arús **license http
 
 if (!defined( 'MOODLE_INTERNAL'))
 
 if (!defined( 'MOODLE_INTERNAL'))
 
const IMPROVEMENT '+'
 
const LOCK_TIMEOUT 30
 
const NO_VALID_RATE '-999'
 
$plugin version = 2022041900
 
const WIKI_REFRESH_CACHE_TIME 30
 
const WORST '-'
 

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

◆ mod_wiki_get_tagged_pages()

mod_wiki_get_tagged_pages (   $tag,
  $exclusivemode = false,
  $fromctx = 0,
  $ctx = 0,
  $rec = 1,
  $page = 0 
)

Returns wiki pages tagged with a specified tag.

This is a callback used by the tag area mod_wiki/wiki_pages to search for wiki pages tagged with a specific tag.

Parameters
core_tag_tag$tag
bool$exclusivemodeif set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger
int$fromctxcontext id where the link was displayed, may be used by callbacks to display items in the same context first
int$ctxcontext id where to search for records
bool$recsearch in subcontexts as well
int$page0-based number of page being displayed
Return values
core_tag::output::tagindex

◆ wiki_add_comment()

wiki_add_comment (   $context,
  $pageid,
  $content,
  $editor 
)

Add comments ro database.

Parameters
object$context,.Current context
int$pageid,.Current pageid
string$content,.Content of the comment
stringeditor. Version of editor we are using.

◆ 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_add_subwiki()

wiki_add_subwiki (   $wikiid,
  $groupid,
  $userid = 0 
)

Add a new sub wiki instance.

Parameters
int$wikiid
int$groupid
Return values
int::$insertid

◆ wiki_build_tree()

wiki_build_tree (   $page,
  $node,
$keys 
)

Generate wiki's page tree.

Parameters
page_wiki$page,.A wiki page object
navigation_node$node,.Starting navigation_node
array$keys,.An array to store keys
Return values
anarray with all tree nodes

◆ wiki_can_create_pages()

wiki_can_create_pages (   $context,
  $user = null 
)

Check if the user can create pages in a certain wiki.

Parameters
context$contextWiki's context.
integer | stdClass$userA user id or object. By default (null) checks the permissions of the current user.
Return values
boolTrue if user can create pages, false otherwise.
Since
Moodle 3.1

◆ 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_count_wiki_page_versions()

wiki_count_wiki_page_versions (   $pageid)

Count the number of page version.

Parameters
int$pageid

◆ wiki_create_page()

wiki_create_page (   $swid,
  $title,
  $format,
  $userid 
)

Create a new wiki page, if the page exists, return existing pageid.

Parameters
int$swid
string$title
string$format
int$userid

◆ wiki_delete_comment()

wiki_delete_comment (   $idcomment,
  $context,
  $pageid 
)

Delete comments from database.

Parameters
$idcomment.Id of comment which will be deleted
$context.Current context
$pageid.Current pageid

◆ 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_delete_links()

mixed wiki_delete_links (   $linkid = null,
  $topageid = null,
  $frompageid = null,
  $subwikiid = null 
)

Deletes wiki_links.

It can be sepecific link or links attached in subwiki

$DB database object

Parameters
int$linkidid of the link to be deleted
int$topageidlinks to the specific page
int$frompageidlinks from specific page
int$subwikiidlinks to subwiki

◆ wiki_delete_locks()

wiki_delete_locks (   $pageid,
  $userid = null,
  $section = null,
  $delete_from_db = true,
  $delete_section_and_page = false 
)

Deletes wiki_locks that are not in use.

(F.Ex. after submitting the changes). If no userid is present, it deletes ALL the wiki_locks of a specific page.

Parameters
int$pageidpage id.
int$useridid of user for which lock is deleted.
string$sectionsection to be deleted.
bool$delete_from_dbdeleted from db.
bool$delete_section_and_pagedelete section and page version.

◆ wiki_delete_page_versions()

wiki_delete_page_versions (   $deleteversions,
  $context = null 
)

Delete specificed versions of a page or versions created by users if version is 0 then it will remove all versions of the page.

Parameters
array$deleteversionsdelete versions for a page
context_module$contextmodule context

◆ wiki_delete_pages()

wiki_delete_pages (   $context,
  $pageids = null,
  $subwikiid = null 
)

Delete pages and all related data.

Parameters
mixed$contextcontext in which page needs to be deleted.
mixed$pageidsid's of pages to be deleted
int$subwikiidid of the subwiki for which all pages should be deleted

◆ wiki_delete_synonym()

wiki_delete_synonym (   $subwikiid,
  $pageid = null 
)

Delete wiki synonyms related to subwikiid or page.

Parameters
int$subwikiidid of sunbwiki
int$pageidid of page

◆ wiki_get_comments()

wiki_get_comments (   $contextid,
  $pageid 
)

Returns all comments by context and pageid.

Parameters
int$contextidCurrent context id
int$pageidCurrent pageid

◆ wiki_get_contributions()

wiki_get_contributions (   $swid,
  $userid 
)

Get pages which user have been edited.

Parameters
int$swid
int$userid

◆ wiki_get_current_version()

wiki_get_current_version (   $pageid)

Get latest version of wiki page.

Parameters
int$pageid
Return values
object

◆ wiki_get_extra_capabilities()

wiki_get_extra_capabilities ( )

Returns all other caps used in wiki module.

Return values
array

◆ wiki_get_first_page()

wiki_get_first_page (   $subwikid,
  $module = null 
)

Get first page of wiki instace.

Parameters
int$subwikiid
int$module,wikiinstance object

◆ wiki_get_last_version()

wiki_get_last_version (   $pageid)

Alias of wiki_get_current_version @TODO, does the exactly same thing as wiki_get_current_version, should be removed.

Parameters
int$pageid
Return values
object

◆ wiki_get_linked_from_pages()

wiki_get_linked_from_pages (   $pageid)

Get linked from page.

Parameters
int$pageid

◆ wiki_get_linked_pages()

wiki_get_linked_pages (   $pageid)

Get linked pages from page.

Parameters
int$pageid

◆ wiki_get_linked_to_pages()

wiki_get_linked_to_pages (   $pageid)

Get linked from page.

Parameters
int$pageid

◆ wiki_get_missing_or_empty_pages()

wiki_get_missing_or_empty_pages (   $swid)

Get missing or empty pages in wiki.

Parameters
int$swidsub wiki id

◆ wiki_get_orphaned_pages()

object wiki_get_orphaned_pages (   $swid)

Return a list of orphaned wikis for one specific subwiki.

Parameters
int$swidsub wiki id

◆ wiki_get_page()

wiki_get_page (   $pageid)

Get a wiki page by pageid.

Parameters
int$pageid
Return values
object

◆ wiki_get_page_by_title()

wiki_get_page_by_title (   $swid,
  $title 
)

Get a wiki page by page title.

Parameters
int$swid,subwiki id
string$title
Return values
object

◆ wiki_get_page_list()

wiki_get_page_list (   $swid,
  $sort = 'title ASC' 
)

Get pages list in wiki.

Parameters
int$swidsub wiki id
string$sortHow to sort the pages. By default, title ASC.

◆ wiki_get_possible_subwiki_by_group()

wiki_get_possible_subwiki_by_group (   $wikiid,
  $groupid,
  $userid = 0 
)

Get a sub wiki instance by wiki id, group id and user id.

If the wiki doesn't exist in DB it will return an isntance with id -1.

Parameters
int$wikiidWiki ID.
int$groupidGroup ID.
int$useridUser ID.
Return values
objectSubwiki instance.
Since
Moodle 3.1

◆ wiki_get_section_page()

wiki_get_section_page (   $page,
  $section 
)

Get page section.

Parameters
int$pageid
string$section

◆ wiki_get_subwiki()

wiki_get_subwiki (   $subwikiid)

Get a sub wiki instace by instance id.

Parameters
int$subwikiid
Return values
object

◆ wiki_get_subwiki_by_group()

wiki_get_subwiki_by_group (   $wikiid,
  $groupid,
  $userid = 0 
)

Get a sub wiki instance by wiki id and group id.

Parameters
int$wikiid
int$groupid
Return values
object

◆ wiki_get_subwiki_by_group_and_user_with_validation()

wiki_get_subwiki_by_group_and_user_with_validation (   $wiki,
  $groupid,
  $userid 
)

Utility function for getting a subwiki by group and user, validating that the user can view it.

If the subwiki doesn't exists in DB yet it'll have id -1.

Parameters
stdClass$wikiThe wiki.
int$groupidGroup ID. 0 means the subwiki doesn't use groups.
int$useridUser ID. 0 means the subwiki doesn't use users.
Return values
stdClassSubwiki. If it doesn't exists in DB yet it'll have id -1. If the user can't view the subwiki this function will return false.
Since
Moodle 3.1
Exceptions
moodle_exception

◆ wiki_get_subwikis()

wiki_get_subwikis (   $wikiid)

Get sub wiki instances with same wiki id.

Parameters
int$wikiid

◆ wiki_get_updated_pages_by_subwiki()

wiki_get_updated_pages_by_subwiki (   $swid)

Get updated pages from wiki.

Parameters
int$pageid

◆ wiki_get_version()

wiki_get_version (   $versionid)

Get a version record by record id.

Parameters
int$versionid,theversion id
Return values
object

◆ wiki_get_visible_subwikis()

wiki_get_visible_subwikis (   $wiki,
  $cm = null,
  $context = null 
)

Get all the possible subwikis visible to the user in a wiki.

It will return all the subwikis that can be created in a wiki, even if they don't exist in DB yet.

Parameters
stdClass$wikiWiki to get the subwikis from.
cm_info | stdClass$cmOptional. The course module object.
context_module$contextOptional. Context of wiki module.
Return values
arrayList of subwikis.
Since
Moodle 3.1

◆ wiki_get_wiki()

wiki_get_wiki (   $wikiid)

Get a wiki instance.

Parameters
int$wikiidthe instance id of wiki

◆ wiki_get_wiki_from_pageid()

wiki_get_wiki_from_pageid (   $pageid)

Get a wiki instance by pageid.

Parameters
int$pageid
Return values
object

◆ wiki_get_wiki_page_version()

wiki_get_wiki_page_version (   $pageid,
  $version 
)

Get a specific version of page.

Parameters
int$pageid
int$version

◆ wiki_get_wiki_page_versions()

wiki_get_wiki_page_versions (   $pageid,
  $limitfrom,
  $limitnum 
)

Get version list.

Parameters
int$pageid
int$limitfrom
int$limitnum

◆ 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_increment_pageviews()

wiki_increment_pageviews (   $page)

Increase page view nubmer.

Parameters
int$page,databaserecord

◆ wiki_is_page_section_locked()

wiki_is_page_section_locked (   $pageid,
  $userid,
  $section = null 
)

Checks if a page-section is locked.

Return values
trueif the combination of section and page is locked, FALSE otherwise.

◆ 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_parse_content()

wiki_parse_content (   $markup,
  $pagecontent,
  $options = array() 
)

Parses a string with the wiki markup language in $markup.

Return values
Arrayor false when something wrong has happened.

Returned array contains the following fields: 'parsed_text' => String. Contains the parsed wiki content. 'unparsed_text' => String. Constains the original wiki content. 'link_count' => Array of array('destination' => ..., 'new' => "is new?"). Contains the internal wiki links found in the wiki content. 'deleted_sections' => the list of deleted sections. '' =>

Author
Josep Arús Pous

◆ wiki_parser_get_token()

wiki_parser_get_token (   $markup,
  $name 
)

Returns the token used by a wiki language to represent a given tag or "object" (bold -> **)

Return values
Astring when it has only one token at the beginning (f. ex. lists). An array composed by 2 strings when it has 2 tokens, one at the beginning and one at the end (f. ex. italics). Returns false otherwise.
Author
Josep Arús Pous

◆ wiki_parser_link()

wiki_parser_link (   $link,
  $options = null 
)

This function is the parser callback to parse wiki links.

It returns the necesary information to print a link.

NOTE: Empty pages and non-existent pages must be print in red color.

!!!!!! IMPORTANT !!!!!! It is critical that you call format_string on the content before it is used.

Parameters
string | page_wiki$linkname of a page
array$options
Return values
arrayArray('content' => string, 'url' => string, 'new' => bool, 'link_info' => array)

@TODO Doc return and options

◆ wiki_parser_real_path()

wiki_parser_real_path (   $url,
  $context,
  $component,
  $filearea,
  $swid 
)

Returns an absolute path link, unless there is no such link.

Parameters
string$urlLink's URL or filename
stdClass$contextfilearea params
string$componentThe component the file is associated with
string$fileareaThe filearea the file is stored in
int$swidSub wiki id
Return values
stringURL for files full path

◆ wiki_parser_table()

wiki_parser_table (   $table)

Returns the table fully parsed (HTML)

Return values
HTMLfor the table $table
Author
Josep Arús Pous

◆ wiki_print_edit_form_default_fields()

wiki_print_edit_form_default_fields (   $format,
  $pageid,
  $version = -1,
  $upload = false,
  $deleteuploads = array() 
)

Prints default edit form fields and buttons.

Parameters
string$formatEdit form format (html, creole...)
integer$versionVersion number. A negative number means no versioning.

◆ 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_print_upload_table()

wiki_print_upload_table (   $context,
  $filearea,
  $fileitemid,
  $deleteuploads = array() 
)

Prints a table with the files attached to a wiki page.

Parameters
object$context
string$filearea
int$fileitemid
arraydeleteuploads

◆ wiki_reset_userdata()

wiki_reset_userdata (   $data)

Implements callback to reset course.

Parameters
stdClass$data
Return values
boolean|array

◆ wiki_restore_page()

wiki_restore_page (   $wikipage,
  $version,
  $context 
)

Restore a page with specified version.

Parameters
stdClass$wikipagewiki page record
stdClass$versionwiki page version to restore
context_module$contextcontext of wiki module
Return values
stdClassrestored page

◆ wiki_save_page()

wiki_save_page (   $wikipage,
  $newcontent,
  $userid 
)

Save page content.

Parameters
object$wikipage
string$newcontent
int$userid

◆ 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_all()

wiki_search_all (   $swid,
  $search 
)

Search wiki title and content.

Parameters
int$swidsub wiki id
string$search

◆ wiki_search_content()

wiki_search_content (   $swid,
  $search 
)

Search wiki content.

Parameters
int$swidsub wiki id
string$search

◆ 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_search_title()

wiki_search_title (   $swid,
  $search 
)

Search wiki title.

Parameters
int$swidsub wiki id
string$search

◆ 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_trim_string()

wiki_trim_string (   $text,
  $limit = 25 
)

This function trims any given text and returns it with some dots at the end.

Parameters
string$text
string$limit
Return values
string

◆ 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_user_can_edit()

wiki_user_can_edit (   $subwiki)

Checks if current user can edit a subwiki.

Parameters
$subwiki

◆ wiki_user_can_view()

wiki_user_can_view (   $subwiki,
  $wiki = null 
)

Checks if current user can view a subwiki.

Parameters
stdClass$subwikiusually record from {wiki_subwikis}. Must contain fields 'wikiid', 'groupid', 'userid'. If it also contains fields 'course' and 'groupmode' from table {wiki} it will save extra DB query.
stdClass$wikioptional wiki object if known
Return values
bool

◆ 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

Variable Documentation

◆ $tagareas

$tagareas
Initial value:
= array(
array(
'itemtype' => 'wiki_pages',
'component' => 'mod_wiki',
'callback' => 'mod_wiki_get_tagged_pages',
'callbackfile' => '/mod/wiki/locallib.php',
),
)