* @param string $menu HTML code for a popup menu
* @param boolean $usexml use XML for this page
* @param string $bodytags This text will be included verbatim in the <body> tag (useful for onload() etc)
+ * @param bool $return If true, return the visible elements of the header instead of echoing them.
*/
-function print_header ($title='', $heading='', $navigation='', $focus='', $meta='',
- $cache=true, $button=' ', $menu='', $usexml=false, $bodytags='') {
+function print_header ($title='', $heading='', $navigation='', $focus='',
+ $meta='', $cache=true, $button=' ', $menu='',
+ $usexml=false, $bodytags='', $return=false) {
global $USER, $CFG, $THEME, $SESSION, $ME, $SITE, $HTTPSPAGEREQUIRED;
$bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
+ ob_start();
include ($CFG->themedir.current_theme().'/header.html');
+ $output = ob_get_contents();
+ ob_end_clean();
if (!empty($CFG->messaging)) {
- echo message_popup_window();
+ $output .= message_popup_window();
+ }
+
+ if ($return) {
+ return $output;
+ } else {
+ echo $output;
}
}
* @param string $menu HTML code for a popup menu
* @param boolean $usexml use XML for this page
* @param string $bodytags This text will be included verbatim in the <body> tag (useful for onload() etc)
+ * @param bool $return If true, return the visible elements of the header instead of echoing them.
*/
function print_header_simple($title='', $heading='', $navigation='', $focus='', $meta='',
- $cache=true, $button=' ', $menu='', $usexml=false, $bodytags='') {
+ $cache=true, $button=' ', $menu='', $usexml=false, $bodytags='', $return=false) {
global $course,$CFG; // The same hack is used in print_header
$shortname = '<a href="'.$CFG->wwwroot.'/course/view.php?id='. $course->id .'">'. $course->shortname .'</a> ->';
}
- print_header($course->shortname .': '. $title, $course->fullname .' '. $heading, $shortname .' '. $navigation, $focus, $meta,
- $cache, $button, $menu, $usexml, $bodytags);
+ $output = print_header($course->shortname .': '. $title, $course->fullname .' '. $heading, $shortname .' '. $navigation, $focus, $meta,
+ $cache, $button, $menu, $usexml, $bodytags, $return);
+
+ if ($return) {
+ return $output;
+ } else {
+ echo $output;
+ }
}