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();
45 print_footer('empty');
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');
60 foreach ($scales as $scale) {
61 $scalemenu = make_menu_from_list($scale->scale
);
63 print_simple_box_start("center");
64 print_heading($scale->name
);
66 choose_from_menu($scalemenu, "", "", "");
68 echo text_to_html($scale->description
);
69 print_simple_box_end();
74 if (has_capability('moodle/course:managescales', $context)) {
75 echo "<p align=\"center\">(";
76 print_string("scalestip2");
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
);
89 choose_from_menu($scalemenu, "", "", "");
91 echo text_to_html($scale->description
);
92 print_simple_box_end();
97 close_window_button();
98 print_footer('empty');