Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
This class solves the problem of how to initialise $OUTPUT. More...
Public Member Functions | |
__call ($method, $arguments) | |
Constructor - to be used by core code only. | |
has_started () | |
Have we started output yet? | |
Static Public Member Functions | |
static | early_error ($message, $moreinfourl, $link, $backtrace, $debuginfo=null, $errorcode=null) |
This function should only be called by this class, or from exception handlers. | |
static | early_error_content ($message, $moreinfourl, $link, $backtrace, $debuginfo=null) |
Returns nicely formatted error message in a div box. | |
static | early_notification ($message, $classes='notifyproblem') |
Early notification message. | |
static | early_redirect_message ($encodedurl, $message, $delay) |
Early redirection page, used before full init of $PAGE global. | |
static | plain_page ($title, $content, $meta='') |
Output basic html page. | |
static | plain_redirect_message ($encodedurl) |
Page should redirect message. | |
Protected Attributes | |
boolean | $initialising = false |
Handles re-entrancy. | |
This class solves the problem of how to initialise $OUTPUT.
The problem is caused be two factors
So, it is hard to find a single natural place during Moodle script execution, which we can guarantee is the right time to initialise $OUTPUT. Instead we adopt the following strategy
The only problem with that is, how do we initialise $OUTPUT on first use if, it is going to be used like $OUTPUT->somthing(...)? Well that is where this class comes in. Initially, we set up $OUTPUT = new bootstrap_renderer(). Then, when any method is called on that object, we initialise $OUTPUT, and pass the call on.
Note that this class is used before lib/outputlib.php has been loaded, so we must be careful referring to classes/functions from there, they may not be defined yet, and we must avoid fatal errors.
bootstrap_renderer::__call | ( | $method, | |
$arguments ) |
Constructor - to be used by core code only.
string | $method | The method to call |
array | $arguments | Arguments to pass to the method being called |
string |
|
static |
This function should only be called by this class, or from exception handlers.
string | $message | error message |
string | $moreinfourl | (ignored in early errors) |
string | $link | (ignored in early errors) |
array | $backtrace | |
string | $debuginfo | extra information for developers |
?string |
|
static |
Returns nicely formatted error message in a div box.
string | $message | error message |
?string | $moreinfourl | (ignored in early errors) |
?string | $link | (ignored in early errors) |
?array | $backtrace | |
?string | $debuginfo |
string |
|
static |
Early notification message.
string | $message | |
string | $classes | usually notifyproblem or notifysuccess |
string |
|
static |
Early redirection page, used before full init of $PAGE global.
string | $encodedurl | redirect url |
string | $message | redirect message |
int | $delay | time in seconds |
string | redirect page |
bootstrap_renderer::has_started | ( | ) |
Have we started output yet?
boolean | true if the header has been printed. |
|
static |
Output basic html page.
string | $title | page title |
string | $content | page content |
string | $meta | meta tag |
string | html page |
|
static |
|
protected |
Handles re-entrancy.
Without this, errors or debugging output that occur during the initialisation of $OUTPUT, cause infinite recursion.