Differences Between: [Versions 310 and 402] [Versions 39 and 402] [Versions 402 and 403]
Content type manager class
Copyright: | 2020 Amaia Anabitarte <amaia@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 516 lines (19 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
contenttype:: (26 methods):
__construct()
create_content()
upload_content()
replace_content()
delete_content()
rename_content()
move_content()
get_contenttype_name()
get_plugin_name()
get_view_url()
get_view_content()
get_download_url()
get_icon()
can_access()
is_access_allowed()
can_upload()
is_upload_allowed()
can_delete()
is_delete_allowed()
can_manage()
is_manage_allowed()
can_edit()
is_edit_allowed()
can_download()
is_download_allowed()
is_feature_supported()
Class: contenttype - X-Ref
Content type manager class__construct(\context $context = null) X-Ref |
Content type constructor param: \context $context Optional context to check (default null) |
create_content(\stdClass $record = null) X-Ref |
Fills content_bank table with appropiate information. param: \stdClass $record An optional content record compatible object (default null) return: content Object with content bank information. |
upload_content(stored_file $file, \stdClass $record = null) X-Ref |
Create a new content from an uploaded file. param: stored_file $file the uploaded file param: \stdClass|null $record an optional content record return: content Object with content bank information. |
replace_content(stored_file $file, content $content) X-Ref |
Replace a content using an uploaded file. param: stored_file $file the uploaded file param: content $content the original content record return: content Object with the updated content bank information. |
delete_content(content $content) X-Ref |
Delete this content from the content_bank. This method can be overwritten by the plugins if they need to delete specific information. param: content $content The content to delete. return: boolean true if the content has been deleted; false otherwise. |
rename_content(content $content, string $name) X-Ref |
Rename this content from the content_bank. This method can be overwritten by the plugins if they need to change some other specific information. param: content $content The content to rename. param: string $name The name of the content. return: boolean true if the content has been renamed; false otherwise. |
move_content(content $content, \context $context) X-Ref |
Move content to another context. This method can be overwritten by the plugins if they need to change some other specific information. param: content $content The content to rename. param: \context $context The new context. return: boolean true if the content has been renamed; false otherwise. |
get_contenttype_name() X-Ref |
Returns the contenttype name of this content. return: string Content type of the current instance |
get_plugin_name() X-Ref |
Returns the plugin name of the current instance. return: string Plugin name of the current instance |
get_view_url(content $content) X-Ref |
Returns the URL where the content will be visualized. param: content $content The content to be displayed. return: string URL where to visualize the given content. |
get_view_content(content $content) X-Ref |
Returns the HTML content to add to view.php visualizer. param: content $content The content to be displayed. return: string HTML code to include in view.php. |
get_download_url(content $content) X-Ref |
Returns the URL to download the content. param: content $content The content to be downloaded. return: string URL with the content to download. |
get_icon(content $content) X-Ref |
Returns the HTML code to render the icon for content bank contents. param: content $content The content to be displayed. return: string HTML code to render the icon |
can_access() X-Ref |
Returns user has access capability for the main content bank and the content itself (base on is_access_allowed from plugin). return: bool True if content could be accessed. False otherwise. |
is_access_allowed() X-Ref |
Returns user has access capability for the content itself. return: bool True if content could be accessed. False otherwise. |
can_upload() X-Ref |
Returns the user has permission to upload new content. return: bool True if content could be uploaded. False otherwise. |
is_upload_allowed() X-Ref |
Returns plugin allows uploading. return: bool True if plugin allows uploading. False otherwise. |
can_delete(content $content) X-Ref |
Check if the user can delete this content. param: content $content The content to be deleted. return: bool True if content could be uploaded. False otherwise. |
is_delete_allowed(content $content) X-Ref |
Returns if content allows deleting. param: content $content The content to be deleted. return: bool True if content allows uploading. False otherwise. |
can_manage(content $content) X-Ref |
Check if the user can managed this content. param: content $content The content to be managed. return: bool True if content could be managed. False otherwise. |
is_manage_allowed(content $content) X-Ref |
Returns if content allows managing. param: content $content The content to be managed. return: bool True if content allows uploading. False otherwise. |
can_edit(?content $content = null) X-Ref |
Returns whether or not the user has permission to use the editor. This function will be called with the content to be edited as parameter, or null when is checking permission to create a new content using the editor. param: content $content The content to be edited or null when creating a new content. return: bool True if the user can edit content. False otherwise. |
is_edit_allowed(?content $content) X-Ref |
Returns plugin allows edition. param: content $content The content to be edited. return: bool True if plugin allows edition. False otherwise. |
can_download(content $content) X-Ref |
Returns whether or not the user has permission to download the content. param: content $content The content to be downloaded. return: bool True if the user can download the content. False otherwise. |
is_download_allowed(content $content) X-Ref |
Returns plugin allows downloading. param: content $content The content to be downloaed. return: bool True if plugin allows downloading. False otherwise. |
is_feature_supported(string $feature) X-Ref |
Returns the plugin supports the feature. param: string $feature Feature code e.g CAN_UPLOAD return: bool True if content could be uploaded. False otherwise. |