From: nicolasconnault Date: Fri, 17 Oct 2008 14:03:28 +0000 (+0000) Subject: MDL-16917 Fixed Merged from MOODLE_19_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=976bf10efa06db62f1d0e222f04e1b7675d8ca7e;p=moodle.git MDL-16917 Fixed Merged from MOODLE_19_STABLE --- diff --git a/grade/edit/tree/outcomeitem.php b/grade/edit/tree/outcomeitem.php index c77ea41748..e821393fa0 100644 --- a/grade/edit/tree/outcomeitem.php +++ b/grade/edit/tree/outcomeitem.php @@ -215,6 +215,12 @@ $navigation = grade_build_nav(__FILE__, $stroutcome, array('courseid' => $course print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $stroutcomesedit, $navigation, '', '', true, '', navmenu($course)); +if (!$outcomes = grade_outcome::fetch_all_available($COURSE->id)) { + notice_yesno(get_string('nooutcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$courseid, $returnurl); + print_footer($course); + die(); +} + $mform->display(); print_footer($course); diff --git a/grade/edit/tree/outcomeitem_form.php b/grade/edit/tree/outcomeitem_form.php index 6b0178185e..0a405753c3 100644 --- a/grade/edit/tree/outcomeitem_form.php +++ b/grade/edit/tree/outcomeitem_form.php @@ -57,8 +57,9 @@ class edit_outcomeitem_form extends moodleform { $options = array(0=>get_string('none')); if ($coursemods = get_course_mods($COURSE->id)) { foreach ($coursemods as $coursemod) { - $mod = get_coursemodule_from_id($coursemod->modname, $coursemod->id); - $options[$coursemod->id] = format_string($mod->name); + if ($mod = get_coursemodule_from_id($coursemod->modname, $coursemod->id)) { + $options[$coursemod->id] = format_string($mod->name); + } } } $mform->addElement('select', 'cmid', get_string('linkedactivity', 'grades'), $options); diff --git a/lang/en_utf8/grades.php b/lang/en_utf8/grades.php index 7ddeac3b12..64e85395e1 100644 --- a/lang/en_utf8/grades.php +++ b/lang/en_utf8/grades.php @@ -347,6 +347,7 @@ $string['nonnumericweight'] = 'Received non-numeric value for'; $string['nonunlockableverbose'] = 'This grade cannot be unlocked until $a->itemname is unlocked.'; $string['nonweightedpct'] = 'non-weighted %%'; $string['nooutcome'] = 'No outcome'; +$string['nooutcomes'] = 'Outcome items must be linked to a course outcome, but there are no outcomes for this course. Would you like to add one?'; $string['nopublish'] = 'Do not publish'; $string['noselectedcategories'] = 'no categories were selected.'; $string['noselecteditems'] = 'no items were selected.';