File manager - Edit - /home/u466501803/domains/qurdis.my.id/public_html/contentbank.zip
Back
PK =<�\u��S S lib.phpnu �[��� <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Library functions for contentbank * * @package core_contentbank * @copyright 2020 Bas Brands * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use \core_contentbank\content; /** * Get the current user preferences that are available * * @uses core_user::is_current_user * * @return array[] preferences configuration */ function core_contentbank_user_preferences(): array { return [ 'core_contentbank_view_list' => [ 'choices' => array(0, 1), 'type' => PARAM_INT, 'null' => NULL_NOT_ALLOWED, 'default' => 0, 'permissioncallback' => [core_user::class, 'is_current_user'], ], 'core_contentbank_visibility' => [ 'choices' => [content::VISIBILITY_UNLISTED, content::VISIBILITY_PUBLIC], 'type' => PARAM_INT, 'null' => NULL_NOT_ALLOWED ], 'core_contentbank_displayunlisted' => [ 'choices' => [0, 1], 'type' => PARAM_INT, 'null' => NULL_NOT_ALLOWED, 'default' => 0, 'permissioncallback' => [core_user::class, 'is_current_user'], ], ]; } PK =<�\�l� � ! classes/external/copy_content.phpnu �[��� <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. namespace core_contentbank\external; use core_contentbank\contentbank; use core_external\external_api; use core_external\external_function_parameters; use core_external\external_single_structure; use core_external\external_value; use core_external\external_warnings; /** * This is the external method for copying a content. * * @package core_contentbank * @copyright 2023 Daniel Neis Araujo * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class copy_content extends external_api { /** * copy_content parameters. * * @since Moodle 4.3 * @return external_function_parameters */ public static function execute_parameters(): external_function_parameters { return new external_function_parameters( [ 'contentid' => new external_value(PARAM_INT, 'The content id to copy', VALUE_REQUIRED), 'name' => new external_value(PARAM_RAW, 'The new name for the content', VALUE_REQUIRED), ] ); } /** * Copy content from the contentbank. * * @since Moodle 4.3 * @param int $contentid The content id to copy. * @param string $name The new name. * @return array Id of the new content; false and the warning, otherwise. */ public static function execute(int $contentid, string $name): array { global $DB; $id = 0; $warnings = []; $params = self::validate_parameters(self::execute_parameters(), [ 'contentid' => $contentid, 'name' => $name, ]); $params['name'] = clean_param($params['name'], PARAM_TEXT); // If name is empty don't try to copy and return a more detailed message. if (trim($params['name']) === '') { $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'emptynamenotallowed', 'message' => get_string('emptynamenotallowed', 'core_contentbank'), ]; } else { try { $record = $DB->get_record('contentbank_content', ['id' => $params['contentid']], '*', MUST_EXIST); $cb = new contentbank(); $content = $cb->get_content_from_id($record->id); $contenttype = $content->get_content_type_instance(); $context = \context::instance_by_id($record->contextid, MUST_EXIST); self::validate_context($context); // Check capability. if ($contenttype->can_copy($content)) { // This content can be copied. $crecord = $content->get_content(); unset($crecord->id); $crecord->name = $params['name']; if ($content = $contenttype->create_content($crecord)) { $handler = \core_contentbank\customfield\content_handler::create(); $handler->instance_form_before_set_data($record); $record->id = $content->get_id(); $handler->instance_form_save($record); $fs = get_file_storage(); $files = $fs->get_area_files($context->id, 'contentbank', 'public', $params['contentid'], 'itemid, filepath, filename', false); if (!empty($files)) { $file = reset($files); $content->import_file($file); } $id = $content->get_id(); } else { $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'contentnotcopied', 'message' => get_string('contentnotcopied', 'core_contentbank'), ]; } } else { // The user has no permission to manage this content. $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'nopermissiontomanage', 'message' => get_string('nopermissiontocopy', 'core_contentbank'), ]; } } catch (\moodle_exception $e) { // The content or the context don't exist. $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'exception', 'message' => $e->getMessage(), ]; } } return [ 'id' => $id, 'warnings' => $warnings, ]; } /** * copy_content return. * * @since Moodle 4.3 * @return external_single_structure */ public static function execute_returns(): external_single_structure { return new external_single_structure([ 'id' => new external_value(PARAM_INT, 'The id of the new content'), 'warnings' => new external_warnings(), ]); } } PK =<�\�ѱ/� � # classes/external/rename_content.phpnu �[��� <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. namespace core_contentbank\external; use core_contentbank\contentbank; use core_external\external_api; use core_external\external_function_parameters; use core_external\external_single_structure; use core_external\external_value; use core_external\external_warnings; /** * This is the external method for renaming a content. * * @package core_contentbank * @copyright 2020 Amaia Anabitarte <amaia@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class rename_content extends external_api { /** * rename_content parameters. * * @since Moodle 3.9 * @return external_function_parameters */ public static function execute_parameters(): external_function_parameters { return new external_function_parameters( [ 'contentid' => new external_value(PARAM_INT, 'The content id to rename', VALUE_REQUIRED), 'name' => new external_value(PARAM_RAW, 'The new name for the content', VALUE_REQUIRED), ] ); } /** * Rename content from the contentbank. * * @since Moodle 3.9 * @param int $contentid The content id to rename. * @param string $name The new name. * @return array True if the content has been renamed; false and the warning, otherwise. */ public static function execute(int $contentid, string $name): array { global $DB; $result = false; $warnings = []; $params = self::validate_parameters(self::execute_parameters(), [ 'contentid' => $contentid, 'name' => $name, ]); $params['name'] = clean_param($params['name'], PARAM_TEXT); // If name is empty don't try to rename and return a more detailed message. if (trim($params['name']) === '') { $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'emptynamenotallowed', 'message' => get_string('emptynamenotallowed', 'core_contentbank') ]; } else { try { $record = $DB->get_record('contentbank_content', ['id' => $params['contentid']], '*', MUST_EXIST); $cb = new contentbank(); $content = $cb->get_content_from_id($record->id); $contenttype = $content->get_content_type_instance(); $context = \context::instance_by_id($record->contextid, MUST_EXIST); self::validate_context($context); // Check capability. if ($contenttype->can_manage($content)) { // This content can be renamed. if ($contenttype->rename_content($content, $params['name'])) { $result = true; } else { $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'contentnotrenamed', 'message' => get_string('contentnotrenamed', 'core_contentbank') ]; } } else { // The user has no permission to manage this content. $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'nopermissiontomanage', 'message' => get_string('nopermissiontomanage', 'core_contentbank') ]; } } catch (\moodle_exception $e) { // The content or the context don't exist. $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'exception', 'message' => $e->getMessage() ]; } } return [ 'result' => $result, 'warnings' => $warnings ]; } /** * rename_content return. * * @since Moodle 3.9 * @return external_single_structure */ public static function execute_returns(): external_single_structure { return new external_single_structure([ 'result' => new external_value(PARAM_BOOL, 'The processing result'), 'warnings' => new external_warnings() ]); } } PK =<�\�hJ; ; + classes/external/set_content_visibility.phpnu �[��� <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. namespace core_contentbank\external; use core_external\external_api; use core_external\external_function_parameters; use core_external\external_single_structure; use core_external\external_value; use core_external\external_warnings; /** * External API to set the visibility of content bank content. * * @package core_contentbank * @copyright 2020 François Moreau * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class set_content_visibility extends external_api { /** * set_content_visibility parameters. * * @since Moodle 3.11 * @return external_function_parameters */ public static function execute_parameters(): external_function_parameters { return new external_function_parameters( [ 'contentid' => new external_value(PARAM_INT, 'The content id to rename', VALUE_REQUIRED), 'visibility' => new external_value(PARAM_INT, 'The new visibility for the content', VALUE_REQUIRED), ] ); } /** * Set visibility of a content from the contentbank. * * @since Moodle 3.11 * @param int $contentid The content id to rename. * @param int $visibility The new visibility. * @return array */ public static function execute(int $contentid, int $visibility): array { global $DB; $result = false; $warnings = []; $params = self::validate_parameters(self::execute_parameters(), [ 'contentid' => $contentid, 'visibility' => $visibility, ]); try { $record = $DB->get_record('contentbank_content', ['id' => $params['contentid']], '*', MUST_EXIST); $contenttypeclass = "\\$record->contenttype\\contenttype"; if (class_exists($contenttypeclass)) { $context = \context::instance_by_id($record->contextid, MUST_EXIST); self::validate_context($context); $contenttype = new $contenttypeclass($context); $contentclass = "\\$record->contenttype\\content"; $content = new $contentclass($record); // Check capability. if ($contenttype->can_manage($content)) { // This content's visibility can be changed. if ($content->set_visibility($params['visibility'])) { $result = true; } else { $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'contentvisibilitynotset', 'message' => get_string('contentvisibilitynotset', 'core_contentbank') ]; } } else { // The user has no permission to manage this content. $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'nopermissiontomanage', 'message' => get_string('nopermissiontomanage', 'core_contentbank') ]; } } } catch (\moodle_exception $e) { // The content or the context don't exist. $warnings[] = [ 'item' => $params['contentid'], 'warningcode' => 'exception', 'message' => $e->getMessage() ]; } return [ 'result' => $result, 'warnings' => $warnings ]; } /** * set_content_visibility return. * * @since Moodle 3.11 * @return external_single_structure */ public static function execute_returns(): external_single_structure { return new external_single_structure([ 'result' => new external_value(PARAM_BOOL, 'The processing result'), 'warnings' => new external_warnings() ]); } } PK =<�\d � # classes/external/delete_content.phpnu �[��� <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. namespace core_contentbank\external; use core_contentbank\contentbank; use core_external\external_api; use core_external\external_function_parameters; use core_external\external_multiple_structure; use core_external\external_single_structure; use core_external\external_value; use core_external\external_warnings; /** * This is the external method for deleting a content. * * @package core_contentbank * @since Moodle 3.9 * @copyright 2020 Sara Arjona <sara@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class delete_content extends external_api { /** * Parameters. * * @return external_function_parameters */ public static function execute_parameters(): external_function_parameters { return new external_function_parameters([ 'contentids' => new external_multiple_structure( new external_value(PARAM_INT, 'The content id to delete', VALUE_REQUIRED) ) ]); } /** * Delete content from the contentbank. * * @param array $contentids List of content ids to delete. * @return array True if the content has been deleted; false and the warning, otherwise. */ public static function execute(array $contentids): array { global $DB; $result = false; $warnings = []; $params = self::validate_parameters(self::execute_parameters(), ['contentids' => $contentids]); $cb = new contentbank(); foreach ($params['contentids'] as $contentid) { try { $record = $DB->get_record('contentbank_content', ['id' => $contentid], '*', MUST_EXIST); $content = $cb->get_content_from_id($record->id); $contenttype = $content->get_content_type_instance(); $context = \context::instance_by_id($record->contextid, MUST_EXIST); self::validate_context($context); // Check capability. if ($contenttype->can_delete($content)) { // This content can be deleted. if (!$contenttype->delete_content($content)) { $warnings[] = [ 'item' => $contentid, 'warningcode' => 'contentnotdeleted', 'message' => get_string('contentnotdeleted', 'core_contentbank') ]; } } else { // The user has no permission to delete this content. $warnings[] = [ 'item' => $contentid, 'warningcode' => 'nopermissiontodelete', 'message' => get_string('nopermissiontodelete', 'core_contentbank') ]; } } catch (\moodle_exception $e) { // The content or the context don't exist. $warnings[] = [ 'item' => $contentid, 'warningcode' => 'exception', 'message' => $e->getMessage() ]; } } if (empty($warnings)) { $result = true; } return [ 'result' => $result, 'warnings' => $warnings ]; } /** * Return. * * @return external_single_structure */ public static function execute_returns(): external_single_structure { return new external_single_structure([ 'result' => new external_value(PARAM_BOOL, 'The processing result'), 'warnings' => new external_warnings() ]); } } PK =<�\*O9� � classes/helper.phpnu �[��� <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Contains helper class for the content bank. * * @package core_contentbank * @copyright 2020 Amaia Anabitarte <amaia@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core_contentbank; /** * Helper class for the content bank. * * @package core_contentbank * @copyright 2020 Amaia Anabitarte <amaia@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class helper { /** * Getting content bank page ready for the breadcrumbs. * * @param \context $context Context of the current page. * @param string $title Title of the current page. * @param bool $internal True if is an internal page, false otherwise. */ public static function get_page_ready(\context $context, string $title, bool $internal = false): void { global $PAGE, $DB; $PAGE->set_context($context); $PAGE->set_heading(self::get_page_heading($context)); $PAGE->set_secondary_active_tab('contentbank'); $cburl = new \moodle_url('/contentbank/index.php', ['contextid' => $context->id]); switch ($context->contextlevel) { case CONTEXT_COURSE: $courseid = $context->instanceid; $course = $DB->get_record('course', ['id' => $courseid], '*', MUST_EXIST); $PAGE->set_course($course); \navigation_node::override_active_url(new \moodle_url('/course/view.php', ['id' => $courseid])); $PAGE->navbar->add($title, $cburl); $PAGE->set_pagelayout('incourse'); break; case CONTEXT_COURSECAT: $coursecat = $context->instanceid; \navigation_node::override_active_url(new \moodle_url('/course/index.php', ['categoryid' => $coursecat])); $PAGE->navbar->add($title, $cburl); $PAGE->set_pagelayout('coursecategory'); break; default: if ($node = $PAGE->navigation->find('contentbank', \global_navigation::TYPE_CUSTOM)) { $node->make_active(); } $PAGE->set_pagelayout('standard'); } } /** * Get the page heading based on the current context * * @param \context $context The current context of the page * @return string */ public static function get_page_heading(\context $context): string { global $SITE; $title = get_string('contentbank'); if ($context->id == \context_system::instance()->id) { $title = $SITE->fullname; } else if ($context->contextlevel == CONTEXT_COURSE) { $course = get_course($context->instanceid); $title = $course->fullname; } else if ($context->contextlevel == CONTEXT_COURSECAT) { $category = \core_course_category::get($context->instanceid); $title = $category->get_formatted_name(); } return $title; } } PK =<�\:06T T classes/output/viewcontent.phpnu �[��� <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. namespace core_contentbank\output; use context; use core_contentbank\content; use core_contentbank\contenttype; use moodle_url; use renderable; use renderer_base; use stdClass; use templatable; /** * Class containing data for the content view. * * @copyright 2020 Victor Deniz <victor@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class viewcontent implements renderable, templatable { /** * @var contenttype Content bank content type. */ private $contenttype; /** * @var stdClass Record of the contentbank_content table. */ private $content; /** * Construct this renderable. * * @param contenttype $contenttype Content bank content type. * @param content $content Record of the contentbank_content table. */ public function __construct(contenttype $contenttype, content $content) { $this->contenttype = $contenttype; $this->content = $content; } /** * Get the content of the "More" dropdown in the tertiary navigation * * @return array|null The options to be displayed in a dropdown in the tertiary navigation * @throws \moodle_exception */ protected function get_edit_actions_dropdown(): ?array { global $PAGE; $options = []; if ($this->contenttype->can_manage($this->content)) { // Add the visibility item to the menu. switch($this->content->get_visibility()) { case content::VISIBILITY_UNLISTED: $visibilitylabel = get_string('visibilitysetpublic', 'core_contentbank'); $newvisibility = content::VISIBILITY_PUBLIC; break; case content::VISIBILITY_PUBLIC: $visibilitylabel = get_string('visibilitysetunlisted', 'core_contentbank'); $newvisibility = content::VISIBILITY_UNLISTED; break; default: $url = new \moodle_url('/contentbank/index.php', ['contextid' => $this->content->get_contextid()]); throw new moodle_exception('contentvisibilitynotfound', 'error', $url, $this->content->get_visibility()); } if ($visibilitylabel) { $options[$visibilitylabel] = [ 'data-action' => 'setcontentvisibility', 'data-visibility' => $newvisibility, 'data-contentid' => $this->content->get_id(), ]; } // Add the rename content item to the menu. $options[get_string('rename')] = [ 'data-action' => 'renamecontent', 'data-contentname' => $this->content->get_name(), 'data-contentid' => $this->content->get_id(), ]; if ($this->contenttype->can_upload()) { $options[get_string('replacecontent', 'contentbank')] = ['data-action' => 'upload']; $PAGE->requires->js_call_amd( 'core_contentbank/upload', 'initModal', [ '[data-action=upload]', \core_contentbank\form\upload_files::class, $this->content->get_contextid(), $this->content->get_id() ] ); } } if ($this->contenttype->can_download($this->content)) { $url = new moodle_url($this->contenttype->get_download_url($this->content)); $options[get_string('download')] = [ 'url' => $url->out() ]; } if ($this->contenttype->can_copy($this->content)) { // Add the copy content item to the menu. $options[get_string('copycontent', 'contentbank')] = [ 'data-action' => 'copycontent', 'data-contentname' => get_string('copyof', 'contentbank', $this->content->get_name()), 'data-contentid' => $this->content->get_id(), ]; } // Add the delete content item to the menu. if ($this->contenttype->can_delete($this->content)) { $options[get_string('delete')] = [ 'data-action' => 'deletecontent', 'data-contentname' => $this->content->get_name(), 'data-uses' => count($this->content->get_uses()), 'data-contentid' => $this->content->get_id(), 'data-contextid' => $this->content->get_contextid(), 'class' => 'text-danger', ]; } $dropdown = []; if ($options) { foreach ($options as $key => $attribs) { $url = $attribs['url'] ?? '#'; $extraclasses = $attribs['class'] ?? ''; $dropdown['options'][] = [ 'label' => $key, 'url' => $url, 'extraclasses' => $extraclasses, 'attributes' => array_map(function ($key, $value) { return [ 'name' => $key, 'value' => $value ]; }, array_keys($attribs), $attribs) ]; } } return $dropdown; } /** * Export this data so it can be used as the context for a mustache template. * * @param renderer_base $output * * @return stdClass */ public function export_for_template(renderer_base $output): stdClass { $data = new stdClass(); // Get the content type html. $contenthtml = $this->contenttype->get_view_content($this->content); $data->contenthtml = $contenthtml; $handler = \core_contentbank\customfield\content_handler::create(); $customfields = $handler->get_instance_data($this->content->get_id()); $data->customfieldshtml = $handler->display_custom_fields_data($customfields); // Check if the user can edit this content type. if ($this->contenttype->can_edit($this->content)) { $data->usercanedit = true; $urlparams = [ 'contextid' => $this->content->get_contextid(), 'plugin' => $this->contenttype->get_plugin_name(), 'id' => $this->content->get_id() ]; $editcontenturl = new moodle_url('/contentbank/edit.php', $urlparams); $data->editcontenturl = $editcontenturl->out(false); } // Close/exit link for those users who can access that context. $context = context::instance_by_id($this->content->get_contextid()); if (has_capability('moodle/contentbank:access', $context)) { $closeurl = new moodle_url('/contentbank/index.php', ['contextid' => $context->id]); $data->closeurl = $closeurl->out(false); } $data->actionmenu = $this->get_edit_actions_dropdown(); $data->heading = $this->content->get_name(); if ($this->content->get_visibility() == content::VISIBILITY_UNLISTED) { $data->heading = get_string('visibilitytitleunlisted', 'contentbank', $data->heading); } return $data; } } PK =<�\�z�!m m classes/output/customfields.phpnu �[��� <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. namespace core_contentbank\output; use renderable; use templatable; use renderer_base; use core_contentbank\content; /** * Content bank Custom fields renderable class. * * @package core_contentbank * @copyright 2024 Daniel Neis Araujo <daniel@adapta.online> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class customfields implements renderable, templatable { /** * Constructor. * * @param \core_contentbank\content $content The content object. */ public function __construct(content $content) { $this->content = $content; } /** * Export the data. * * @param renderer_base $output * @return stdClass */ public function export_for_template(renderer_base $output) { global $DB; $context = new \stdClass(); $context->url = $this->content->get_file_url(); $context->name = $this->content->get_name(); $handler = \core_contentbank\customfield\content_handler::create(); $customfields = $handler->get_instance_data($this->content->get_id()); $context->data = $handler->display_custom_fields_data($customfields); return $context; } } PK =<�\�o�Q�"