Differences Between: [Versions 310 and 402] [Versions 39 and 402] [Versions 402 and 403]
Content manager class
Copyright: | 2020 Amaia Anabitarte <amaia@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 402 lines (13 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
content:: (22 methods):
__construct()
get_content()
get_content_type()
get_content_type_instance()
get_timemodified()
update_content()
set_name()
get_name()
set_contextid()
get_contextid()
get_id()
set_instanceid()
get_instanceid()
set_configdata()
get_configdata()
set_visibility()
get_visibility()
import_file()
get_file()
get_uses()
get_file_url()
is_view_allowed()
__construct(stdClass $record) X-Ref |
Content bank constructor param: stdClass $record A contentbank_content record. |
get_content() X-Ref |
Returns $this->content. return: stdClass $this->content. |
get_content_type() X-Ref |
Returns $this->content->contenttype. return: string $this->content->contenttype. |
get_content_type_instance() X-Ref |
Return the contenttype instance of this content. return: contenttype The content type instance |
get_timemodified() X-Ref |
Returns $this->content->timemodified. return: int $this->content->timemodified. |
update_content() X-Ref |
Updates content_bank table with information in $this->content. return: boolean True if the content has been succesfully updated. False otherwise. |
set_name(string $name) X-Ref |
Set a new name to the content. param: string $name The name of the content. return: bool True if the content has been succesfully updated. False otherwise. |
get_name() X-Ref |
Returns the name of the content. return: string The name of the content. |
set_contextid(int $contextid) X-Ref |
Set a new contextid to the content. param: int $contextid The new contextid of the content. return: bool True if the content has been succesfully updated. False otherwise. |
get_contextid() X-Ref |
Returns the contextid of the content. return: int The id of the content context. |
get_id() X-Ref |
Returns the content ID. return: int The content ID. |
set_instanceid(int $instanceid) X-Ref |
Change the content instanceid value. param: int $instanceid New instanceid for this content return: boolean True if the instanceid has been succesfully updated. False otherwise. |
get_instanceid() X-Ref |
Returns the $instanceid of this content. return: int contentbank instanceid |
set_configdata(string $configdata) X-Ref |
Change the content config values. param: string $configdata New config information for this content return: boolean True if the configdata has been succesfully updated. False otherwise. |
get_configdata() X-Ref |
Return the content config values. return: mixed Config information for this content (json decoded) |
set_visibility(int $visibility) X-Ref |
Sets a new content visibility and saves it to database. param: int $visibility Must be self::PUBLIC or self::UNLISTED return: bool |
get_visibility() X-Ref |
Return true if the content may be shown to other users in the content bank. return: boolean |
import_file(stored_file $file) X-Ref |
Import a file as a valid content. By default, all content has a public file area to interact with the content bank repository. This method should be overridden by contentypes which does not simply upload to the public file area. If any, the method will return the final stored_file. This way it can be invoked as parent::import_file in case any plugin want to store the file in the public area and also parse it. param: stored_file $file File to store in the content file area. return: stored_file|null the stored content file or null if the file is discarted. |
get_file() X-Ref |
Returns the $file related to this content. return: stored_file File stored in content bank area related to the given itemid. |
get_uses() X-Ref |
Returns the places where the file associated to this content is used or an empty array if the content has no file. return: array of stored_file where current file content is used or empty array if it hasn't any file. |
get_file_url() X-Ref |
Returns the file url related to this content. return: string URL of the file stored in content bank area related to the given itemid. |
is_view_allowed() X-Ref |
Returns user has access permission for the content itself (based on what plugin needs). return: bool True if content could be accessed. False otherwise. |