$PAGE->set_url('/cohort/assign.php', array('id'=>$id));
$PAGE->set_Context($context);
+$returnurl = new moodle_url('/cohort/index.php', array('contextid'=>$cohort->contextid));
+
+if (!empty($cohort->component)) {
+ // we can not manually edit cohorts that were created by external systems, sorry
+ redirect($returnurl);
+}
+
if (optional_param('cancel', false, PARAM_BOOL)) {
- redirect(new moodle_url('/cohort/index.php', array('contextid'=>$cohort->contextid)));
+ redirect($returnurl);
}
if ($context->contextlevel == CONTEXT_COURSECAT) {
$returnurl = new moodle_url('/cohort/index.php', array('contextid'=>$context->id));
+if (!empty($cohort->component)) {
+ // we can not manually edit cohorts that were created by external systems, sorry
+ redirect($returnurl);
+}
+
$PAGE->set_context($context);
$PAGE->set_url('/cohort/edit.php', array('contextid'=>$context->id, 'id'=>$cohort->id));
$PAGE->set_context($context);