2525class block_profile_redirect extends block_base {
2626 public function init () {
2727 $ this ->title = get_string ('blockname ' , 'block_profile_redirect ' );
28- }
28+ }
2929
3030 function applicable_formats () {
3131 return array ('all ' => false , 'site ' => true , 'my ' => true );
@@ -38,9 +38,8 @@ function get_content() {
3838 }
3939
4040 $ context = context_system::instance ();
41-
4241 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 ' );
4443 } else {
4544 $ config = get_config ('blocks/profile_redirect ' );
4645 if (isset ($ config ->profilefield )) {
@@ -65,11 +64,11 @@ function get_content() {
6564 }
6665 // $courefieldvalue must not be empty (if it's empty it redirects infinitly).
6766 // 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 ));
6968
7069 if (!empty ($ coursefieldvalue ) and !empty ($ course )) {
7170 // 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 );
7372 $ content = '' ; // Moodle complains if this isn't set.
7473 } else {
7574 $ content = '' ;
@@ -84,11 +83,9 @@ function get_content() {
8483
8584 return $ this ->content ;
8685 }
87-
8886 function hide_header () {
8987 return true ;
9088 }
91-
9289 function has_config () {
9390 return true ;
9491 }
0 commit comments