diff --git a/.github/workflows/config.json b/.github/workflows/config.json new file mode 100644 index 0000000..e4f2bee --- /dev/null +++ b/.github/workflows/config.json @@ -0,0 +1,11 @@ +{ + "main-moodle": "MOODLE_405_STABLE", + "main-php": "8.3", + "main-oc": "16.6", + "ocs": ["16.6", "15.11"], + "main-db": "mariadb", + "moodle-php": { + "MOODLE_405_STABLE": ["8.1", "8.2"] + }, + "moodle-plugin-ci": "4.4.5" +} diff --git a/.github/workflows/config_all.json b/.github/workflows/config_all.json new file mode 100644 index 0000000..558800c --- /dev/null +++ b/.github/workflows/config_all.json @@ -0,0 +1,15 @@ +{ + "main-moodle": "MOODLE_405_STABLE", + "main-php": "8.3", + "main-oc": "16.6", + "ocs": ["16.6", "15.11"], + "main-db": "mariadb", + "moodle-php": { + "MOODLE_401_STABLE": ["7.4", "8.0", "8.1"], + "MOODLE_402_STABLE": ["8.0", "8.1", "8.2"], + "MOODLE_403_STABLE": ["8.0", "8.1", "8.2"], + "MOODLE_404_STABLE": ["8.1", "8.2", "8.3"], + "MOODLE_405_STABLE": ["8.1", "8.2", "8.3"] + }, + "moodle-plugin-ci": "4.4.5" +} diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index cfca639..103d321 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -2,13 +2,13 @@ name: Moodle Plugin CI ######################################################################################################################## -on: [push, pull_request] +on: [ push, pull_request ] ######################################################################################################################## jobs: call-moodle-ci-workflow: - uses: Opencast-Moodle/moodle-workflows-opencast/.github/workflows/moodle-ci.yml@master + uses: Opencast-Moodle/moodle-workflows-opencast/.github/workflows/moodle-ci.yml@main with: requires-tool-plugin: true branch-tool-plugin: master \ No newline at end of file diff --git a/classes/local/output_helper.php b/classes/local/output_helper.php index 97d3606..cd678e5 100644 --- a/classes/local/output_helper.php +++ b/classes/local/output_helper.php @@ -128,6 +128,13 @@ public static function output_episode($ocinstanceid, $episodeid, $modinstanceid, echo \html_writer::script('window.episode = ' . json_encode($data)); echo '
'; + // Show error if there are no streams. + if (count($data['streams']) === 0) { + \core\notification::error(get_string('erroremptystreamsources', 'mod_opencast')); + echo $OUTPUT->footer(); + return; + } + // Find aspect-ratio if there is only one video track. if (count($data['streams']) === 1 && !empty($data['streams'][0]['sources'])) { $sources = $data['streams'][0]['sources']; @@ -135,7 +142,6 @@ public static function output_episode($ocinstanceid, $episodeid, $modinstanceid, $resolution = $res['w'] . '/' . $res['h']; echo \html_writer::start_div('player-wrapper', ['style' => '--aspect-ratio:' . $resolution]); } else { - \core\notification::error(get_string('erroremptystreamsources', 'mod_opencast')); echo \html_writer::start_div('player-wrapper'); } @@ -170,7 +176,7 @@ public static function output_download_menu($ocinstanceid, $episodeid, $modinsta // Get the action menu options. $actionmenu = new action_menu(); - $actionmenu->set_alignment(action_menu::TL, action_menu::BL); + $actionmenu->set_menu_left(); $actionmenu->prioritise = true; $actionmenu->actionicon = new pix_icon('t/down', get_string('downloadvideo', 'mod_opencast')); $actionmenu->actiontext = 'Download'; diff --git a/lang/en/opencast.php b/lang/en/opencast.php index e77c52e..bf16f70 100644 --- a/lang/en/opencast.php +++ b/lang/en/opencast.php @@ -23,6 +23,10 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +// Let codechecker ignore some sniffs for this file as it is partly ordered semantically instead of alphabetically. +// phpcs:disable moodle.Files.LangFilesOrdering.UnexpectedComment +// phpcs:disable moodle.Files.LangFilesOrdering.IncorrectOrder + defined('MOODLE_INTERNAL') || die(); $string['advancedsettings'] = 'Advanced settings'; diff --git a/lib.php b/lib.php index 01b24ff..aed8be8 100644 --- a/lib.php +++ b/lib.php @@ -40,6 +40,7 @@ function opencast_supports($feature) { case FEATURE_MOD_INTRO: case FEATURE_SHOW_DESCRIPTION: case FEATURE_BACKUP_MOODLE2: + case FEATURE_COMPLETION_TRACKS_VIEWS: return true; default: return null; diff --git a/version.php b/version.php index 76dcb62..1b6e743 100644 --- a/version.php +++ b/version.php @@ -18,6 +18,7 @@ * Plugin version and other meta-data are defined here. * * @package mod_opencast + * @copyright 2024 Thomas Niedermaier * @copyright 2020 Tobias Reischmann * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -25,10 +26,10 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'mod_opencast'; -$plugin->release = 'v4.4-r1'; -$plugin->version = 2024060400; -$plugin->requires = 2022112800; // Requires Moodle 4.1+. +$plugin->release = 'v4.5-r1'; +$plugin->version = 2024111100; +$plugin->requires = 2024100700; // Requires Moodle 4.5+. $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ - 'tool_opencast' => 2024060400, + 'tool_opencast' => 2024111100, ]; diff --git a/view.php b/view.php index c33a8a7..141d5f3 100644 --- a/view.php +++ b/view.php @@ -29,6 +29,7 @@ require_once(__DIR__ . '/lib.php'); require_once($CFG->dirroot . '/course/modlib.php'); require_once($CFG->libdir . '/gradelib.php'); +require_once($CFG->libdir.'/completionlib.php'); global $OUTPUT, $DB, $PAGE; @@ -86,6 +87,10 @@ $event->add_record_snapshot('opencast', $moduleinstance); $event->trigger(); +// Completion. +$completion = new completion_info($course); +$completion->set_module_viewed($cm); + if ($moduleinstance->type == opencasttype::EPISODE) { output_helper::output_episode($moduleinstance->ocinstanceid, $moduleinstance->opencastid, $moduleinstance->id); } else if ($moduleinstance->type == opencasttype::SERIES) {