diff --git a/source/streamio/settings.php b/source/streamio/settings.php index 7a6d249..ff37e9e 100644 --- a/source/streamio/settings.php +++ b/source/streamio/settings.php @@ -26,11 +26,7 @@ defined('MOODLE_INTERNAL') || die(); if ($hassiteconfig) { - $settings = new admin_settingpage('mediatimesrc_streamio_settings', new lang_string('pluginname', 'mediatimesrc_streamio')); - - // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf if ($ADMIN->fulltree) { - // TODO: Define actual plugin settings page and add it to the tree - {@link https://docs.moodle.org/dev/Admin_settings}. $settings->add(new admin_setting_configtext( 'mediatimesrc_streamio/username', new lang_string('username', 'mediatimesrc_streamio'), diff --git a/source/file/classes/form/edit_resource.php b/source/videotime/classes/form/edit_resource.php similarity index 91% rename from source/file/classes/form/edit_resource.php rename to source/videotime/classes/form/edit_resource.php index 28e193f..e32993d 100644 --- a/source/file/classes/form/edit_resource.php +++ b/source/videotime/classes/form/edit_resource.php @@ -17,15 +17,15 @@ /** * Media Time media edit form * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @copyright 2024 bdecent gmbh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mediatimesrc_file\form; +namespace mediatimesrc_videotime\form; use moodleform; -use mediatimesrc_file\output\media_resource; +use mediatimesrc_videotime\output\media_resource; /** * Media Time media edit form @@ -43,7 +43,7 @@ public function definition() { $mform->addElement('hidden', 'source'); $mform->setType('source', PARAM_TEXT); - $mform->setDefault('source', 'file'); + $mform->setDefault('source', 'videotime'); $mform->addElement('text', 'name', get_string('resourcename', 'tool_mediatime')); $mform->setType('name', PARAM_TEXT); @@ -63,7 +63,7 @@ public function definition() { $mform->addElement( 'filemanager', 'videofile', - get_string('videofile', 'mediatimesrc_file'), + get_string('videofile', 'mediatimesrc_videotime'), null, [ 'subdirs' => 0, @@ -74,12 +74,12 @@ public function definition() { 'return_types' => FILE_INTERNAL, ] ); - $mform->addHelpButton('videofile', 'videofile', 'mediatimesrc_file'); + $mform->addHelpButton('videofile', 'videofile', 'mediatimesrc_videotime'); $mform->addElement( 'filemanager', 'posterimage', - get_string('posterimage', 'mediatimesrc_file'), + get_string('posterimage', 'mediatimesrc_videotime'), null, [ 'subdirs' => 0, @@ -90,7 +90,7 @@ public function definition() { 'return_types' => FILE_INTERNAL, ] ); - $mform->addHelpButton('posterimage', 'posterimage', 'mediatimesrc_file'); + $mform->addHelpButton('posterimage', 'posterimage', 'mediatimesrc_videotime'); $this->tag_elements(); $this->add_action_buttons(); @@ -114,7 +114,7 @@ public function definition_after_data() { ]; $mform->insertElementBefore( $mform->createElement('html', format_text( - $OUTPUT->render_from_template('mediatimesrc_file/video', $content), + $OUTPUT->render_from_template('mediatimesrc_videotime/video', $content), FORMAT_HTML, ['context' => \context_system::instance()] )), diff --git a/source/file/classes/manager.php b/source/videotime/classes/manager.php similarity index 94% rename from source/file/classes/manager.php rename to source/videotime/classes/manager.php index e12a123..57bcde7 100644 --- a/source/file/classes/manager.php +++ b/source/videotime/classes/manager.php @@ -17,12 +17,12 @@ /** * Manage Streamio source files * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @copyright 2024 bdecent gmbh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mediatimesrc_file; +namespace mediatimesrc_videotime; use core_tag_tag; use moodle_exception; @@ -65,7 +65,7 @@ public function __construct($record = null) { $this->content = json_decode($record->content); } - $maxbytes = get_config('mediatimesrc_file', 'maxbytes'); + $maxbytes = get_config('mediatimesrc_videotime', 'maxbytes'); if ($edit = optional_param('edit', null, PARAM_INT)) { $draftitemid = file_get_submitted_draft_itemid('videofile'); file_prepare_draft_area( @@ -76,7 +76,7 @@ public function __construct($record = null) { // form the virtual bucket that files are currently stored in // and will be copied from. $context->id, - 'mediatimesrc_file', + 'mediatimesrc_videotime', 'videofile', $edit, [ @@ -95,7 +95,7 @@ public function __construct($record = null) { // form the virtual bucket that files are currently stored in // and will be copied from. $context->id, - 'mediatimesrc_file', + 'mediatimesrc_videotime', 'posterimage', $edit, [ @@ -131,7 +131,7 @@ public function __construct($record = null) { file_save_draft_area_files( $data->videofile, $context->id, - 'mediatimesrc_file', + 'mediatimesrc_videotime', 'videofile', $data->edit, [ @@ -144,7 +144,7 @@ public function __construct($record = null) { file_save_draft_area_files( $data->posterimage, $context->id, - 'mediatimesrc_file', + 'mediatimesrc_videotime', 'posterimage', $data->edit, [ diff --git a/source/file/classes/output/media_resource.php b/source/videotime/classes/output/media_resource.php similarity index 90% rename from source/file/classes/output/media_resource.php rename to source/videotime/classes/output/media_resource.php index aee0a10..73e76c8 100644 --- a/source/file/classes/output/media_resource.php +++ b/source/videotime/classes/output/media_resource.php @@ -17,12 +17,12 @@ /** * Display a resource in the media library * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @copyright 2024 bdecent gmbh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mediatimesrc_file\output; +namespace mediatimesrc_videotime\output; use moodle_url; use stdClass; @@ -70,7 +70,7 @@ public function export_for_template(renderer_base $output) { 'libraryhome' => new moodle_url('/admin/tool/mediatime/index.php'), 'resource' => json_decode($this->record->content), 'video' => format_text( - $output->render_from_template('mediatimesrc_file/video', $content), + $output->render_from_template('mediatimesrc_videotime/video', $content), FORMAT_HTML, ['context' => $this->context] ), @@ -87,11 +87,11 @@ public function image_url($output) { $fs = get_file_storage(); $this->poster = $output->image_url('f/video', 'core'); - foreach ($fs->get_area_files($this->context->id, 'mediatimesrc_file', 'posterimage', $this->record->id) as $file) { + foreach ($fs->get_area_files($this->context->id, 'mediatimesrc_videotime', 'posterimage', $this->record->id) as $file) { if (!$file->is_directory()) { $this->poster = moodle_url::make_pluginfile_url( $this->context->id, - 'mediatimesrc_file', + 'mediatimesrc_videotime', 'posterimage', $this->record->id, $file->get_filepath(), @@ -113,11 +113,11 @@ public function video_url($output) { $this->videourl = ''; $fs = get_file_storage(); - foreach ($fs->get_area_files($this->context->id, 'mediatimesrc_file', 'videofile', $this->record->id) as $file) { + foreach ($fs->get_area_files($this->context->id, 'mediatimesrc_videotime', 'videofile', $this->record->id) as $file) { if (!$file->is_directory()) { $this->videourl = moodle_url::make_pluginfile_url( $this->context->id, - 'mediatimesrc_file', + 'mediatimesrc_videotime', 'videofile', $this->record->id, $file->get_filepath(), @@ -139,7 +139,7 @@ public function video_file_content($output) { $this->videourl = ''; $fs = get_file_storage(); - foreach ($fs->get_area_files($this->context->id, 'mediatimesrc_file', 'videofile', $this->record->id) as $file) { + foreach ($fs->get_area_files($this->context->id, 'mediatimesrc_videotime', 'videofile', $this->record->id) as $file) { if (!$file->is_directory()) { return $file->get_content(); } diff --git a/source/file/db/install.php b/source/videotime/db/install.php similarity index 92% rename from source/file/db/install.php rename to source/videotime/db/install.php index daa3dec..b6572f9 100644 --- a/source/file/db/install.php +++ b/source/videotime/db/install.php @@ -17,7 +17,7 @@ /** * Code to be executed after the plugin's database scheme has been installed is defined here. * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @category upgrade * @copyright 2024 bdecent gmbh * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -26,7 +26,7 @@ /** * Custom code to be run on installing the plugin. */ -function xmldb_mediatimesrc_file_install() { +function xmldb_mediatimesrc_videotime_install() { return true; } diff --git a/source/file/db/upgrade.php b/source/videotime/db/upgrade.php similarity index 88% rename from source/file/db/upgrade.php rename to source/videotime/db/upgrade.php index f9a273f..bcd5dd9 100644 --- a/source/file/db/upgrade.php +++ b/source/videotime/db/upgrade.php @@ -17,19 +17,19 @@ /** * Plugin upgrade steps are defined here. * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @category upgrade * @copyright 2024 bdecent gmbh * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** - * Execute mediatimesrc_file upgrade from the given old version. + * Execute mediatimesrc_videotime upgrade from the given old version. * * @param int $oldversion * @return bool */ -function xmldb_mediatimesrc_file_upgrade($oldversion) { +function xmldb_mediatimesrc_videotime_upgrade($oldversion) { global $DB; $dbman = $DB->get_manager(); diff --git a/source/file/lang/en/mediatimesrc_file.php b/source/videotime/lang/en/mediatimesrc_videotime.php similarity index 93% rename from source/file/lang/en/mediatimesrc_file.php rename to source/videotime/lang/en/mediatimesrc_videotime.php index d0018be..c32ff79 100644 --- a/source/file/lang/en/mediatimesrc_file.php +++ b/source/videotime/lang/en/mediatimesrc_videotime.php @@ -17,7 +17,7 @@ /** * Plugin strings are defined here. * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @category string * @copyright 2024 bdecent gmbh * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$string['pluginname'] = 'File resource'; +$string['pluginname'] = 'Video Time resource'; $string['posterimage'] = 'Poster image'; $string['posterimage_help'] = 'Select an image to displayed before the video is played or as a thumbnail image.'; $string['maxbytes'] = 'Maximum size of file uploads'; diff --git a/source/file/lib.php b/source/videotime/lib.php similarity index 87% rename from source/file/lib.php rename to source/videotime/lib.php index 04b8383..92d753f 100644 --- a/source/file/lib.php +++ b/source/videotime/lib.php @@ -17,7 +17,7 @@ /** * Library of interface functions and constants. * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @copyright 2022 bdecent gmbh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -38,7 +38,7 @@ * @param array $options additional options affecting the file serving * @return bool false if the file was not found, just send the file otherwise and do not return anything */ -function mediatimesrc_file_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[]) { +function mediatimesrc_videotime_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[]) { if ($context->contextlevel != CONTEXT_SYSTEM) { return false; } @@ -53,7 +53,7 @@ function mediatimesrc_file_pluginfile($course, $cm, $context, $filearea, $args, $relativepath = implode('/', $args); - $fullpath = "/$context->id/mediatimesrc_file/$filearea/$itemid/$relativepath"; + $fullpath = "/$context->id/mediatimesrc_videotime/$filearea/$itemid/$relativepath"; $fs = get_file_storage(); if ((!$file = $fs->get_file_by_hash(sha1($fullpath))) || $file->is_directory()) { @@ -69,7 +69,7 @@ function mediatimesrc_file_pluginfile($course, $cm, $context, $filearea, $args, * * @return array List of file areas */ -function mediatimesrc_file_config_file_areas() { +function mediatimesrc_videotime_config_file_areas() { return [ 'posterimage', 'videotile', diff --git a/source/file/settings.php b/source/videotime/settings.php similarity index 79% rename from source/file/settings.php rename to source/videotime/settings.php index d9ced34..9c0edc4 100644 --- a/source/file/settings.php +++ b/source/videotime/settings.php @@ -17,7 +17,7 @@ /** * Plugin administration pages are defined here. * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @category admin * @copyright 2024 bdecent gmbh * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -26,13 +26,10 @@ defined('MOODLE_INTERNAL') || die(); if ($hassiteconfig) { - $settings = new admin_settingpage('mediatimesrc_file_settings', new lang_string('pluginname', 'mediatimesrc_file')); - - if (isset($CFG->maxbytes)) { - $maxbytes = get_config('mediatimesrc_file', 'maxbytes'); + $maxbytes = get_config('mediatimesrc_videotime', 'maxbytes'); $options = get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes); - $settings->add(new admin_setting_configselect('mediatimesrc_file/maxbytes', get_string('maxbytes', 'mediatimesrc_file'), - get_string('configmaxbytes', 'mediatimesrc_file'), 0, $options)); + $settings->add(new admin_setting_configselect('mediatimesrc_videotime/maxbytes', get_string('maxbytes', 'mediatimesrc_videotime'), + get_string('configmaxbytes', 'mediatimesrc_videotime'), 0, $options)); } } diff --git a/source/file/templates/manager.mustache b/source/videotime/templates/manager.mustache similarity index 100% rename from source/file/templates/manager.mustache rename to source/videotime/templates/manager.mustache diff --git a/source/file/templates/media_resource.mustache b/source/videotime/templates/media_resource.mustache similarity index 100% rename from source/file/templates/media_resource.mustache rename to source/videotime/templates/media_resource.mustache diff --git a/source/file/templates/video.mustache b/source/videotime/templates/video.mustache similarity index 100% rename from source/file/templates/video.mustache rename to source/videotime/templates/video.mustache diff --git a/source/file/version.php b/source/videotime/version.php similarity index 92% rename from source/file/version.php rename to source/videotime/version.php index 258bba3..e304c78 100644 --- a/source/file/version.php +++ b/source/videotime/version.php @@ -17,14 +17,14 @@ /** * Plugin version and other meta-data are defined here. * - * @package mediatimesrc_file + * @package mediatimesrc_videotime * @copyright 2024 bdecent gmbh * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); -$plugin->component = 'mediatimesrc_file'; +$plugin->component = 'mediatimesrc_videotime'; $plugin->release = '1.0'; $plugin->version = 2024010800; $plugin->requires = 2022112800;