File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 36
36
}
37
37
$ PAGE ->set_url ($ url );
38
38
39
- if (!$ course = $ DB ->get_record ('course ' , array ('id ' =>$ id ))) {
40
- print_error ("invalidcourseid " );
39
+ $ context = null ;
40
+ if ($ course = $ DB ->get_record ('course ' , array ('id ' =>$ id ))) {
41
+ require_login ($ course );
42
+ $ context = get_context_instance (CONTEXT_COURSE , $ course ->id );
43
+ } else {
44
+ //$id will be 0 for site level scales
45
+ require_login ();
46
+ $ context = get_context_instance (CONTEXT_SYSTEM );
41
47
}
42
48
43
- require_login ($ course );
44
- $ context = get_context_instance (CONTEXT_COURSE , $ course ->id );
49
+ $ PAGE ->set_context ($ context );
45
50
require_capability ('moodle/course:viewscales ' , $ context );
46
51
47
52
$ strscales = get_string ("scales " );
48
53
$ strcustomscales = get_string ("scalescustom " );
49
54
$ strstandardscales = get_string ("scalesstandard " );
50
55
51
56
$ PAGE ->set_title ($ strscales );
52
- $ PAGE ->set_heading ($ course ->fullname );
57
+ if (!empty ($ course )) {
58
+ $ PAGE ->set_heading ($ course ->fullname );
59
+ } else {
60
+ $ PAGE ->set_heading ($ SITE ->fullname );
61
+ }
53
62
echo $ OUTPUT ->header ();
54
63
55
64
if ($ scaleid ) {
You can’t perform that action at this time.
0 commit comments