$table->data = $data; } if ($scales = grade_scale::fetch_all_global()) { $heading = $strstandardscale; $data = array(); foreach ($scales as $scale) { $line = array(); $line[] = format_string($scale->name) . '<div class="scale_options">' . str_replace(",", ", ", $scale->scale) . '</div>'; $used = $scale->is_used(); $line[] = $used ? get_string('yes') : get_string('no'); $buttons = ""; if (has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM))) { $buttons .= grade_button('edit', $courseid, $scale); } if (!$used and has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM))) { $buttons .= grade_button('delete', $courseid, $scale); } $line[] = $buttons; $data[] = $line; } $table2->head = array($strscale, $strused, $stredit); $table->attributes['class'] = 'scaletable globalscales generaltable'; $table2->size = array('70%', '20%', '10%'); $table2->align = array('left', 'center', 'center'); $table2->data = $data; } if ($courseid) { print_grade_page_head($courseid, 'scale', 'scale', get_string('coursescales', 'grades')); } echo $OUTPUT->heading($strcustomscales, 3, 'main'); echo html_writer::table($table);
} } if ($caneditthisscale) { $line[] = grade_print_scale_link($courseid, $scale, $gpr); } else { $line[] = $scale->get_name(); } } $line[] = $outcome->get_course_uses_count(); $line[] = $outcome->get_item_uses_count(); $buttons = ""; if (has_capability('moodle/grade:manage', get_context_instance(CONTEXT_SYSTEM))) { $buttons .= grade_button('edit', $courseid, $outcome); } if (has_capability('moodle/grade:manage', get_context_instance(CONTEXT_SYSTEM)) and $outcome->can_delete()) { $buttons .= grade_button('delete', $courseid, $outcome); } $line[] = $buttons; $data[] = $line; } $table = new html_table(); $table->head = array($strfullname, $strshortname, $strscale, $strcourses, $stritems, $stredit); $table->size = array('30%', '20%', '20%', '10%', '10%', '10%'); $table->align = array('left', 'left', 'left', 'center', 'center', 'center'); $table->width = '90%'; $table->data = $data; $return .= html_writer::table($table); $outcomes_tables[] = $return; } if ($courseid) { /// Print header