MDL-34462 cohort: remove uncessary MUST_EXIST params

(its now the default)
This commit is contained in:
Dan Poltawski 2012-07-24 15:23:07 +08:00
parent e0bbad5bf9
commit abdf2b675b
2 changed files with 4 additions and 4 deletions

View File

@ -98,7 +98,7 @@ class cohort_edit_form extends moodleform {
$options[$syscontext->id] = print_context_name($syscontext);
}
foreach ($displaylist as $cid=>$name) {
$context = context_coursecat::instance($cid, MUST_EXIST);
$context = context_coursecat::instance($cid);
$options[$context->id] = $name;
}
// always add current - this is not likely, but if the logic gets changed it might be a problem

View File

@ -110,10 +110,10 @@ function cohort_delete_category($category) {
global $DB;
// TODO: make sure that cohorts are really, really not used anywhere and delete, for now just move to parent or system context
$oldcontext = context_coursecat::instance($category->id, MUST_EXIST);
$oldcontext = context_coursecat::instance($category->id);
if ($category->parent and $parent = $DB->get_record('course_categories', array('id'=>$category->parent))) {
$parentcontext = context_coursecat::instance($parent->id, MUST_EXIST);
$parentcontext = context_coursecat::instance($parent->id);
$sql = "UPDATE {cohort} SET contextid = :newcontext WHERE contextid = :oldcontext";
$params = array('oldcontext'=>$oldcontext->id, 'newcontext'=>$parentcontext->id);
} else {
@ -165,7 +165,7 @@ function cohort_remove_member($cohortid, $userid) {
function cohort_get_visible_list($course) {
global $DB, $USER;
$context = context_course::instance($course->id, MUST_EXIST);
$context = context_course::instance($course->id);
list($esql, $params) = get_enrolled_sql($context);
$parentsql = get_related_contexts_string($context);