Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
contenttype_h5p\contenttype Class Reference

H5P content bank manager class. More...

Inheritance diagram for contenttype_h5p\contenttype:
core_contentbank\contenttype

Public Member Functions

 can_access ()
 Returns user has access capability for the main content bank and the content itself (base on is_access_allowed from plugin). More...
 
 can_delete (content $content)
 Check if the user can delete this content. More...
 
 can_edit (?content $content=null)
 Returns whether or not the user has permission to use the editor. More...
 
 can_manage (content $content)
 Check if the user can managed this content. More...
 
 can_upload ()
 Returns the user has permission to upload new content. More...
 
 create_content (\stdClass $record=null)
 Fills content_bank table with appropiate information. More...
 
 delete_content (\core_contentbank\content $content)
 Delete this content from the content_bank and remove all the H5P related information. More...
 
 delete_content (content $content)
 Delete this content from the content_bank. More...
 
 get_contenttype_name ()
 Returns the contenttype name of this content. More...
 
 get_contenttype_types ()
 Returns the list of different H5P content types the user can create. More...
 
 get_icon (\core_contentbank\content $content)
 Returns the HTML code to render the icon for H5P content types. More...
 
 get_icon (content $content)
 Returns the HTML code to render the icon for content bank contents. More...
 
 get_manageable_extensions ()
 Return an array of extensions this contenttype could manage. More...
 
 get_plugin_name ()
 Returns the plugin name of the current instance. More...
 
 get_view_content (\core_contentbank\content $content)
 Returns the HTML content to add to view.php visualizer. More...
 
 get_view_content (content $content)
 Returns the HTML content to add to view.php visualizer. More...
 
 get_view_url (content $content)
 Returns the URL where the content will be visualized. More...
 
 is_feature_supported (string $feature)
 Returns the plugin supports the feature. More...
 
 move_content (content $content, context $context)
 Move content to another context. More...
 
 rename_content (content $content, string $name)
 Rename this content from the content_bank. More...
 
 upload_content (stored_file $file, stdClass $record=null)
 Create a new content from an uploaded file. More...
 

Public Attributes

const CAN_EDIT = 'edit'
 Plugin implements edition feature.
 
const CAN_UPLOAD = 'upload'
 Plugin implements uploading feature.
 

Protected Member Functions

 get_implemented_features ()
 Return an array of implemented features by this plugin. More...
 
 is_access_allowed ()
 Returns user has access capability for the content itself. More...
 
 is_delete_allowed (content $content)
 Returns if content allows deleting. More...
 
 is_edit_allowed (?content $content)
 Returns plugin allows edition. More...
 
 is_manage_allowed (content $content)
 Returns if content allows managing. More...
 
 is_upload_allowed ()
 Returns plugin allows uploading. More...
 

Protected Attributes

context $context = null
 This contenttype's context.
 

Detailed Description

H5P content bank manager class.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ can_access()

core_contentbank\contenttype::can_access ( )
finalinherited

Returns user has access capability for the main content bank and the content itself (base on is_access_allowed from plugin).

Return values
boolTrue if content could be accessed. False otherwise.

◆ can_delete()

core_contentbank\contenttype::can_delete ( content  $content)
finalinherited

Check if the user can delete this content.

Parameters
content$contentThe content to be deleted.
Return values
boolTrue if content could be uploaded. False otherwise.

◆ can_edit()

core_contentbank\contenttype::can_edit ( ?content  $content = null)
finalinherited

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$contentThe content to be edited or null when creating a new content.
Return values
boolTrue if the user can edit content. False otherwise.

◆ can_manage()

core_contentbank\contenttype::can_manage ( content  $content)
finalinherited

Check if the user can managed this content.

Parameters
content$contentThe content to be managed.
Return values
boolTrue if content could be managed. False otherwise.

◆ can_upload()

core_contentbank\contenttype::can_upload ( )
finalinherited

Returns the user has permission to upload new content.

Return values
boolTrue if content could be uploaded. False otherwise.

◆ create_content()

core_contentbank\contenttype::create_content ( \stdClass  $record = null)
inherited

Fills content_bank table with appropiate information.

Exceptions
dml_exceptionA DML specific exception is thrown for any creation error.
Parameters
stdClass$recordAn optional content record compatible object (default null)
Return values
contentObject with content bank information.

◆ delete_content() [1/2]

contenttype_h5p\contenttype::delete_content ( \core_contentbank\content  $content)

Delete this content from the content_bank and remove all the H5P related information.

Parameters
content$contentThe content to delete.
Return values
booleantrue if the content has been deleted; false otherwise.

◆ delete_content() [2/2]

core_contentbank\contenttype::delete_content ( content  $content)
inherited

Delete this content from the content_bank.

This method can be overwritten by the plugins if they need to delete specific information.

Parameters
content$contentThe content to delete.
Return values
booleantrue if the content has been deleted; false otherwise.

◆ get_contenttype_name()

core_contentbank\contenttype::get_contenttype_name ( )
inherited

Returns the contenttype name of this content.

Return values
stringContent type of the current instance

◆ get_contenttype_types()

contenttype_h5p\contenttype::get_contenttype_types ( )

Returns the list of different H5P content types the user can create.

Return values
arrayAn object for each H5P content type:
  • string typename: descriptive name of the H5P content type.
  • string typeeditorparams: params required by the H5P editor.
  • url typeicon: H5P content type icon.

Reimplemented from core_contentbank\contenttype.

◆ get_icon() [1/2]

contenttype_h5p\contenttype::get_icon ( \core_contentbank\content  $content)

Returns the HTML code to render the icon for H5P content types.

Parameters
content$contentThe content to be displayed.
Return values
stringHTML code to render the icon

◆ get_icon() [2/2]

core_contentbank\contenttype::get_icon ( content  $content)
inherited

Returns the HTML code to render the icon for content bank contents.

Parameters
content$contentThe content to be displayed.
Return values
stringHTML code to render the icon

◆ get_implemented_features()

contenttype_h5p\contenttype::get_implemented_features ( )
protected

Return an array of implemented features by this plugin.

Return values
array

Reimplemented from core_contentbank\contenttype.

◆ get_manageable_extensions()

contenttype_h5p\contenttype::get_manageable_extensions ( )

Return an array of extensions this contenttype could manage.

Return values
array

Reimplemented from core_contentbank\contenttype.

◆ get_plugin_name()

core_contentbank\contenttype::get_plugin_name ( )
inherited

Returns the plugin name of the current instance.

Return values
stringPlugin name of the current instance

◆ get_view_content() [1/2]

contenttype_h5p\contenttype::get_view_content ( \core_contentbank\content  $content)

Returns the HTML content to add to view.php visualizer.

Parameters
content$contentThe content to be displayed.
Return values
stringHTML code to include in view.php.

◆ get_view_content() [2/2]

core_contentbank\contenttype::get_view_content ( content  $content)
inherited

Returns the HTML content to add to view.php visualizer.

Parameters
content$contentThe content to be displayed.
Return values
stringHTML code to include in view.php.

◆ get_view_url()

core_contentbank\contenttype::get_view_url ( content  $content)
inherited

Returns the URL where the content will be visualized.

Parameters
content$contentThe content to be displayed.
Return values
stringURL where to visualize the given content.

◆ is_access_allowed()

contenttype_h5p\contenttype::is_access_allowed ( )
protected

Returns user has access capability for the content itself.

Return values
boolTrue if content could be accessed. False otherwise.

Reimplemented from core_contentbank\contenttype.

◆ is_delete_allowed()

core_contentbank\contenttype::is_delete_allowed ( content  $content)
protectedinherited

Returns if content allows deleting.

Parameters
content$contentThe content to be deleted.
Return values
boolTrue if content allows uploading. False otherwise.

◆ is_edit_allowed()

core_contentbank\contenttype::is_edit_allowed ( ?content  $content)
protectedinherited

Returns plugin allows edition.

Parameters
content$contentThe content to be edited.
Return values
boolTrue if plugin allows edition. False otherwise.

◆ is_feature_supported()

core_contentbank\contenttype::is_feature_supported ( string  $feature)
finalinherited

Returns the plugin supports the feature.

Parameters
string$featureFeature code e.g CAN_UPLOAD
Return values
boolTrue if content could be uploaded. False otherwise.

◆ is_manage_allowed()

core_contentbank\contenttype::is_manage_allowed ( content  $content)
protectedinherited

Returns if content allows managing.

Parameters
content$contentThe content to be managed.
Return values
boolTrue if content allows uploading. False otherwise.

◆ is_upload_allowed()

core_contentbank\contenttype::is_upload_allowed ( )
protectedinherited

Returns plugin allows uploading.

Return values
boolTrue if plugin allows uploading. False otherwise.

◆ move_content()

core_contentbank\contenttype::move_content ( content  $content,
context  $context 
)
inherited

Move content to another context.

This method can be overwritten by the plugins if they need to change some other specific information.

Parameters
content$contentThe content to rename.
context$contextThe new context.
Return values
booleantrue if the content has been renamed; false otherwise.

◆ rename_content()

core_contentbank\contenttype::rename_content ( content  $content,
string  $name 
)
inherited

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$contentThe content to rename.
string$nameThe name of the content.
Return values
booleantrue if the content has been renamed; false otherwise.

◆ upload_content()

core_contentbank\contenttype::upload_content ( stored_file  $file,
stdClass  $record = null 
)
inherited

Create a new content from an uploaded file.

Exceptions
file_exceptionIf file operations fail
dml_exceptionif the content creation fails
Parameters
stored_file$filethe uploaded file
stdClass | null$recordan optional content record
Return values
contentObject with content bank information.

The documentation for this class was generated from the following file: