print_error('badcontext', null, $return_course);
}
$sc_obj = new mod_opencast_series();
$sc_obj->fetch($opencast->id);
$sc_clip = new mod_opencast_event($sc_obj, $clip_identifier, false, $opencast->id);
// Perform action ?
if (in_array($action, ['edit']) && confirm_sesskey() && has_capability('mod/opencast:isproducer', $context)) {
    /*
     * $confirm
     * AND sesskey() ok
     * AND has producer rights
     */
    if ($action === 'edit') {
        $sc_clip->setTitle(optional_param('title', $sc_clip->getTitle(), PARAM_RAW_TRIMMED));
        $sc_clip->setSubtitle(optional_param('subtitle', $sc_clip->getSubtitle(), PARAM_RAW_TRIMMED));
        $sc_clip->setPresenter(optional_param('presenter', $sc_clip->getPresenter(), PARAM_RAW_TRIMMED));
        $sc_clip->setLocation(optional_param('location', $sc_clip->getLocation(), PARAM_RAW_TRIMMED));
        if ($userid !== 0) {
            if ($userid == -1) {
                $sc_clip->setOwner('');
            } else {
                $sc_user = new mod_opencast_user(null, $userid);
                $newowner_aaiUniqueId = $sc_user->getExternalAccount();
                if ($newowner_aaiUniqueId) {
                    $newowner = new mod_opencast_user($newowner_aaiUniqueId);
                    $sc_clip->setOwner($newowner_aaiUniqueId);
                    $sc_clip->update();
                } else {
                    print_error('owner_no_switch_account', 'opencast', $url, $setuser->lastname . ', ' . $setuser->firstname);
                }
            }