original_string: public function redirect_message($encodedurl, $message, $delay, $debugdisableredirect,
                                       $messagetype = \core\output\notification::NOTIFY_INFO) {
          global $CFG;
          $url = str_replace('&amp;', '&', $encodedurl);
  
          switch ($this->page->state) {
              case moodle_page::STATE_BEFORE_HEADER :
                  // No output yet it is safe to delivery the full arsenal of redirect methods
                  if (!$debugdisableredirect) {
                      // Don't use exactly the same time here, it can cause problems when both redirects fire at the same time.
                      $this->metarefreshtag = '<meta http-equiv="refresh" content="'. $delay .'; url='. $encodedurl .'" />'."\n";
                      $this->page->requires->js_function_call('document.location.replace', array($url), false, ($delay + 3));
                  }
                  $output = $this->header();
                  break;
              case moodle_page::STATE_PRINTING_HEADER :
                  // We should hopefully never get here
                  throw new coding_exception('You cannot redirect while printing the page header');
                  break;
              case moodle_page::STATE_IN_BODY :
                  // We really shouldn't be here but we can deal with this
                  debugging("You should really redirect before you start page output");
                  if (!$debugdisableredirect) {
                      $this->page->requires->js_function_call('document.location.replace', array($url), false, $delay);
                  }
                  $output = $this->opencontainers->pop_all_but_last();
                  break;
              case moodle_page::STATE_DONE :
                  // Too late to be calling redirect now
                  throw new coding_exception('You cannot redirect after the entire page has been generated');
                  break;
          }
          $output .= $this->notification($message, $messagetype);
          $output .= '<div class="continuebutton">(<a href="'. $encodedurl .'">'. get_string('continue') .'</a>)</div>';
          if ($debugdisableredirect) {
              $output .= '<p><strong>'.get_string('erroroutput', 'error').'</strong></p>';
          }
          $output .= $this->footer();
          return $output;
      }
code: public function redirect_message($encodedurl, $message, $delay, $debugdisableredirect,
                                       $messagetype = \core\output\notification::NOTIFY_INFO) {
          global $CFG;
          $url = str_replace('&amp;', '&', $encodedurl);
  
          switch ($this->page->state) {
              case moodle_page::STATE_BEFORE_HEADER :
                  // No output yet it is safe to delivery the full arsenal of redirect methods
                  if (!$debugdisableredirect) {
                      // Don't use exactly the same time here, it can cause problems when both redirects fire at the same time.
                      $this->metarefreshtag = '<meta http-equiv="refresh" content="'. $delay .'; url='. $encodedurl .'" />'."\n";
                      $this->page->requires->js_function_call('document.location.replace', array($url), false, ($delay + 3));
                  }
                  $output = $this->header();
                  break;
              case moodle_page::STATE_PRINTING_HEADER :
                  // We should hopefully never get here
                  throw new coding_exception('You cannot redirect while printing the page header');
                  break;
              case moodle_page::STATE_IN_BODY :
                  // We really shouldn't be here but we can deal with this
                  debugging("You should really redirect before you start page output");
                  if (!$debugdisableredirect) {
                      $this->page->requires->js_function_call('document.location.replace', array($url), false, $delay);
                  }
                  $output = $this->opencontainers->pop_all_but_last();
                  break;
              case moodle_page::STATE_DONE :
                  // Too late to be calling redirect now
                  throw new coding_exception('You cannot redirect after the entire page has been generated');
                  break;
          }
          $output .= $this->notification($message, $messagetype);
          $output .= '<div class="continuebutton">(<a href="'. $encodedurl .'">'. get_string('continue') .'</a>)</div>';
          if ($debugdisableredirect) {
              $output .= '<p><strong>'.get_string('erroroutput', 'error').'</strong></p>';
          }
          $output .= $this->footer();
          return $output;
      }
code_tokens: public function redirect_message ( $ encodedurl , $ message , $ delay , $ debugdisableredirect , $ messagetype = \ core \ output \ notification :: NOTIFY_INFO ) { global $ CFG ; $ url = str_replace ( '&amp;' , '&' , $ encodedurl ) ; switch ( $ this -> page -> state ) { case moodle_page :: STATE_BEFORE_HEADER : // No output yet it is safe to delivery the full arsenal of redirect methods if ( ! $ debugdisableredirect ) { // Don't use exactly the same time here, it can cause problems when both redirects fire at the same time. $ this -> metarefreshtag = '<meta http-equiv="refresh" content="' . $ delay . '; url=' . $ encodedurl . '" />' . "\n" ; $ this -> page -> requires -> js_function_call ( 'document.location.replace' , array ( $ url ) , false , ( $ delay + 3 ) ) ; } $ output = $ this -> header ( ) ; break ; case moodle_page :: STATE_PRINTING_HEADER : // We should hopefully never get here throw new coding_exception ( 'You cannot redirect while printing the page header' ) ; break ; case moodle_page :: STATE_IN_BODY : // We really shouldn't be here but we can deal with this debugging ( "You should really redirect before you start page output" ) ; if ( ! $ debugdisableredirect ) { $ this -> page -> requires -> js_function_call ( 'document.location.replace' , array ( $ url ) , false , $ delay ) ; } $ output = $ this -> opencontainers -> pop_all_but_last ( ) ; break ; case moodle_page :: STATE_DONE : // Too late to be calling redirect now throw new coding_exception ( 'You cannot redirect after the entire page has been generated' ) ; break ; } $ output .= $ this -> notification ( $ message , $ messagetype ) ; $ output .= '<div class="continuebutton">(<a href="' . $ encodedurl . '">' . get_string ( 'continue' ) . '</a>)</div>' ; if ( $ debugdisableredirect ) { $ output .= '<p><strong>' . get_string ( 'erroroutput' , 'error' ) . '</strong></p>' ; } $ output .= $ this -> footer ( ) ; return $ output ; }
docstring: Redirects the user by any means possible given the current state
  
  This function should not be called directly, it should always be called using
  the redirect function in lib/weblib.php
  
  The redirect function should really only be called before page output has started
  however it will allow itself to be called during the state STATE_IN_BODY
  
  @param string $encodedurl The URL to send to encoded if required
  @param string $message The message to display to the user if any
  @param int $delay The delay before redirecting a user, if $message has been
  set this is a requirement and defaults to 3, set to 0 no delay
  @param boolean $debugdisableredirect this redirect has been disabled for
  debugging purposes. Display a message that explains, and don't
  trigger the redirect.
  @param string $messagetype The type of notification to show the message in.
  See constants on \core\output\notification.
  @return string The HTML to display to the user before dying, may contain
  meta refresh, javascript refresh, and may have set header redirects
docstring_tokens: Redirects the user by any means possible given the current state