WikiElement
extends Element
in package
implements
CrawlConstants
Element responsible for drawing wiki pages in group view It is also responsible for rendering wiki history pages, and listings of wiki pages available for a group
Tags
Interfaces, Classes, Traits and Enums
- CrawlConstants
- Shared constants and enums used by components that are involved in the crawling process
Table of Contents
- $view : object
- The View on which this Element is drawn
- __construct() : mixed
- constructor stores a reference to the view this element will reside on
- dynamicSubstitutions() : string
- The controller used to display a wiki page might vary (could be group or static). Links within a wiki page need to be updated to reflect which controller is being used. This method does the update.
- formatHref() : string
- Used to slightly clean up hypertext links before drawing them (get rid of empty queries, avoid double encoding)
- render() : mixed
- Draw a wiki page for group, or, depending on $data['MODE'] a listing of all pages for a group, or the history of revisions of a given page or the edit page form
- renderEditPageForm() : mixed
- Used to drawn the form that let's someone edit a wiki page
- renderHistory() : mixed
- Used to draw the revision history page for a wiki document Has a form that can be used to draw the diff of two revisions
- renderPages() : mixed
- Used to draw a list of Wiki Pages for the current group. It also draws a search form and can be used to create pages
- renderPath() : mixed
- Used to render the dropdown that lists paths within media lists folders, recent wiki pages, and groups a user has been to
- renderReadPage() : mixed
- Used to draw a Wiki Page for reading. If the page does not exist various create/login-to-create etc messages are displayed depending of it the user is logged in. and has write permissions on the group
- renderRelationships() : mixed
- Used to draw the page which displays all wiki pages that link a wiki page with a particular relationship type
- renderResource() : mixed
- Renders a single resource description from the list of resources for a given wiki page
- renderResources() : mixed
- Draws a list of media resources associated with a wiki page
- renderShareWall() : mixed
- renderSourcePage() : mixed
- Used to drawn the form that let's someone see the source of a wiki page
Properties
$view
The View on which this Element is drawn
public
object
$view
Methods
__construct()
constructor stores a reference to the view this element will reside on
public
__construct([object $view = null ]) : mixed
Parameters
- $view : object = null
-
object this element will reside on
Return values
mixed —dynamicSubstitutions()
The controller used to display a wiki page might vary (could be group or static). Links within a wiki page need to be updated to reflect which controller is being used. This method does the update.
public
dynamicSubstitutions(int $group_id, array<string|int, mixed> $data, string $pre_page) : string
Parameters
- $group_id : int
-
id of wiki page the passed page belongs to
- $data : array<string|int, mixed>
-
fields etc which will be sent to the view
- $pre_page : string
-
a wiki page where links,etc have not yet had dynamic substitutions applied
Return values
string —page after subustitutions
formatHref()
Used to slightly clean up hypertext links before drawing them (get rid of empty queries, avoid double encoding)
public
formatHref(string $url) : string
Parameters
- $url : string
-
to clean up
Return values
string —cleaned url
render()
Draw a wiki page for group, or, depending on $data['MODE'] a listing of all pages for a group, or the history of revisions of a given page or the edit page form
public
render(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields contain data about the page being displayed or edited, or the list of pages being displayed.
Return values
mixed —renderEditPageForm()
Used to drawn the form that let's someone edit a wiki page
public
renderEditPageForm(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields contain data about the page being edited. In particular, PAGE contains the raw page data
Return values
mixed —renderHistory()
Used to draw the revision history page for a wiki document Has a form that can be used to draw the diff of two revisions
public
renderHistory(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields contain info about revisions of a Wiki page
Return values
mixed —renderPages()
Used to draw a list of Wiki Pages for the current group. It also draws a search form and can be used to create pages
public
renderPages(array<string|int, mixed> $data, bool $can_edit, bool $logged_in) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields for the current controller, CSRF_TOKEN etc needed to render the search for and paging queries
- $can_edit : bool
-
whether the current user has permissions to edit or create this page
- $logged_in : bool
-
whether current user is logged in or not
Return values
mixed —renderPath()
Used to render the dropdown that lists paths within media lists folders, recent wiki pages, and groups a user has been to
public
renderPath(string $dropdown_id, array<string|int, mixed> $data, array<string|int, mixed> $options[, string $selected_url = "" ][, string $top_name = "" ][, string $render_type = "paths" ][, bool $as_list = false ][, string $class_list = "" ]) : mixed
Parameters
- $dropdown_id : string
-
element id of select tag to be used for dropdown
- $data : array<string|int, mixed>
-
set up in controller and SocialComponent with data fields view and this element are supposed to render
- $options : array<string|int, mixed>
-
if nonempty, then this should be items, key-values in the form (url => label), to list first in dropdown
- $selected_url : string = ""
-
url which is selected by default in dropdown.
- $top_name : string = ""
-
name of root media list folder (defaults to something like "Root Folder" in the language of current locale)
- $render_type : string = "paths"
-
can be: "paths" if just listing folder path in wiki page resource folder, "just_groups_and_pages" if want a list of recent groups and wiki pages viewed, or "all" if want both
- $as_list : bool = false
-
whether to output the result as a dropdown or as an unordered list.
- $class_list : string = ""
-
list of css classes to add to top div in what is rendered
Return values
mixed —renderReadPage()
Used to draw a Wiki Page for reading. If the page does not exist various create/login-to-create etc messages are displayed depending of it the user is logged in. and has write permissions on the group
public
renderReadPage(array<string|int, mixed> $data, bool $can_edit, bool $logged_in) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields PAGE used for page contents
- $can_edit : bool
-
whether the current user has permissions to edit or create this page
- $logged_in : bool
-
whether current user is logged in or not
Return values
mixed —renderRelationships()
Used to draw the page which displays all wiki pages that link a wiki page with a particular relationship type
public
renderRelationships(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields contain info about all such wiki pages
Return values
mixed —renderResource()
Renders a single resource description from the list of resources for a given wiki page
public
renderResource(int $i, bool &$is_first, array<string|int, mixed> $resource, string $base_url, string $token_string, string $url_prefix, string $url_is_folder_prefix, string $folder_prefix, array<string|int, mixed> &$seen_resources, string $read_mode, bool $logged_in, array<string|int, mixed> $data) : mixed
Parameters
- $i : int
-
index in list of resources the current resource is (used when writing out element id's of tags to make unique)
- $is_first : bool
-
is this the first resource to be drawn
- $resource : array<string|int, mixed>
-
assiative array of information about the resource to be rendered
- $base_url : string
- $token_string : string
-
token_name=CRSF_TOKEN string for URL to stay logged in
- $url_prefix : string
- $url_is_folder_prefix : string
- $folder_prefix : string
- $seen_resources : array<string|int, mixed>
- $read_mode : string
-
whether the readering should be for a media list in read mode (valye "read"), a source mode (value "source"), or for use on the edit task of any wiki page (value "")
- $logged_in : bool
-
is the context for rendering the resource of of someone who is looged in or not
- $data : array<string|int, mixed>
-
associate array of values to be sent to and used by view for rendering
Return values
mixed —renderResources()
Draws a list of media resources associated with a wiki page
public
renderResources(array<string|int, mixed> $data, string $read_mode[, bool $logged_in = true ][, string $file_upload_id = '' ]) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields RESOURCES_INFO contains info on resources
- $read_mode : string
-
whether the rendering should be for a media list in read mode (value "read"), a source mode (value "source"), or for use on the edit task of any wiki page (value "")
- $logged_in : bool = true
-
whether the user is currently logged in or not
- $file_upload_id : string = ''
-
of form element to be set if can upload files
Return values
mixed —renderShareWall()
public
renderShareWall(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields contain data about the page with the page being shared
Return values
mixed —renderSourcePage()
Used to drawn the form that let's someone see the source of a wiki page
public
renderSourcePage(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
fields contain data about the page being edited. In particular, PAGE contains the raw page data