Skip to content

Commit

Permalink
Merge pull request #349 from Opencast-Moodle/update4.3
Browse files Browse the repository at this point in the history
Using moodle bautifier to fix at least the most obvious problem
  • Loading branch information
NinaHerrmann authored Nov 23, 2023
2 parents 4855634 + 5f3127a commit 5d744d7
Show file tree
Hide file tree
Showing 147 changed files with 3,779 additions and 3,259 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Moodle Plugin CI

########################################################################################################################

on: [push, pull_request]
on: [ push, pull_request ]

########################################################################################################################

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/moodle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Moodle Plugin Release

on:
release:
types: [published]
types: [ published ]

########################################################################################################################

Expand Down
47 changes: 28 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ moodle-block_opencast
=====================

This block can be used to link moodle courses to opencast series.
Users with respective privileges (in the following called teacher) can use this block to upload videos via moodle to opencast.
Users with respective privileges (in the following called teacher) can use this block to upload videos via moodle to
opencast.
These videos are transmitted to the opencast system by the cronjob and create a event for the respective series there.
The block can be used to automatically set the access privileges of moodle users enrolled in the course.
All events belonging to the series are displayed in the block.
All events belonging to the series are displayed in the block.
This way, the teacher gets an overview of all recorded lectures as well as planned ones.
Further, if setup correctly, the teacher is able to restrict the visibility to moodle groups or prevent access by students at all.
Further, if setup correctly, the teacher is able to restrict the visibility to moodle groups or prevent access by
students at all.

Features
------------------

* Upload videos to Opencast
* Record videos using Opencast studio
* Overview of recorded and planned videos in the course
Expand All @@ -30,7 +33,7 @@ Block overview
The block has a detail view which displays two lists of videos.
The first list shows the upload jobs which are not completed yet. The current status of the videos is shown in a column.

The second table shows all videos of the series which is associated with the block.
The second table shows all videos of the series which is associated with the block.
It is possible that the videos were uploaded by the block or that they were uploaded otherwise.
The table shows the upload date as well as the status.
Video, which are planned to be recorded in the future, are also displayed in this list.
Expand All @@ -42,55 +45,61 @@ Usage scenarios
In the following 3 use cases are described, how the plugin can be used.

### Use case 1 - Upload a video ###

The teacher of a course wants to upload the video "Lecture 1" to his Moodle course.
Prerequisite: The course page already contains an instance of the Block "Opencast Videos".

Steps to upload a video:

1. Clicking on "Add video" leads to an upload form.
2. Here the teacher can upload a video file to moodle:</br>
<img src="https://user-images.githubusercontent.com/9437254/32501009-2996085e-c3d7-11e7-9d4e-c957ba28d467.png" width="250"></br>
<img src="https://user-images.githubusercontent.com/9437254/32501009-2996085e-c3d7-11e7-9d4e-c957ba28d467.png" width="250"></br>
3. Saving the form creates an upload job, which is registered to the Upload Job Queue.</br>
<img src="https://user-images.githubusercontent.com/9437254/32501133-7da4fd56-c3d7-11e7-9c1f-fe242345e2c7.png" width="500"></br>
<img src="https://user-images.githubusercontent.com/9437254/32501133-7da4fd56-c3d7-11e7-9c1f-fe242345e2c7.png" width="500"></br>
4. The processing of a video is done during a cron job and contain the following steps:
1. A new series is created in opencast with the name which was set in the settings, if it is not yet created.
2. A new group is created in opencast with the name which was set in the settings, if it is not yet created. This step is skipped if "Create a group" is not selected in the settings.
This group control the access to the video.
2. A new group is created in opencast with the name which was set in the settings, if it is not yet created. This
step is skipped if "Create a group" is not selected in the settings.
This group control the access to the video.
3. The video is uploaded to opencast, if it does not yet exist or the config *reuseexistingupload* is false.
In this step all permanent and non-permanent ACL-Rules are assigned to the video.
In this step all permanent and non-permanent ACL-Rules are assigned to the video.
4. The group is assigned to the video.

Since most operations in the upload process are done by opencast in an asynchronous fashion, uploading a video can take multiple runs of the cronjob to finish.

Since most operations in the upload process are done by opencast in an asynchronous fashion, uploading a video can take
multiple runs of the cronjob to finish.

## Use case 2 - Change the visibility ###

The teacher of a course wants to hide an uploaded video from the students.
The (opencast) admin has definded student specific roles.

Steps to change the visibility:

1. Go to the overview section of the block.</br>
<img src="https://user-images.githubusercontent.com/9437254/46022814-9da8e180-c0e3-11e8-9040-848952089afe.png" width="500"></br>
<img src="https://user-images.githubusercontent.com/9437254/46022814-9da8e180-c0e3-11e8-9040-848952089afe.png" width="500"></br>
2. Click on the visibility icon.
3. In the visibility form the teacher can select the needed visibility state.</br>
<img src="https://user-images.githubusercontent.com/9437254/46023014-01cba580-c0e4-11e8-9fe4-d8688cde1423.png" width="500"></br>
<img src="https://user-images.githubusercontent.com/9437254/46023014-01cba580-c0e4-11e8-9fe4-d8688cde1423.png" width="500"></br>
4. The processing of the video starts:
1. The ACL-Roles of the video are changed and updated in Opencast.
2. A workflow (must be defined in the settings) is started which refreshes the metadata.

## Use case 3 - Linking a recorded series ###

A teacher wants to link an existing series to his moodle course and control the access to these videos using the list of students in his moodle course.
A teacher wants to link an existing series to his moodle course and control the access to these videos using the list of
students in his moodle course.
For this the series id has to be reference in the block.

1. Go to the overview section of the block.
2. Go to "Edit series mapping".</br>
<img src="https://user-images.githubusercontent.com/9437254/46022815-9da8e180-c0e3-11e8-969c-15e0bbab4417.png" width="500"></br>
<img src="https://user-images.githubusercontent.com/9437254/46022815-9da8e180-c0e3-11e8-969c-15e0bbab4417.png" width="500"></br>
3. Enter the series id and save the form.
4. Now all videos of the series should be displayed in the block and the visibility of them can be adjusted.

## Documentation ##
The full documentation is available at [https://moodle.docs.opencast.org/#block/about/](https://moodle.docs.opencast.org/#block/about/).

The full documentation is available
at [https://moodle.docs.opencast.org/#block/about/](https://moodle.docs.opencast.org/#block/about/).

## License ##

Expand All @@ -105,7 +114,7 @@ version.

This program 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.
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
this program. If not, see <http://www.gnu.org/licenses/>.
this program. If not, see <http://www.gnu.org/licenses/>.
37 changes: 22 additions & 15 deletions addactivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,29 @@
* @copyright 2020 Alexander Bias, Ulm University <[email protected]>, 2021 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use block_opencast\local\activitymodulemanager;
use block_opencast\local\addactivity_form;
use block_opencast\local\apibridge;
use core\output\notification;
use tool_opencast\local\settings_api;

require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG, $USER;

$courseid = required_param('courseid', PARAM_INT);
$ocinstanceid = optional_param('ocinstanceid', \tool_opencast\local\settings_api::get_default_ocinstance()->id, PARAM_INT);
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
$seriesid = required_param('seriesid', PARAM_ALPHANUMEXT);
$submitbutton2 = optional_param('submitbutton2', '', PARAM_ALPHA);

$baseurl = new moodle_url('/blocks/opencast/addactivity.php',
array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid, 'seriesid' => $seriesid));
['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid, 'seriesid' => $seriesid]);
$PAGE->set_url($baseurl);

$redirecturloverview = new moodle_url('/blocks/opencast/index.php',
array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
$redirecturlcourse = new moodle_url('/course/view.php', array('id' => $courseid));
['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$redirecturlcourse = new moodle_url('/course/view.php', ['id' => $courseid]);

require_login($courseid, false);

Expand All @@ -47,7 +54,7 @@
$PAGE->navbar->add(get_string('addactivity_addbuttontitle', 'block_opencast'), $baseurl);

// Check if the Opencast Activity module feature is enabled and working.
if (\block_opencast\local\activitymodulemanager::is_enabled_and_working_for_series($ocinstanceid) == false) {
if (activitymodulemanager::is_enabled_and_working_for_series($ocinstanceid) == false) {
throw new moodle_exception('add opencast activity series module not enabled or working',
'block_opencast', $redirecturloverview);
}
Expand All @@ -57,18 +64,18 @@
require_capability('block/opencast:addactivity', $coursecontext);

// Existing Opencast Activity module check.
$moduleid = \block_opencast\local\activitymodulemanager::get_module_for_series($ocinstanceid, $courseid, $seriesid);
$moduleid = activitymodulemanager::get_module_for_series($ocinstanceid, $courseid, $seriesid);
if ($moduleid) {
// Redirect to Opencast videos overview page.
redirect($redirecturloverview,
get_string('addactivity_moduleexists', 'block_opencast'), null,
\core\output\notification::NOTIFY_WARNING);
notification::NOTIFY_WARNING);
}

$addactivityform = new \block_opencast\local\addactivity_form(null,
array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid, 'seriesid' => $seriesid));
$addactivityform = new addactivity_form(null,
['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid, 'seriesid' => $seriesid]);

$apibridge = \block_opencast\local\apibridge::get_instance($ocinstanceid);
$apibridge = apibridge::get_instance($ocinstanceid);

if ($addactivityform->is_cancelled()) {
redirect($redirecturloverview);
Expand Down Expand Up @@ -118,11 +125,11 @@
redirect($redirecturloverview,
get_string('series_not_found', 'block_opencast', $data->seriesid),
null,
\core\output\notification::NOTIFY_ERROR);
notification::NOTIFY_ERROR);
}

// Create the module.
$result = \block_opencast\local\activitymodulemanager::create_module_for_series($courseid, $ocinstanceid,
$result = activitymodulemanager::create_module_for_series($courseid, $ocinstanceid,
$data->title, $seriesid, $sectionid, $introtext, $introformat, $availability, $data->allowdownload);

// Check if the module was created successfully.
Expand All @@ -133,15 +140,15 @@
redirect($redirecturlcourse,
get_string('addactivity_modulecreated', 'block_opencast', $data->title),
null,
\core\output\notification::NOTIFY_SUCCESS);
notification::NOTIFY_SUCCESS);

// Form was submitted with first submit button.
} else {
// Redirect to Opencast videos overview page.
redirect($redirecturloverview,
get_string('addactivity_modulecreated', 'block_opencast', $data->title),
null,
\core\output\notification::NOTIFY_SUCCESS);
notification::NOTIFY_SUCCESS);
}

// Otherwise.
Expand All @@ -150,7 +157,7 @@
redirect($redirecturloverview,
get_string('addactivity_modulenotcreated', 'block_opencast', $data->title),
null,
\core\output\notification::NOTIFY_ERROR);
notification::NOTIFY_ERROR);
}
}

Expand Down
32 changes: 19 additions & 13 deletions addactivityepisode.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,28 @@
* @copyright 2020 Alexander Bias, Ulm University <[email protected]>, 2021 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use block_opencast\local\activitymodulemanager;
use block_opencast\local\addactivityepisode_form;
use core\output\notification;
use tool_opencast\local\settings_api;

require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG;

$episodeuuid = required_param('episodeuuid', PARAM_ALPHANUMEXT);
$courseid = required_param('courseid', PARAM_INT);
$submitbutton2 = optional_param('submitbutton2', '', PARAM_ALPHA);
$ocinstanceid = optional_param('ocinstanceid', \tool_opencast\local\settings_api::get_default_ocinstance()->id, PARAM_INT);
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);

$baseurl = new moodle_url('/blocks/opencast/addactivityepisode.php',
array('episodeuuid' => $episodeuuid, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
['episodeuuid' => $episodeuuid, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);

$redirecturloverview = new moodle_url('/blocks/opencast/index.php',
array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
$redirecturlcourse = new moodle_url('/course/view.php', array('id' => $courseid));
['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$redirecturlcourse = new moodle_url('/course/view.php', ['id' => $courseid]);

require_login($courseid, false);

Expand All @@ -47,7 +53,7 @@
$PAGE->navbar->add(get_string('addactivityepisode_addicontitle', 'block_opencast'), $baseurl);

// Check if the Opencast Activity module feature is enabled and working.
if (\block_opencast\local\activitymodulemanager::is_enabled_and_working_for_episodes($ocinstanceid) == false) {
if (activitymodulemanager::is_enabled_and_working_for_episodes($ocinstanceid) == false) {
throw new moodle_exception('add opencast activity episode module not enabled or working',
'block_opencast', $redirecturloverview);
}
Expand All @@ -57,15 +63,15 @@
require_capability('block/opencast:addactivityepisode', $coursecontext);

// Existing Opencast Activity module check.
$moduleid = \block_opencast\local\activitymodulemanager::get_module_for_episode($courseid, $episodeuuid, $ocinstanceid);
$moduleid = activitymodulemanager::get_module_for_episode($courseid, $episodeuuid, $ocinstanceid);
if ($moduleid) {
// Redirect to Opencast videos overview page.
redirect($redirecturloverview,
get_string('addactivityepisode_moduleexists', 'block_opencast'), null, \core\output\notification::NOTIFY_WARNING);
get_string('addactivityepisode_moduleexists', 'block_opencast'), null, notification::NOTIFY_WARNING);
}

$addactivityform = new \block_opencast\local\addactivityepisode_form(null,
array('episodeuuid' => $episodeuuid, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
$addactivityform = new addactivityepisode_form(null,
['episodeuuid' => $episodeuuid, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);

if ($addactivityform->is_cancelled()) {
redirect($redirecturloverview);
Expand Down Expand Up @@ -110,7 +116,7 @@
}

// Create the module.
$result = \block_opencast\local\activitymodulemanager::create_module_for_episode($courseid, $ocinstanceid,
$result = activitymodulemanager::create_module_for_episode($courseid, $ocinstanceid,
$data->title, $episodeuuid, $sectionid, $introtext, $introformat, $availability, $data->allowdownload);

// Check if the module was created successfully.
Expand All @@ -121,15 +127,15 @@
redirect($redirecturlcourse,
get_string('addactivityepisode_modulecreated', 'block_opencast', $data->title),
null,
\core\output\notification::NOTIFY_SUCCESS);
notification::NOTIFY_SUCCESS);

// Form was submitted with first submit button.
} else {
// Redirect to Opencast videos overview page.
redirect($redirecturloverview,
get_string('addactivityepisode_modulecreated', 'block_opencast', $data->title),
null,
\core\output\notification::NOTIFY_SUCCESS);
notification::NOTIFY_SUCCESS);
}

// Otherwise.
Expand All @@ -138,7 +144,7 @@
redirect($redirecturloverview,
get_string('addactivityepisode_modulenotcreated', 'block_opencast', $data->title),
null,
\core\output\notification::NOTIFY_ERROR);
notification::NOTIFY_ERROR);
}
}

Expand Down
Loading

0 comments on commit 5d744d7

Please sign in to comment.