MDL-15688: Fix to make it work with IE (it was already doing fine in Firefox, Safari...
[moodle.git] / course / scales.php
CommitLineData
24f2b65a 1<?php // $Id$
a57319b1 2 // Allows a creator to edit custom scales, and also display help about scales
3
9c002633 4 require_once("../config.php");
5 require_once("lib.php");
a57319b1 6
78ad5f3f 7 $id = required_param('id', PARAM_INT); // course id
a57319b1 8
579d45b4 9 if (!$course = $DB->get_record('course', array('id'=>$id))) {
ba6018a9 10 print_error("invalidcourseid");
a57319b1 11 }
12
78ad5f3f 13 require_login($course);
61240489 14 $context = get_context_instance(CONTEXT_COURSE, $course->id);
78ad5f3f 15 require_capability('moodle/course:viewscales', $context);
a57319b1 16
17 $strscale = get_string("scale");
18 $strscales = get_string("scales");
9c002633 19 $strcustomscale = get_string("scalescustom");
20 $strstandardscale = get_string("scalesstandard");
a57319b1 21 $strcustomscales = get_string("scalescustom");
22 $strstandardscales = get_string("scalesstandard");
23 $strname = get_string("name");
24 $strdescription = get_string("description");
9c002633 25 $strhelptext = get_string("helptext");
26 $stractivities = get_string("activities");
9c002633 27
ed040b1f 28
78ad5f3f 29 print_header($strscales);
9c002633 30
6bb08163 31 if ($scales = $DB->get_records("scale", array("courseid"=>$course->id), "name ASC")) {
78ad5f3f 32 print_heading($strcustomscales);
0ae88327 33
78ad5f3f 34 if (has_capability('moodle/course:managescales', $context)) {
35 echo "<p align=\"center\">(";
36 print_string("scalestip");
37 echo ")</p>";
9c002633 38 }
39
78ad5f3f 40 foreach ($scales as $scale) {
41 $scalemenu = make_menu_from_list($scale->scale);
92604dbc 42
78ad5f3f 43 print_simple_box_start("center");
44 print_heading($scale->name);
45 echo "<center>";
46 choose_from_menu($scalemenu, "", "", "");
47 echo "</center>";
48 echo text_to_html($scale->description);
49 print_simple_box_end();
50 echo "<hr />";
9c002633 51 }
52
78ad5f3f 53 } else {
54 if (has_capability('moodle/course:managescales', $context)) {
55 echo "<p align=\"center\">(";
56 print_string("scalestip");
57 echo ")</p>";
9c002633 58 }
9c002633 59 }
60
6bb08163 61 if ($scales = $DB->get_records("scale", array("courseid"=>0), "name ASC")) {
78ad5f3f 62 print_heading($strstandardscales);
63 foreach ($scales as $scale) {
64 $scalemenu = make_menu_from_list($scale->scale);
9c002633 65
78ad5f3f 66 print_simple_box_start("center");
67 print_heading($scale->name);
68 echo "<center>";
69 choose_from_menu($scalemenu, "", "", "");
70 echo "</center>";
71 echo text_to_html($scale->description);
72 print_simple_box_end();
73 echo "<hr />";
9c002633 74 }
75 }
76
78ad5f3f 77 close_window_button();
78 exit;
a57319b1 79
80?>