Development:lib/weblib.php: Difference between revisions
From MoodleDocs
No edit summary |
Frank Ralf (talk | contribs) |
||
(One intermediate revision by one other user not shown) | |||
Line 11: | Line 11: | ||
===function build_navigation=== | ===function build_navigation=== | ||
You need to call this function before calling print_header(_simple) to create the $navigation parameter. | You need to call this function before calling print_header(_simple) to create the $navigation parameter. There is an extensive PHPdocumentor comment in the code that explains usage. | ||
Typical | Typical examples are: | ||
< | <code php> | ||
From mod/quiz/attempt.php: | From mod/quiz/attempt.php: | ||
$navigation = build_navigation($strattemptnum, $cm); | |||
print_header_simple(format_string($quiz->name), "", $navigation, ... ) | |||
From mod/forum/post.php: | |||
$navlinks = array(); | $navlinks = array(); | ||
$navlinks[] = array('name' => $ | $navlinks[] = array('name' => format_string($post->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title'); | ||
$navlinks[] = array('name' => get_string("prune", "forum"), 'link' => '', 'type' => 'title'); | |||
$navigation = build_navigation($navlinks, $cm); | $navigation = build_navigation($navlinks, $cm); | ||
print_header_simple(format_string($ | print_header_simple(format_string($discussion->name).": ".format_string($post->subject), "", $navigation, ... ) | ||
</ | </code> | ||
==See also== | ==See also== |
Latest revision as of 16:55, 28 March 2011
This library is largely concerned with generating output.
There are lots of different things in this library, and so far, only a very few parts have been documented. However, remember:
- The code should be well written and easy to understand. Want to know what a particular function does? Well, read the code. Unlike documentation, the code does not get out of date.
- The generated phpDocumentor output should give brief details about each function.
Documentation of particular bits
- Development:lib/weblib.php_moodle_url - Class for creating and manipulating urls.
You need to call this function before calling print_header(_simple) to create the $navigation parameter. There is an extensive PHPdocumentor comment in the code that explains usage.
Typical examples are:
From mod/quiz/attempt.php:
$navigation = build_navigation($strattemptnum, $cm);
print_header_simple(format_string($quiz->name), "", $navigation, ... )
From mod/forum/post.php:
$navlinks = array();
$navlinks[] = array('name' => format_string($post->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title');
$navlinks[] = array('name' => get_string("prune", "forum"), 'link' => , 'type' => 'title');
$navigation = build_navigation($navlinks, $cm);
print_header_simple(format_string($discussion->name).": ".format_string($post->subject), "", $navigation, ... )