Content bank class.
More...
Content bank 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
◆ create_content_from_file()
core_contentbank\contentbank::create_content_from_file |
( |
\context |
$context, |
|
|
int |
$userid, |
|
|
stored_file |
$file |
|
) |
| |
Create content from a file information.
- Exceptions
-
- Parameters
-
context | $context | Context where to upload the file and content. |
int | $userid | Id of the user uploading the file. |
stored_file | $file | The file to get information from |
- Return values
-
◆ delete_contents()
core_contentbank\contentbank::delete_contents |
( |
context |
$context | ) |
|
Delete content bank content by context.
- Parameters
-
context | $context | The context to delete content from. |
- Return values
-
◆ get_contenttypes_with_capability_feature()
core_contentbank\contentbank::get_contenttypes_with_capability_feature |
( |
string |
$feature, |
|
|
context |
$context = null , |
|
|
bool |
$enabled = true |
|
) |
| |
Get the list of content types that have the requested feature.
- Parameters
-
string | $feature | Feature code e.g CAN_UPLOAD. |
null | context | $context | Optional context to check the permission to use the feature. |
bool | $enabled | Whether check only the enabled content types or all of them. |
- Return values
-
string[] | List of content types where the user has permission to access the feature. |
◆ get_enabled_content_types()
core_contentbank\contentbank::get_enabled_content_types |
( |
| ) |
|
Obtains the list of core_contentbank_content objects currently active.
The list does not include players which are disabled.
- Return values
-
string[] | Array of contentbank contenttypes. |
◆ get_extension()
core_contentbank\contentbank::get_extension |
( |
string |
$filename | ) |
|
Returns the file extension for a file.
- Parameters
-
string | $filename | The name of the file |
- Return values
-
string | The extension of the file |
◆ get_extension_supporter()
core_contentbank\contentbank::get_extension_supporter |
( |
string |
$extension, |
|
|
context |
$context = null |
|
) |
| |
Get the first content bank plugin supports a file extension.
- Parameters
-
string | $extension | Content file extension |
context | $context | $context Optional context to check (default null) |
- Return values
-
string | contenttype name supports the file extension or null if the extension is not supported by any allowed plugin. |
◆ get_supported_extensions_as_string()
core_contentbank\contentbank::get_supported_extensions_as_string |
( |
context |
$context = null | ) |
|
Obtains a string with all supported extensions by active plugins.
Mainly to use as filepicker options parameter.
- Parameters
-
context | $context | Optional context to check (default null) |
- Return values
-
string | A string with all the extensions supported. |
◆ is_context_allowed()
core_contentbank\contentbank::is_context_allowed |
( |
context |
$context | ) |
|
Whether the context is allowed.
- Parameters
-
context | $context | Context to check. |
- Return values
-
◆ load_all_supported_extensions()
core_contentbank\contentbank::load_all_supported_extensions |
( |
| ) |
|
Obtains an array of supported extensions by active plugins.
- Return values
-
array | The array with all the extensions supported and the supporting plugin names. |
◆ load_context_supported_extensions()
core_contentbank\contentbank::load_context_supported_extensions |
( |
context |
$context = null | ) |
|
Obtains an array of supported extensions in the given context.
- Parameters
-
context | $context | Optional context to check (default null) |
- Return values
-
array | The array with all the extensions supported and the supporting plugin names. |
◆ move_contents()
core_contentbank\contentbank::move_contents |
( |
context |
$from, |
|
|
context |
$to |
|
) |
| |
Move content bank content from a context to another.
- Parameters
-
context | $from | The context to get content from. |
context | $to | The context to move content to. |
- Return values
-
◆ search_contents()
core_contentbank\contentbank::search_contents |
( |
?string |
$search = null , |
|
|
?int |
$contextid = 0 , |
|
|
?array |
$contenttypenames = null |
|
) |
| |
Find the contents with $search% in the contextid defined.
If contextid and search are empty, all contents are returned. In all the cases, only the contents for the enabled contentbank-type plugins are returned. No content-type permissions are validated here. It is the caller responsability to check that the user can access to them. The only validation done here is, for each content, a call to the method $content->is_view_allowed().
- Parameters
-
string | null | $search | Optional string to search (for now it will search only into the name). |
int | $contextid | Optional contextid to search. |
array | $contenttypenames | Optional array with the list of content-type names to search. |
- Return values
-
array | The contents for the enabled contentbank-type plugins having $search as name and placed in $contextid. |
The documentation for this class was generated from the following file: