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);
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
);
40 choose_from_menu($scalemenu, "", "", "");
42 echo text_to_html($scale->description
);
43 print_simple_box_end();
44 close_window_button();
50 if ($scales = get_records("scale", "courseid", "$course->id", "name ASC")) {
51 print_heading($strcustomscales);
53 if (has_capability('moodle/course:managescales', $context)) {
54 echo "<p align=\"center\">(";
55 print_string("scalestip");
59 foreach ($scales as $scale) {
60 $scalemenu = make_menu_from_list($scale->scale
);
62 print_simple_box_start("center");
63 print_heading($scale->name
);
65 choose_from_menu($scalemenu, "", "", "");
67 echo text_to_html($scale->description
);
68 print_simple_box_end();
73 if (has_capability('moodle/course:managescales', $context)) {
74 echo "<p align=\"center\">(";
75 print_string("scalestip");
80 if ($scales = get_records("scale", "courseid", "0", "name ASC")) {
81 print_heading($strstandardscales);
82 foreach ($scales as $scale) {
83 $scalemenu = make_menu_from_list($scale->scale
);
85 print_simple_box_start("center");
86 print_heading($scale->name
);
88 choose_from_menu($scalemenu, "", "", "");
90 echo text_to_html($scale->description
);
91 print_simple_box_end();
96 close_window_button();