See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
File size admin setting.
Copyright: | 2019 Shamim Rezaie <shamim@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 197 lines (7 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
filesize:: (7 methods):
__construct()
get_units()
get_size_text()
parse_bytes()
get_setting()
write_setting()
output_html()
__construct(string $name, string $visiblename, string $description,int $defaultvalue = null, int $defaultunit = null) X-Ref |
Constructor param: string $name unique ascii name, either 'mysetting' for settings that in config, param: string $visiblename localised name param: string $description localised long description param: int|null $defaultvalue Value of the settings in bytes param: int|null $defaultunit GB, MB, etc. (in bytes) |
get_units() X-Ref |
Returns selectable units. return: array |
get_size_text(int $bytes) X-Ref |
Converts bytes to some more user friendly string. param: int $bytes The number of bytes we want to convert from return: string |
parse_bytes(int $bytes) X-Ref |
Finds suitable units for given file size. param: int $bytes The number of bytes return: array Parsed file size in the format of ['v' => value, 'u' => unit] |
get_setting() X-Ref |
Get the selected file size as array. return: array|null An array containing 'v' => xx, 'u' => xx, or null if not set |
write_setting($data) X-Ref |
Store the file size as bytes. param: array $data Must be form 'h' => xx, 'm' => xx return: string The error string if any |
output_html($data, $query = '') X-Ref |
Returns file size text+select fields. param: array $data The current setting value. Must be form 'v' => xx, 'u' => xx. param: string $query Admin search query to be highlighted. return: string File size text+select fields and wrapping div(s). |