File tree 1 file changed +3
-8
lines changed
1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 47
47
$ PAGE ->set_url ('/rating/rate.php ' , array ('contextid ' => $ context ->id ));
48
48
49
49
if (!confirm_sesskey () || !has_capability ('moodle/rating:rate ' , $ context )) {
50
- echo $ OUTPUT ->header ();
51
- echo get_string ('ratepermissiondenied ' , 'rating ' );
52
- echo $ OUTPUT ->footer ();
53
- die ();
50
+ print_error ('ratepermissiondenied ' , 'rating ' );
54
51
}
55
52
56
53
$ rm = new rating_manager ();
57
54
58
55
// Check the module rating permissions.
59
- // Doing this check here rather than within rating_manager::get_ratings() so we can return a json error response .
56
+ // Doing this check here rather than within rating_manager::get_ratings() so we can choose how to handle the error .
60
57
$ pluginpermissionsarray = $ rm ->get_plugin_permissions_array ($ context ->id , $ component , $ ratingarea );
61
58
62
59
if (!$ pluginpermissionsarray ['rate ' ]) {
63
- $ result ->error = get_string ('ratepermissiondenied ' , 'rating ' );
64
- echo json_encode ($ result );
65
- die ();
60
+ print_error ('ratepermissiondenied ' , 'rating ' );
66
61
} else {
67
62
$ params = array (
68
63
'context ' => $ context ,
You can’t perform that action at this time.
0 commit comments