]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16917 Fixed Merged from MOODLE_19_STABLE
authornicolasconnault <nicolasconnault>
Fri, 17 Oct 2008 14:03:28 +0000 (14:03 +0000)
committernicolasconnault <nicolasconnault>
Fri, 17 Oct 2008 14:03:28 +0000 (14:03 +0000)
grade/edit/tree/outcomeitem.php
grade/edit/tree/outcomeitem_form.php
lang/en_utf8/grades.php

index c77ea41748a171850f6eae4bb55e15db44f170f7..e821393fa0438aa27b36508d2760c94562d8d3ac 100644 (file)
@@ -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);
index 6b0178185ea846918e6dd4e57b3968744df01813..0a405753c3ed72f4a4bb0563249987a5ba73c5d1 100644 (file)
@@ -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);
index 7ddeac3b127ad9e857de6dcde991eb42341b5261..64e85395e19f6478b4a92a17b7a61f07b2784125 100644 (file)
@@ -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.';