See Release Notes
Long Term Support Release
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * This file contains the interface required to implmeent a content writer. 19 * 20 * @package core_privacy 21 * @copyright 2018 Jake Dallimore <jrhdallimore@gmail.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace core_privacy\local\request; 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 /** 29 * The interface for a Moodle content writer. 30 * 31 * @package core_privacy 32 * @copyright 2018 Jake Dallimore <jrhdallimore@gmail.com> 33 */ 34 interface content_writer { 35 36 /** 37 * Constructor for the content writer. 38 * 39 * Note: The writer_factory must be passed. 40 * @param writer $writer The factory. 41 */ 42 public function __construct(writer $writer); 43 44 /** 45 * Set the context for the current item being processed. 46 * 47 * @param \context $context The context to use 48 * @return content_writer 49 */ 50 public function set_context(\context $context) : content_writer ; 51 52 /** 53 * Export the supplied data within the current context, at the supplied subcontext. 54 * 55 * @param array $subcontext The location within the current context that this data belongs. 56 * @param \stdClass $data The data to be exported 57 * @return content_writer 58 */ 59 public function export_data(array $subcontext, \stdClass $data) : content_writer ; 60 61 /** 62 * Export metadata about the supplied subcontext. 63 * 64 * Metadata consists of a key/value pair and a description of the value. 65 * 66 * @param array $subcontext The location within the current context that this data belongs. 67 * @param string $name The metadata name. 68 * @param string $value The metadata value. 69 * @param string $description The description of the value. 70 * @return content_writer 71 */ 72 public function export_metadata(array $subcontext, string $name, $value, string $description) : content_writer ; 73 74 /** 75 * Export a piece of related data. 76 * 77 * @param array $subcontext The location within the current context that this data belongs. 78 * @param string $name The name of the file to be exported. 79 * @param \stdClass $data The related data to export. 80 * @return content_writer 81 */ 82 public function export_related_data(array $subcontext, $name, $data) : content_writer ; 83 84 /** 85 * Export a piece of data in a custom format. 86 * 87 * @param array $subcontext The location within the current context that this data belongs. 88 * @param string $filename The name of the file to be exported. 89 * @param string $filecontent The content to be exported. 90 * @return content_writer 91 */ 92 public function export_custom_file(array $subcontext, $filename, $filecontent) : content_writer ; 93 94 /** 95 * Prepare a text area by processing pluginfile URLs within it. 96 * 97 * @param array $subcontext The location within the current context that this data belongs. 98 * @param string $component The name of the component that the files belong to. 99 * @param string $filearea The filearea within that component. 100 * @param string $itemid Which item those files belong to. 101 * @param string $text The text to be processed 102 * @return string The processed string 103 */ 104 public function rewrite_pluginfile_urls(array $subcontext, $component, $filearea, $itemid, $text) : string; 105 106 /** 107 * Export all files within the specified component, filearea, itemid combination. 108 * 109 * @param array $subcontext The location within the current context that this data belongs. 110 * @param string $component The name of the component that the files belong to. 111 * @param string $filearea The filearea within that component. 112 * @param string $itemid Which item those files belong to. 113 * @return content_writer 114 */ 115 public function export_area_files(array $subcontext, $component, $filearea, $itemid) : content_writer ; 116 117 /** 118 * Export the specified file in the target location. 119 * 120 * @param array $subcontext The location within the current context that this data belongs. 121 * @param \stored_file $file The file to be exported. 122 * @return content_writer 123 */ 124 public function export_file(array $subcontext, \stored_file $file) : content_writer ; 125 126 /** 127 * Export the specified user preference. 128 * 129 * @param string $component The name of the component. 130 * @param string $key The name of th key to be exported. 131 * @param string $value The value of the preference 132 * @param string $description A description of the value 133 * @return content_writer 134 */ 135 public function export_user_preference(string $component, string $key, string $value, string $description) : content_writer ; 136 137 /** 138 * Perform any required finalisation steps and return the location of the finalised export. 139 * 140 * @return string 141 */ 142 public function finalise_content() : string ; 143 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body