Updated the 19 build version to 20100610
[moodle.git] / course / scales.php
blob31a2e18c5e35a40dbc5a79d21a2e5744119a0342
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
8 $scaleid = optional_param('scaleid', 0, PARAM_INT); // scale id (show only this one)
10 if (! $course = get_record("course", "id", $id)) {
11 error("Course ID was incorrect");
14 require_login($course);
15 $context = get_context_instance(CONTEXT_COURSE, $course->id);
16 require_capability('moodle/course:viewscales', $context);
18 $strscale = get_string("scale");
19 $strscales = get_string("scales");
20 $strcustomscale = get_string("scalescustom");
21 $strstandardscale = get_string("scalesstandard");
22 $strcustomscales = get_string("scalescustom");
23 $strstandardscales = get_string("scalesstandard");
24 $strname = get_string("name");
25 $strdescription = get_string("description");
26 $strhelptext = get_string("helptext");
27 $stractivities = get_string("activities");
29 print_header($strscales);
31 if ($scaleid) {
32 if ($scale = get_record("scale", 'id', $scaleid)) {
33 if ($scale->courseid == 0 || $scale->courseid == $course->id) {
35 $scalemenu = make_menu_from_list($scale->scale);
37 print_simple_box_start("center");
38 print_heading($scale->name);
39 echo "<center>";
40 choose_from_menu($scalemenu, "", "", "");
41 echo "</center>";
42 echo text_to_html($scale->description);
43 print_simple_box_end();
44 close_window_button();
45 print_footer('empty');
46 exit;
51 if ($scales = get_records("scale", "courseid", "$course->id", "name ASC")) {
52 print_heading($strcustomscales);
54 if (has_capability('moodle/course:managescales', $context)) {
55 echo "<p align=\"center\">(";
56 print_string('scalestip2');
57 echo ")</p>";
60 foreach ($scales as $scale) {
61 $scalemenu = make_menu_from_list($scale->scale);
63 print_simple_box_start("center");
64 print_heading($scale->name);
65 echo "<center>";
66 choose_from_menu($scalemenu, "", "", "");
67 echo "</center>";
68 echo text_to_html($scale->description);
69 print_simple_box_end();
70 echo "<hr />";
73 } else {
74 if (has_capability('moodle/course:managescales', $context)) {
75 echo "<p align=\"center\">(";
76 print_string("scalestip2");
77 echo ")</p>";
81 if ($scales = get_records("scale", "courseid", "0", "name ASC")) {
82 print_heading($strstandardscales);
83 foreach ($scales as $scale) {
84 $scalemenu = make_menu_from_list($scale->scale);
86 print_simple_box_start("center");
87 print_heading($scale->name);
88 echo "<center>";
89 choose_from_menu($scalemenu, "", "", "");
90 echo "</center>";
91 echo text_to_html($scale->description);
92 print_simple_box_end();
93 echo "<hr />";
97 close_window_button();
98 print_footer('empty');