Content type manager class.
More...
|
const | CAN_EDIT = 'edit' |
| Plugin implements edition feature.
|
|
const | CAN_UPLOAD = 'upload' |
| Plugin implements uploading feature.
|
|
|
context | $context = null |
| This contenttype's context.
|
|
Content type manager class.
- Copyright
- 2020 Amaia Anabitarte amaia.nosp@m.@moo.nosp@m.dle.c.nosp@m.om
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core_contentbank\contenttype::__construct |
( |
\context |
$context = null | ) |
|
Content type constructor.
- Parameters
-
context | $context | Optional context to check (default null) |
◆ can_access()
core_contentbank\contenttype::can_access |
( |
| ) |
|
|
final |
Returns user has access capability for the main content bank and the content itself (base on is_access_allowed from plugin).
- Return values
-
bool | True if content could be accessed. False otherwise. |
◆ can_delete()
core_contentbank\contenttype::can_delete |
( |
content |
$content | ) |
|
|
final |
Check if the user can delete this content.
- Parameters
-
content | $content | The content to be deleted. |
- Return values
-
bool | True if content could be uploaded. False otherwise. |
◆ can_edit()
core_contentbank\contenttype::can_edit |
( |
?content |
$content = null | ) |
|
|
final |
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.
- Parameters
-
content | $content | The content to be edited or null when creating a new content. |
- Return values
-
bool | True if the user can edit content. False otherwise. |
◆ can_manage()
core_contentbank\contenttype::can_manage |
( |
content |
$content | ) |
|
|
final |
Check if the user can managed this content.
- Parameters
-
content | $content | The content to be managed. |
- Return values
-
bool | True if content could be managed. False otherwise. |
◆ can_upload()
core_contentbank\contenttype::can_upload |
( |
| ) |
|
|
final |
Returns the user has permission to upload new content.
- Return values
-
bool | True if content could be uploaded. False otherwise. |
◆ create_content()
core_contentbank\contenttype::create_content |
( |
\stdClass |
$record = null | ) |
|
Fills content_bank table with appropiate information.
- Exceptions
-
dml_exception | A DML specific exception is thrown for any creation error. |
- Parameters
-
stdClass | $record | An optional content record compatible object (default null) |
- Return values
-
content | Object with content bank information. |
◆ delete_content()
core_contentbank\contenttype::delete_content |
( |
content |
$content | ) |
|
Delete this content from the content_bank.
This method can be overwritten by the plugins if they need to delete specific information.
- Parameters
-
content | $content | The content to delete. |
- Return values
-
boolean | true if the content has been deleted; false otherwise. |
◆ get_contenttype_name()
core_contentbank\contenttype::get_contenttype_name |
( |
| ) |
|
Returns the contenttype name of this content.
- Return values
-
string | Content type of the current instance |
◆ get_contenttype_types()
core_contentbank\contenttype::get_contenttype_types |
( |
| ) |
|
|
abstract |
Returns the list of different types of the given content type.
A content type can have one or more options for creating content. This method will report all of them or only the content type itself if it has no other options.
- Return values
-
array | An object for each type:
- string typename: descriptive name of the type.
- string typeeditorparams: params required by this content type editor.
- url typeicon: this type icon.
|
Reimplemented in contenttype_h5p\contenttype.
◆ get_icon()
core_contentbank\contenttype::get_icon |
( |
content |
$content | ) |
|
Returns the HTML code to render the icon for content bank contents.
- Parameters
-
content | $content | The content to be displayed. |
- Return values
-
string | HTML code to render the icon |
◆ get_implemented_features()
core_contentbank\contenttype::get_implemented_features |
( |
| ) |
|
|
abstractprotected |
◆ get_manageable_extensions()
core_contentbank\contenttype::get_manageable_extensions |
( |
| ) |
|
|
abstract |
◆ get_plugin_name()
core_contentbank\contenttype::get_plugin_name |
( |
| ) |
|
Returns the plugin name of the current instance.
- Return values
-
string | Plugin name of the current instance |
◆ get_view_content()
core_contentbank\contenttype::get_view_content |
( |
content |
$content | ) |
|
Returns the HTML content to add to view.php visualizer.
- Parameters
-
content | $content | The content to be displayed. |
- Return values
-
string | HTML code to include in view.php. |
◆ get_view_url()
core_contentbank\contenttype::get_view_url |
( |
content |
$content | ) |
|
Returns the URL where the content will be visualized.
- Parameters
-
content | $content | The content to be displayed. |
- Return values
-
string | URL where to visualize the given content. |
◆ is_access_allowed()
core_contentbank\contenttype::is_access_allowed |
( |
| ) |
|
|
protected |
Returns user has access capability for the content itself.
- Return values
-
bool | True if content could be accessed. False otherwise. |
Reimplemented in contenttype_h5p\contenttype.
◆ is_delete_allowed()
core_contentbank\contenttype::is_delete_allowed |
( |
content |
$content | ) |
|
|
protected |
Returns if content allows deleting.
- Parameters
-
content | $content | The content to be deleted. |
- Return values
-
bool | True if content allows uploading. False otherwise. |
◆ is_edit_allowed()
core_contentbank\contenttype::is_edit_allowed |
( |
?content |
$content | ) |
|
|
protected |
Returns plugin allows edition.
- Parameters
-
content | $content | The content to be edited. |
- Return values
-
bool | True if plugin allows edition. False otherwise. |
◆ is_feature_supported()
core_contentbank\contenttype::is_feature_supported |
( |
string |
$feature | ) |
|
|
final |
Returns the plugin supports the feature.
- Parameters
-
string | $feature | Feature code e.g CAN_UPLOAD |
- Return values
-
bool | True if content could be uploaded. False otherwise. |
◆ is_manage_allowed()
core_contentbank\contenttype::is_manage_allowed |
( |
content |
$content | ) |
|
|
protected |
Returns if content allows managing.
- Parameters
-
content | $content | The content to be managed. |
- Return values
-
bool | True if content allows uploading. False otherwise. |
◆ is_upload_allowed()
core_contentbank\contenttype::is_upload_allowed |
( |
| ) |
|
|
protected |
Returns plugin allows uploading.
- Return values
-
bool | True if plugin allows uploading. False otherwise. |
◆ move_content()
core_contentbank\contenttype::move_content |
( |
content |
$content, |
|
|
context |
$context |
|
) |
| |
Move content to another context.
This method can be overwritten by the plugins if they need to change some other specific information.
- Parameters
-
content | $content | The content to rename. |
context | $context | The new context. |
- Return values
-
boolean | true if the content has been renamed; false otherwise. |
◆ rename_content()
core_contentbank\contenttype::rename_content |
( |
content |
$content, |
|
|
string |
$name |
|
) |
| |
Rename this content from the content_bank.
This method can be overwritten by the plugins if they need to change some other specific information.
- Parameters
-
content | $content | The content to rename. |
string | $name | The name of the content. |
- Return values
-
boolean | true if the content has been renamed; false otherwise. |
◆ upload_content()
core_contentbank\contenttype::upload_content |
( |
stored_file |
$file, |
|
|
stdClass |
$record = null |
|
) |
| |
Create a new content from an uploaded file.
- Exceptions
-
- Parameters
-
stored_file | $file | the uploaded file |
stdClass | null | $record | an optional content record |
- Return values
-
content | Object with content bank information. |
The documentation for this class was generated from the following file: