outputlib pagelib MDL-19236 Cleaned up PHPdocs on a couple of functions

This commit is contained in:
samhemelryk 2009-07-01 03:47:52 +00:00
parent 4769306136
commit afa2dcad43
2 changed files with 39 additions and 5 deletions

View file

@ -886,13 +886,42 @@ class moodle_core_renderer extends moodle_renderer_base {
} }
} }
/**
* 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() { public function has_started() {
if ($this->page->state >= moodle_page::STATE_IN_BODY) { return ($this->page->state >= moodle_page::STATE_IN_BODY);
return true;
}
return false;
} }
/**
* 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') { public function redirect($encodedurl, $message, $delay, $messageclass='notifyproblem') {
global $CFG; global $CFG;
$url = str_replace('&', '&', $encodedurl); $url = str_replace('&', '&', $encodedurl);

View file

@ -45,6 +45,7 @@
* @property-read string $heading the main heading that should be displayed at the top of the <body>. * @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 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 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 { class moodle_page {
/**#@+ Tracks the where we are in the generation of the page. */ /**#@+ Tracks the where we are in the generation of the page. */
@ -395,7 +396,9 @@ class moodle_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() { public function get_periodicrefreshdelay() {
return $this->_periodicrefreshdelay; return $this->_periodicrefreshdelay;
@ -405,6 +408,8 @@ class moodle_page {
* PHP overloading magic to make the $PAGE->course syntax work by redirecting * 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 * it to the corresponding $PAGE->get_course() method if there is one, and
* throwing an exception if not. * throwing an exception if not.
*
*
*/ */
public function __get($field) { public function __get($field) {
$getmethod = 'get_' . $field; $getmethod = 'get_' . $field;