From: samhemelryk Date: Wed, 1 Jul 2009 03:47:52 +0000 (+0000) Subject: outputlib pagelib MDL-19236 Cleaned up PHPdocs on a couple of functions X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=afa2dcad43bad4ad05da8d4262b66b9f6491dba0;p=moodle.git outputlib pagelib MDL-19236 Cleaned up PHPdocs on a couple of functions --- diff --git a/lib/outputlib.php b/lib/outputlib.php index 70d0f8c333..9187a8c301 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -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() { - 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); diff --git a/lib/pagelib.php b/lib/pagelib.php index 53e551c068..a866db125d 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -45,6 +45,7 @@ * @property-read string $heading the main heading that should be displayed at the top of the . * @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. */ @@ -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() { return $this->_periodicrefreshdelay; @@ -405,6 +408,8 @@ class moodle_page { * 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;