diff --git a/forms/executionoptions.php b/forms/executionoptions.php index 344f375f9a128491f922ad7fd800b5cb9cb6d1bd..20591a9c7b9d4d5213200e42de79583b16e223a5 100644 --- a/forms/executionoptions.php +++ b/forms/executionoptions.php @@ -109,6 +109,12 @@ class mod_vpl_executionoptions_form extends moodleform { } asort( $basedonlist ); $basedonlist [0] = get_string( 'select' ); + if (!in_array($instance->basedon, array_keys($basedonlist))) { + $basedonvpl = new mod_vpl(null, $instance->basedon); + $basedonlist[$instance->basedon] = $basedonvpl->get_printable_name(); + $warning = '<i class="icon fa fa-warning text-warning fa-fw" title="' . get_string('basedonwarning', VPL) . '"></i>'; + $strbasedon .= '<span class="float-sm-right">' . $warning . '</span>'; + } $mform->addElement( 'select', 'basedon', $strbasedon, $basedonlist ); $mform->setDefault( 'basedon', $instance->basedon ); @@ -167,7 +173,7 @@ if ($fromform = $mform->get_data()) { $instance->evaluateonsubmission = $fromform->evaluate && $fromform->evaluateonsubmission; $instance->automaticgrading = $fromform->evaluate && $fromform->automaticgrading; if ( $vpl->update() ) { - vpl_notice( get_string( 'optionssaved', VPL ) ); + vpl_redirect( vpl_mod_href('view.php', 'id', $id), get_string( 'optionssaved', VPL ), 'success' ); } else { vpl_notice( get_string( 'optionsnotsaved', VPL ), 'error' ); } diff --git a/lang/en/vpl.php b/lang/en/vpl.php index 9a93fdd42d7077fb7f695f70e4d321bcd175e231..da11daa3b2c599071345960727a1091ca294e40b 100644 --- a/lang/en/vpl.php +++ b/lang/en/vpl.php @@ -34,6 +34,9 @@ $string ['automaticgrading'] = 'Automatic grade'; $string ['averageperiods'] = 'Average periods {$a}'; $string ['averagetime'] = 'Average time {$a}'; $string ['basedon'] = 'Based on'; +$string ['basedonwarning'] = 'It seems you do not have the rights on the VPL this VPL is based on. +The based on mechanism will still work. +However, please note that if you change it, you will not be able to change it back to its current state.'; $string ['basic'] = 'Basic'; $string ['binaryfile'] = 'Binary File'; $string ['browserupdate'] = 'Please update your browser to the last version<br />or use another that supports Websocket.';