Skip to content

Commit

Permalink
Merge pull request #365 from Opencast-Moodle/363-throw-error
Browse files Browse the repository at this point in the history
Adjust handling in case $series && $courseid != $SITE->id
  • Loading branch information
NinaHerrmann authored Mar 18, 2024
2 parents bf56dc3 + 6bf7fa7 commit e22355f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions addvideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@
require_once($CFG->dirroot . '/repository/lib.php');

$courseid = required_param('courseid', PARAM_INT);
if ($courseid == $SITE->id) {
$series = optional_param('series', null, PARAM_ALPHANUMEXT);
} else {
$series = null;
$series = optional_param('intoseries', null, PARAM_ALPHANUMEXT);
if ($series && $courseid != $SITE->id) {
throw new coding_exception('intoseries parameter is not allowed in connection with a non-frontpage course.');
}
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);

Expand All @@ -47,7 +46,7 @@
'courseid' => $courseid,
];
if ($series) {
$baseurlparams['series'] = $series;
$baseurlparams['intoseries'] = $series;
}
$baseurl = new moodle_url('/blocks/opencast/addvideo.php', $baseurlparams);

Expand Down Expand Up @@ -121,12 +120,12 @@
$usereventdefaults = (!empty($userdefaults['event'])) ? $userdefaults['event'] : [];

if ($series) {
$addvideoform = new addvideo_form(null,
$addvideoform = new addvideo_form($PAGE->url,
['courseid' => $courseid, 'metadata_catalog' => $metadatacatalog,
'eventdefaults' => $usereventdefaults, 'ocinstanceid' => $ocinstanceid, 'series' => $series, ]
);
} else {
$addvideoform = new addvideo_form(null,
$addvideoform = new addvideo_form($PAGE->url,
['courseid' => $courseid, 'metadata_catalog' => $metadatacatalog,
'eventdefaults' => $usereventdefaults, 'ocinstanceid' => $ocinstanceid, ]
);
Expand Down
2 changes: 1 addition & 1 deletion overview_videos.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@

// Show "Add video" button.
$addvideourl = new moodle_url('/blocks/opencast/addvideo.php', ['courseid' => $SITE->id,
'ocinstanceid' => $ocinstanceid, 'series' => $series, ]);
'ocinstanceid' => $ocinstanceid, 'intoseries' => $series, ]);
$addvideobutton = $OUTPUT->single_button($addvideourl, get_string('addvideo', 'block_opencast'), 'get');
echo html_writer::div($addvideobutton);

Expand Down

0 comments on commit e22355f

Please sign in to comment.