25
25
class block_profile_redirect extends block_base {
26
26
public function init () {
27
27
$ this ->title = get_string ('blockname ' , 'block_profile_redirect ' );
28
- }
28
+ }
29
29
30
30
function applicable_formats () {
31
31
return array ('all ' => false , 'site ' => true , 'my ' => true );
@@ -38,9 +38,8 @@ function get_content() {
38
38
}
39
39
40
40
$ context = context_system::instance ();
41
-
42
41
if (has_capability ('moodle/site:config ' , $ context )) { // 'moodle/site:doanything' no longer exists.
43
- $ content = get_string ('sysadmin ' ,'block_profile_redirect ' );
42
+ $ content = get_string ('sysadmin ' , 'block_profile_redirect ' );
44
43
} else {
45
44
$ config = get_config ('blocks/profile_redirect ' );
46
45
if (isset ($ config ->profilefield )) {
@@ -65,11 +64,11 @@ function get_content() {
65
64
}
66
65
// $courefieldvalue must not be empty (if it's empty it redirects infinitly).
67
66
// It also MUST return 1 record.
68
- $ course = $ DB ->get_record ('course ' ,array ($ config ->coursefield => $ coursefieldvalue ));
67
+ $ course = $ DB ->get_record ('course ' , array ($ config ->coursefield => $ coursefieldvalue ));
69
68
70
69
if (!empty ($ coursefieldvalue ) and !empty ($ course )) {
71
70
// Since M2 doesn't output any code we can redirect cleanly.
72
- redirect ($ CFG ->wwwroot .'/course/view.php?id= ' .$ course ->id ,'' ,0 );
71
+ redirect ($ CFG ->wwwroot .'/course/view.php?id= ' .$ course ->id , '' , 0 );
73
72
$ content = '' ; // Moodle complains if this isn't set.
74
73
} else {
75
74
$ content = '' ;
@@ -84,11 +83,9 @@ function get_content() {
84
83
85
84
return $ this ->content ;
86
85
}
87
-
88
86
function hide_header () {
89
87
return true ;
90
88
}
91
-
92
89
function has_config () {
93
90
return true ;
94
91
}
0 commit comments