From: jamiesensei Date: Tue, 19 Jun 2007 14:44:02 +0000 (+0000) Subject: refactored page_doc_link into two functions. doc_link returns a link to docs. page_do... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=84e3d2ccf58d83f6ebed1f179e765c4626217d6b;p=moodle.git refactored page_doc_link into two functions. doc_link returns a link to docs. page_doc_link returns the link for this page. --- diff --git a/lib/weblib.php b/lib/weblib.php index 468cfa0f2c..9c113333b5 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -286,22 +286,22 @@ function qualified_me() { /** * Class for creating and manipulating urls. - * + * * See short write up here http://docs.moodle.org/en/Development:lib/weblib.php_moodle_url */ class moodle_url { - var $scheme = '';// e.g. http - var $host = ''; + var $scheme = '';// e.g. http + var $host = ''; var $port = ''; var $user = ''; - var $pass = ''; + var $pass = ''; var $path = ''; var $fragment = ''; var $params = array(); //associative array of query string params - + /** * Pass no arguments to create a url that refers to this page. Use empty string to create empty url. - * + * * @param string $url url default null means use this page url with no query string * empty string means empty url. * if you pass any other type of url it will be parsed into it's bits, including query string @@ -324,11 +324,11 @@ class moodle_url { foreach ($parts as $key => $value){ $this->$key = $value; } - $this->params($params); + $this->params($params); } - } + } /** - * Add an array of params to the params for this page. The added params override existing ones if they + * Add an array of params to the params for this page. The added params override existing ones if they * have the same name. * * @param array $params @@ -336,9 +336,9 @@ class moodle_url { function params($params){ $this->params = $params + $this->params; } - + /** - * Remove all params if no arguments passed. Or else remove param $arg1, $arg2, etc. + * Remove all params if no arguments passed. Or else remove param $arg1, $arg2, etc. * * @param string $arg1 * @param string $arg2 @@ -357,7 +357,7 @@ class moodle_url { } /** - * Add a param to the params for this page. The added param overrides existing one if they + * Add a param to the params for this page. The added param overrides existing one if they * have the same name. * * @param string $paramname name @@ -367,7 +367,7 @@ class moodle_url { $this->params = array($paramname => $param) + $this->params; } - + function get_query_string($overrideparams = array()){ $arr = array(); $params = $overrideparams + $this->params; @@ -396,12 +396,12 @@ class moodle_url { } /** * Output url - * + * * @param boolean $noquerystring whether to output page params as a query string in the url. * @param array $overrideparams params to add to the output url, these override existing ones with the same name. * @return string url */ - function out($noquerystring = false, $overrideparams = array()) { + function out($noquerystring = false, $overrideparams = array()) { $uri = $this->scheme ? $this->scheme.':'.((strtolower($this->scheme) == 'mailto') ? '':'//'): ''; $uri .= $this->user ? $this->user.($this->pass? ':'.$this->pass:'').'@':''; $uri .= $this->host ? $this->host : ''; @@ -411,15 +411,15 @@ class moodle_url { $uri .= (count($this->params)||count($overrideparams)) ? '?'.$this->get_query_string($overrideparams) : ''; } $uri .= $this->fragment ? '#'.$this->fragment : ''; - return $uri; + return $uri; } /** * Output action url with sesskey - * + * * @param boolean $noquerystring whether to output page params as a query string in the url. * @return string url */ - function out_action($overrideparams = array()) { + function out_action($overrideparams = array()) { $overrideparams = array('sesskey'=> sesskey()) + $overrideparams; return $this->out(false, $overrideparams); } @@ -894,7 +894,7 @@ function choose_from_menu_nested($options,$name,$selected='',$nothing='choose',$ } if (!empty($options)) { foreach ($options as $section => $values) { - + $output .= ' '."\n"; foreach ($values as $value => $label) { $output .= '