MDL-10092:
[moodle-linuxchix.git] / course / scales.php
blob3759a1f45e47eac92030a60208507c7a5da98fdf
1 <?php // $Id$
2 // Allows a creator to edit custom scales, and also display help about scales
4 require_once("../config.php");
5 require_once("lib.php");
7 $id = required_param('id', PARAM_INT); // course id
9 if (! $course = get_record("course", "id", $id)) {
10 error("Course ID was incorrect");
13 require_login($course);
14 $context = get_context_instance(CONTEXT_COURSE, $course->id);
15 require_capability('moodle/course:viewscales', $context);
17 $strscale = get_string("scale");
18 $strscales = get_string("scales");
19 $strcustomscale = get_string("scalescustom");
20 $strstandardscale = get_string("scalesstandard");
21 $strcustomscales = get_string("scalescustom");
22 $strstandardscales = get_string("scalesstandard");
23 $strname = get_string("name");
24 $strdescription = get_string("description");
25 $strhelptext = get_string("helptext");
26 $stractivities = get_string("activities");
29 print_header($strscales);
31 if ($scales = get_records("scale", "courseid", "$course->id", "name ASC")) {
32 print_heading($strcustomscales);
34 if (has_capability('moodle/course:managescales', $context)) {
35 echo "<p align=\"center\">(";
36 print_string("scalestip");
37 echo ")</p>";
40 foreach ($scales as $scale) {
41 $scalemenu = make_menu_from_list($scale->scale);
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 />";
53 } else {
54 if (has_capability('moodle/course:managescales', $context)) {
55 echo "<p align=\"center\">(";
56 print_string("scalestip");
57 echo ")</p>";
61 if ($scales = get_records("scale", "courseid", "0", "name ASC")) {
62 print_heading($strstandardscales);
63 foreach ($scales as $scale) {
64 $scalemenu = make_menu_from_list($scale->scale);
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 />";
77 close_window_button();
78 exit;