}
}
+ /**
+ * Checks if we are in the body yet or not and returns true if we are in
+ * the body, false if we havn't reached it yet
+ *
+ * @uses moodle_page::STATE_IN_BODY
+ * @return bool True for in body, false if before
+ */
public function has_started() {
- if ($this->page->state >= moodle_page::STATE_IN_BODY) {
- return true;
- }
- return false;
+ return ($this->page->state >= moodle_page::STATE_IN_BODY);
}
+ /**
+ * 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
+ *
+ * @global object
+ * @uses DEBUG_DEVELOPER
+ * @uses DEBUG_ALL
+ * @uses moodle_page::STATE_BEFORE_HEADER
+ * @uses moodle_page::STATE_PRINTING_HEADER
+ * @uses moodle_page::STATE_IN_BODY
+ * @uses moodle_page::STATE_DONE
+ * @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 string $messageclass The css class to put on the message that is
+ * being displayed to the user
+ * @return string The HTML to display to the user before dying, may contain
+ * meta refresh, javascript refresh, and may have set header redirects
+ */
public function redirect($encodedurl, $message, $delay, $messageclass='notifyproblem') {
global $CFG;
$url = str_replace('&', '&', $encodedurl);
* @property-read string $heading the main heading that should be displayed at the top of the <body>.
* @property-read string $cacheable defaults to true. Set to false to stop the page being cached at all.
* @property-read page_requirements_manager $requires Tracks resources (for example required .css and .js files) required by this page.
+ * @property-read int $periodicrefreshdelay Returns the delay in seconds to use in a meta refresh call set this by calling {@link set_periodicrefreshdelay()}
*/
class moodle_page {
/**#@+ Tracks the where we are in the generation of the page. */
}
/**
- *
+ * Please do not call this method directly use the ->periodicrefreshdelay syntax
+ * {@link __get()}
+ * @return int The periodic refresh delay to use with meta refresh
*/
public function get_periodicrefreshdelay() {
return $this->_periodicrefreshdelay;
* PHP overloading magic to make the $PAGE->course syntax work by redirecting
* it to the corresponding $PAGE->get_course() method if there is one, and
* throwing an exception if not.
+ *
+ *
*/
public function __get($field) {
$getmethod = 'get_' . $field;