Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

This file contains several classes uses to render the diferent pages of the wiki module

Author: Jordi Piguillem
Author: Marc Alier
Author: David Jimenez
Author: Josep Arus
Author: Daniel Serrano
Author: Kenneth Riba
Copyright: 2009 Marc Alier, Jordi Piguillem marc.alier@upc.edu
Copyright: 2009 Universitat Politecnica de Catalunya http://www.upc.edu
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 2814 lines (101 kb)
Included or required:0 times
Referenced: 12 times
Includes or requires: 1 file
 mod/wiki/create_form.php

Defines 23 classes

page_wiki:: (6 methods):
  __construct()
  print_header()
  action_bar()
  print_pagetitle()
  setup_tabs()
  print_content()

does:: (9 methods):
  set_page()
  set_title()
  set_gid()
  set_uid()
  set_url()
  create_navbar()
  print_footer()
  process_session_url()
  set_session_url()

does:: (9 methods):
  set_page()
  set_title()
  set_gid()
  set_uid()
  set_url()
  create_navbar()
  print_footer()
  process_session_url()
  set_session_url()

page_wiki_view:: (5 methods):
  print_header()
  action_bar()
  print_content()
  set_url()
  create_navbar()

page_wiki_edit:: (17 methods):
  __construct()
  print_pagetitle()
  print_header()
  print_content()
  set_url()
  set_session_url()
  process_session_url()
  set_section()
  set_versionnumber()
  set_overridelock()
  set_format()
  set_upload()
  set_attachments()
  set_deleteuploads()
  create_navbar()
  check_locks()
  print_edit()

page_wiki_comments:: (4 methods):
  print_header()
  print_content()
  set_url()
  create_navbar()

page_wiki_editcomment:: (9 methods):
  set_url()
  print_header()
  print_content()
  set_action()
  create_navbar()
  setup_tabs()
  action_bar()
  add_comment_form()
  edit_comment_form()

page_wiki_search:: (5 methods):
  create_navbar()
  set_search_string()
  set_url()
  print_header()
  print_content()

page_wiki_create:: (10 methods):
  print_header()
  set_url()
  set_format()
  set_wid()
  set_swid()
  set_availablegroups()
  set_action()
  create_navbar()
  print_content()
  create_page()

page_wiki_preview:: (7 methods):
  print_header()
  print_content()
  set_newcontent()
  set_url()
  setup_tabs()
  check_locks()
  print_preview()

page_wiki_diff:: (8 methods):
  print_header()
  print_content()
  set_url()
  set_comparison()
  create_navbar()
  setup_tabs()
  action_bar()
  print_diff_content()

page_wiki_history:: (10 methods):
  __construct()
  print_header()
  print_pagetitle()
  print_content()
  set_url()
  set_paging()
  set_allversion()
  create_navbar()
  print_history_content()
  choose_from_radio()

page_wiki_map:: (12 methods):
  print_header()
  print_content()
  set_view()
  set_url()
  create_navbar()
  print_contributions_content()
  print_navigation_content()
  print_index_content()
  print_page_list_content()
  print_orphaned_content()
  print_updated_content()
  render_navigation_node()

page_wiki_restoreversion:: (8 methods):
  print_header()
  print_content()
  set_url()
  set_versionid()
  create_navbar()
  setup_tabs()
  action_bar()
  print_restoreversion()

page_wiki_deletecomment:: (8 methods):
  print_header()
  print_content()
  set_url()
  set_action()
  create_navbar()
  setup_tabs()
  action_bar()
  printconfirmdelete()

page_wiki_save:: (5 methods):
  print_header()
  print_content()
  set_newcontent()
  set_session_url()
  print_save()

page_wiki_viewversion:: (8 methods):
  print_header()
  print_content()
  set_url()
  set_versionid()
  create_navbar()
  setup_tabs()
  action_bar()
  print_version_view()

page_wiki_confirmrestore:: (4 methods):
  set_url()
  print_header()
  print_content()
  set_versionid()

page_wiki_prettyview:: (5 methods):
  __construct()
  print_header()
  print_content()
  set_url()
  print_pretty_view()

page_wiki_handlecomments:: (6 methods):
  print_header()
  print_content()
  set_url()
  set_action()
  add_comment()
  delete_comment()

page_wiki_lock:: (5 methods):
  print_header()
  set_url()
  set_session_url()
  print_content()
  print_footer()

page_wiki_overridelocks:: (5 methods):
  print_header()
  print_content()
  set_url()
  set_session_url()
  print_overridelocks()

page_wiki_admin:: (10 methods):
  __construct()
  print_header()
  print_content()
  set_view()
  set_url()
  create_navbar()
  print_delete_content()
  add_page_delete_options()
  print_delete_version()
  choose_from_radio()


Class: page_wiki  - X-Ref

Class page_wiki contains the common code between all pages

__construct($wiki, $subwiki, $cm, ?string $activesecondarytab = null)   X-Ref
The page_wiki constructor.

param: stdClass $wiki Current wiki
param: stdClass $subwiki Current subwiki.
param: stdClass $cm Current course_module.
param: string|null $activesecondarytab Secondary navigation node to be activated on the page, if required

print_header()   X-Ref
This method prints the top of the page.


action_bar(int $pageid, moodle_url $pageurl)   X-Ref
This method returns the action bar.

param: int $pageid The page id.
param: moodle_url $pageurl The page url.
return: string The HTML for the action bar.

print_pagetitle()   X-Ref
Protected method to print current page title.


setup_tabs($options = array()   X-Ref
Setup page tabs, if options is empty, will set up active tab automatically

param: array $options, tabs options

print_content()   X-Ref
This method must be overwritten to print the page content.


Class: does  - X-Ref

set_page($page)   X-Ref
Method to set the current page

param: object $page Current page

set_title($title)   X-Ref
Method to set the current page title.
This method must be called when the current page is not created yet.

param: string $title Current page title.

set_gid($gid)   X-Ref
Method to set current group id

param: int $gid Current group id

set_uid($uid)   X-Ref
Method to set current user id

param: int $uid Current user id

set_url()   X-Ref
Method to set the URL of the page.
This method must be overwritten by every type of page.


create_navbar()   X-Ref
Protected method to create the common items of the navbar in every page type.


print_footer()   X-Ref
This method print the footer of the page.


process_session_url()   X-Ref
No description

set_session_url()   X-Ref
No description

Class: does  - X-Ref

set_page($page)   X-Ref
Method to set the current page

param: object $page Current page

set_title($title)   X-Ref
Method to set the current page title.
This method must be called when the current page is not created yet.

param: string $title Current page title.

set_gid($gid)   X-Ref
Method to set current group id

param: int $gid Current group id

set_uid($uid)   X-Ref
Method to set current user id

param: int $uid Current user id

set_url()   X-Ref
Method to set the URL of the page.
This method must be overwritten by every type of page.


create_navbar()   X-Ref
Protected method to create the common items of the navbar in every page type.


print_footer()   X-Ref
This method print the footer of the page.


process_session_url()   X-Ref
No description

set_session_url()   X-Ref
No description

Class: page_wiki_view  - X-Ref

View a wiki page

print_header()   X-Ref
No description

action_bar(int $pageid, moodle_url $pageurl)   X-Ref
This method returns the action bar.

param: int $pageid The page id.
param: moodle_url $pageurl The page url.
return: string The HTML for the action bar.

print_content()   X-Ref
No description

set_url()   X-Ref
No description

create_navbar()   X-Ref
No description

Class: page_wiki_edit  - X-Ref

Wiki page editing page

__construct($wiki, $subwiki, $cm, ?string $activesecondarytab = null)   X-Ref
The page_wiki_edit constructor.

param: stdClass $wiki Current wiki
param: stdClass $subwiki Current subwiki.
param: stdClass $cm Current course_module.
param: string|null $activesecondarytab Secondary navigation node to be activated on the page, if required

print_pagetitle()   X-Ref
No description

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

set_session_url()   X-Ref
No description

process_session_url()   X-Ref
No description

set_section($sectioncontent, $section)   X-Ref
No description

set_versionnumber($versionnumber)   X-Ref
No description

set_overridelock($override)   X-Ref
No description

set_format($format)   X-Ref
No description

set_upload($upload)   X-Ref
No description

set_attachments($attachments)   X-Ref
No description

set_deleteuploads($deleteuploads)   X-Ref
No description

create_navbar()   X-Ref
No description

check_locks()   X-Ref
No description

print_edit($content = null)   X-Ref
No description

Class: page_wiki_comments  - X-Ref

Class that models the behavior of wiki's view comments page

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

create_navbar()   X-Ref
No description

Class: page_wiki_editcomment  - X-Ref

Class that models the behavior of wiki's edit comment

set_url()   X-Ref
No description

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_action($action, $comment)   X-Ref
No description

create_navbar()   X-Ref
No description

setup_tabs($options = array()   X-Ref
No description

action_bar(int $pageid, moodle_url $pageurl)   X-Ref
This method returns the action bar.

param: int $pageid The page id.
param: moodle_url $pageurl The page url.
return: string The HTML for the action bar.

add_comment_form()   X-Ref
No description

edit_comment_form($com)   X-Ref
No description

Class: page_wiki_search  - X-Ref

Wiki page search page

create_navbar()   X-Ref
No description

set_search_string($search, $searchcontent)   X-Ref
No description

set_url()   X-Ref
No description

print_header()   X-Ref
No description

print_content()   X-Ref
No description

Class: page_wiki_create  - X-Ref

Class that models the behavior of wiki's
create page

print_header()   X-Ref
No description

set_url()   X-Ref
No description

set_format($format)   X-Ref
No description

set_wid($wid)   X-Ref
No description

set_swid($swid)   X-Ref
No description

set_availablegroups($group)   X-Ref
No description

set_action($action)   X-Ref
No description

create_navbar()   X-Ref
No description

print_content($pagetitle = '')   X-Ref
No description

create_page($pagetitle)   X-Ref
No description

Class: page_wiki_preview  - X-Ref

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_newcontent($newcontent)   X-Ref
No description

set_url()   X-Ref
No description

setup_tabs($options = array()   X-Ref
No description

check_locks()   X-Ref
No description

print_preview()   X-Ref
No description

Class: page_wiki_diff  - X-Ref

Class that models the behavior of wiki's
view differences

print_header()   X-Ref
No description

print_content()   X-Ref
Print the diff view


set_url()   X-Ref
No description

set_comparison($compare, $comparewith)   X-Ref
No description

create_navbar()   X-Ref
No description

setup_tabs($options = array()   X-Ref
No description

action_bar(int $pageid, moodle_url $pageurl)   X-Ref
This method returns the action bar.

param: int $pageid The page id.
param: moodle_url $pageurl The page url.
return: string The HTML for the action bar.

print_diff_content()   X-Ref
Given two versions of a page, prints a page displaying the differences between them.


Class: page_wiki_history  - X-Ref

Class that models the behavior of wiki's history page

__construct($wiki, $subwiki, $cm, ?string $activesecondarytab = null)   X-Ref
The page_wiki_history constructor.

param: stdClass $wiki Current wiki.
param: stdClass $subwiki Current subwiki.
param: stdClass $cm Current course_module.
param: string|null $activesecondarytab Secondary navigation node to be activated on the page, if required

print_header()   X-Ref
No description

print_pagetitle()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

set_paging($paging)   X-Ref
No description

set_allversion($allversion)   X-Ref
No description

create_navbar()   X-Ref
No description

print_history_content()   X-Ref
Prints the history for a given wiki page


choose_from_radio($options, $name, $onclick = '', $checked = '', $return = false)   X-Ref
Given an array of values, creates a group of radio buttons to be part of a form

param: array  $options  An array of value-label pairs for the radio group (values as keys).
param: string $name     Name of the radiogroup (unique in the form).
param: string $onclick  Function to be executed when the radios are clicked.
param: string $checked  The value that is already checked.
param: bool   $return   If true, return the HTML as a string, otherwise print it.
return: mixed If $return is false, returns nothing, otherwise returns a string of HTML.

Class: page_wiki_map  - X-Ref

Class that models the behavior of wiki's map page

print_header()   X-Ref


print_content()   X-Ref
No description

set_view($option)   X-Ref
No description

set_url()   X-Ref
No description

create_navbar()   X-Ref
No description

print_contributions_content()   X-Ref
Prints the contributions tab content


print_navigation_content()   X-Ref
Prints the navigation tab content


print_index_content()   X-Ref
Prints the index page tab content


print_page_list_content()   X-Ref
Prints the page list tab content


print_orphaned_content()   X-Ref
Prints the orphaned tab content


print_updated_content()   X-Ref
Prints the updated tab content


render_navigation_node($items, $attrs = array()   X-Ref
No description

Class: page_wiki_restoreversion  - X-Ref

Class that models the behavior of wiki's restore version page

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

set_versionid($versionid)   X-Ref
No description

create_navbar()   X-Ref
No description

setup_tabs($options = array()   X-Ref
No description

action_bar(int $pageid, moodle_url $pageurl)   X-Ref
This method returns the action bar.

param: int $pageid The page id.
param: moodle_url $pageurl The page url.
return: string The HTML for the action bar.

print_restoreversion()   X-Ref
Prints the restore version content

param: page $page The page whose version will be restored
param: int  $versionid The version to be restored
param: bool $confirm If false, shows a yes/no confirmation page.

Class: page_wiki_deletecomment  - X-Ref

Class that models the behavior of wiki's delete comment confirmation page

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

set_action($action, $commentid, $content)   X-Ref
No description

create_navbar()   X-Ref
No description

setup_tabs($options = array()   X-Ref
No description

action_bar(int $pageid, moodle_url $pageurl)   X-Ref
This method returns the action bar.

param: int $pageid The page id.
param: moodle_url $pageurl The page url.
return: string The HTML for the action bar.

printconfirmdelete()   X-Ref
Prints the comment deletion confirmation form


Class: page_wiki_save  - X-Ref

Class that models the behavior of wiki's
save page

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_newcontent($newcontent)   X-Ref
No description

set_session_url()   X-Ref
No description

print_save()   X-Ref
No description

Class: page_wiki_viewversion  - X-Ref

Class that models the behavior of wiki's view an old version of a page

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

set_versionid($versionid)   X-Ref
No description

create_navbar()   X-Ref
No description

setup_tabs($options = array()   X-Ref
No description

action_bar(int $pageid, moodle_url $pageurl)   X-Ref
This method returns the action bar.

param: int $pageid The page id.
param: moodle_url $pageurl The page url.
return: string The HTML for the action bar.

print_version_view()   X-Ref
Given an old page version, output the version content


Class: page_wiki_confirmrestore  - X-Ref

set_url()   X-Ref
No description

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_versionid($versionid)   X-Ref
No description

Class: page_wiki_prettyview  - X-Ref

__construct($wiki, $subwiki, $cm)   X-Ref
No description

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

print_pretty_view()   X-Ref
No description

Class: page_wiki_handlecomments  - X-Ref

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

set_action($action, $commentid, $content)   X-Ref
No description

add_comment($content, $idcomment)   X-Ref
No description

delete_comment($commentid)   X-Ref
No description

Class: page_wiki_lock  - X-Ref

print_header()   X-Ref
No description

set_url()   X-Ref
No description

set_session_url()   X-Ref
No description

print_content()   X-Ref
No description

print_footer()   X-Ref
No description

Class: page_wiki_overridelocks  - X-Ref

print_header()   X-Ref
No description

print_content()   X-Ref
No description

set_url()   X-Ref
No description

set_session_url()   X-Ref
No description

print_overridelocks()   X-Ref
No description

Class: page_wiki_admin  - X-Ref

This class will let user to delete wiki pages and page versions

__construct($wiki, $subwiki, $cm, ?string $activesecondarytab = null)   X-Ref
Constructor

param: mixed $wiki instance of wiki
param: mixed $subwiki instance of subwiki
param: stdClass $cm course module
param: string|null $activesecondarytab Secondary navigation node to be activated on the page, if required

print_header()   X-Ref
Prints header for wiki page


print_content()   X-Ref
This function will display administration view to users with managewiki capability


set_view($view, $listorphan = true)   X-Ref
Sets admin view option

param: int $view page view id
param: bool $listorphan is only valid for view 1.

set_url()   X-Ref
Sets page url


create_navbar()   X-Ref
sets navigation bar for the page


print_delete_content($showorphan = true)   X-Ref
Show wiki page delete options

param: bool $showorphan

add_page_delete_options($pages, $swid, &$table)   X-Ref
helper function for print_delete_content. This will add data to the table.

param: array $pages objects of wiki pages in subwiki
param: int $swid id of subwiki
param: object $table reference to the table in which data needs to be added

print_delete_version()   X-Ref
Prints lists of versions which can be deleted


choose_from_radio($options, $name, $onclick = '', $checked = '', $return = false)   X-Ref
Given an array of values, creates a group of radio buttons to be part of a form
helper function for print_delete_version

param: array  $options  An array of value-label pairs for the radio group (values as keys).
param: string $name     Name of the radiogroup (unique in the form).
param: string $onclick  Function to be executed when the radios are clicked.
param: string $checked  The value that is already checked.
param: bool   $return   If true, return the HTML as a string, otherwise print it.
return: mixed If $return is false, returns nothing, otherwise returns a string of HTML.