From fc61f64b724a8f2922dc31cb12df5f9725887491 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Wed, 25 Jul 2007 08:57:59 +0000 Subject: [PATCH] some fixes for grade outcomes --- grade/report/outcomes/course.php | 18 +++++++++--------- grade/report/outcomes/site.php | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/grade/report/outcomes/course.php b/grade/report/outcomes/course.php index 6419a9b758..95a60863b6 100755 --- a/grade/report/outcomes/course.php +++ b/grade/report/outcomes/course.php @@ -85,9 +85,9 @@ print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, '' /// listing of all site outcomes + this course specific outcomes $outcomes = get_records_sql('SELECT * FROM '.$CFG->prefix.'grade_outcomes - WHERE courseid < 1'); - + WHERE ISNULL(courseid)'); + // outcomes used in this course $courseoutcomes = get_records_sql('SELECT go.id, go.fullname FROM '.$CFG->prefix.'grade_outcomes_courses goc, '.$CFG->prefix.'grade_outcomes go @@ -99,7 +99,7 @@ print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, '' } elseif ($mcourseoutcomes = get_records('grade_outcomes', 'courseid', $courseid)) { $courseoutcomes += $mcourseoutcomes; } - + check_theme_arrows(); include_once('course.html'); @@ -129,25 +129,25 @@ print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, '' $table->setup(); - foreach ($outcomes as $outcome) { + while ($outcome = rs_fetch_next_record($outcomes)) { $data = array(); // full name of the outcome - $data[] = $outcome['fullname']; + $data[] = $outcome->fullname; // full name of the scale used by this outcomes - $scale= get_record('scale', 'id', $outcome['scaleid']); + $scale= get_record('scale', 'id', $outcome->scaleid); $data[] = $scale->name; if (has_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_COURSE, $courseid))) { // add operations - $data[] = 'Update - Delete'; // icons and links + $data[] = 'Update + Delete'; // icons and links } else { $data[] = ''; } // num of gradeitems using this - $num = count_records('grade_items', 'outcomeid' ,$outcome['id']); + $num = count_records('grade_items', 'outcomeid' ,$outcome->id); $data[] = (int) $num; // num of courses using this outcome diff --git a/grade/report/outcomes/site.php b/grade/report/outcomes/site.php index 22ed25dd86..9562abdcec 100755 --- a/grade/report/outcomes/site.php +++ b/grade/report/outcomes/site.php @@ -79,19 +79,19 @@ $perpage = 30; $table->setup(); - foreach ($outcomes as $outcome) { + while ($outcome = rs_fetch_next_record($outcomes)) { $data = array(); // full name of the outcome - $data[] = $outcome['fullname']; + $data[] = $outcome->fullname; // full name of the scale used by this outcomes - $scale= get_record('scale', 'id', $outcome['scaleid']); + $scale= get_record('scale', 'id', $outcome->scaleid); $data[] = $scale->name; // get course - if ($outcome['courseid']) { - $course = get_record('course', 'id', $outcome['courseid']); + if ($outcome->courseid) { + $course = get_record('course', 'id', $outcome->courseid); $data[] = $course->shortname; } else { $data[] = get_string('site'); @@ -100,18 +100,18 @@ $perpage = 30; // add operations if (has_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_SYSTEM))) { - $data[] = 'Update - Delete'; // icons and links + $data[] = 'Update + Delete'; // icons and links } else { $data[] = ''; } // num of gradeitems using this - $num = count_records('grade_items', 'outcomeid' ,$outcome['id']); + $num = count_records('grade_items', 'outcomeid' ,$outcome->id); $data[] = (int) $num; // num of courses using this outcome - $num = count_records('grade_outcomes_courses', 'outcomeid', $outcome['id']); + $num = count_records('grade_outcomes_courses', 'outcomeid', $outcome->id); $data[] = (int) $num; $table->add_data($data); -- 2.39.5