// During initial install.
$strinstallation = get_string('installation', 'install');
$strsettings = get_string('settings');
- $navigation = build_navigation(array(array('name'=>$strsettings, 'link'=>null, 'type'=>'misc')));
- print_header($strinstallation, $strinstallation, $navigation, "", "", false, " ", " ");
+ $PAGE->navbar->add($strsettings);
+ $PAGE->set_title($strinstallation);
+ $PAGE->set_heading($strinstallation);
+ $PAGE->set_cacheable(false);
+ echo $OUTPUT->header();
return;
}
$buttons = $OUTPUT->button(html_form::make_button($PAGE->url->out(false), $options, $caption, 'get'));
}
- print_header("$SITE->shortname: " . implode(": ",$visiblepathtosection), $SITE->fullname, array(), $focus, '', true, $buttons, '');
+ $PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
+ $PAGE->set_heading($SITE->fullname);
+ $PAGE->set_focuscontrol($focus);
+ $PAGE->set_button($buttons);
+ echo $OUTPUT->header();
}
/**
default: /// Guests not allowed
$strloggedinasguest = get_string('loggedinasguest');
- print_header_simple('', '',
- build_navigation(array(array('name' => $strloggedinasguest, 'link' => null, 'type' => 'misc'))));
+ $PAGE->navbar->add($strloggedinasguest);
+ print_header_simple();
if (empty($USER->access['rsw'][$COURSE->context->path])) { // Normal guest
notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), get_login_url());
} else {
// people upgrading legacy code need to copy it. See
// http://docs.moodle.org/en/Development:Migrating_your_code_code_to_the_2.0_rendering_API
function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '') {
- global $USER, $CFG;
+ global $USER, $CFG, $PAGE, $OUTPUT;
$this->init_full();
$replacements = array(
}
$buttons .= '</tr></table>';
- if (empty($morenavlinks)) {
- $morenavlinks = array();
+ if (!empty($morenavlinks) && is_array($morenavlinks)) {
+ foreach ($morenavlinks as $navitem) {
+ if (is_array($navitem) && array_key_exists('name', $navitem)) {
+ $link = null;
+ if (array_key_exists('link', $navitem)) {
+ $link = $navitem['link'];
+ }
+ $PAGE->navbar->add($navitem['name'], null, null, navigation_node::TYPE_CUSTOM, $link);
+ }
+ }
}
- $navigation = build_navigation($morenavlinks, $this->modulerecord);
- print_header($title, $this->course->fullname, $navigation, '', $meta, true, $buttons, navmenu($this->course, $this->modulerecord), false, $bodytags);
+
+ $PAGE->set_title($title);
+ $PAGE->set_heading($this->course->fullname);
+ $PAGE->set_button($buttons);
+ echo $OUTPUT->heading();
}
}
* @param portfolio_caller_base subclass $caller portfolio caller (passed by reference)
* @param string $callerfile path to callerfile (relative to dataroot)
* @param string $navigation result of build_navigation (passed to print_header)
+ * deprecated argument as of Moodle 2.0, please use $PAGE methods
+ * instead.
*/
- public function __construct(&$instance, &$caller, $callerfile, $navigation) {
+ public function __construct(&$instance, &$caller, $callerfile, $navigation='') {
$this->instance =& $instance;
$this->caller =& $caller;
if ($instance) {
* @param string $headerstring key for a portfolio language string
*/
public function print_header($headingstr, $summary=true) {
- global $OUTPUT;
+ global $OUTPUT, $PAGE;
$titlestr = get_string('exporting', 'portfolio');
$headerstr = get_string('exporting', 'portfolio');
- print_header($titlestr, $headerstr, $this->navigation);
+ $PAGE->set_title($titlestr);
+ $PAGE->set_heading($headerstr);
+ echo $OUTPUT->header();
$hstr = get_string($headingstr, 'portfolio');
if (strpos($hstr, '[[') === 0) {
$hstr = $headingstr;
* through the usage of the backbutton
*/
public static function print_expired_export() {
- global $CFG, $OUTPUT;
+ global $CFG, $OUTPUT, $PAGE;
$title = get_string('exportexpired', 'portfolio');
- print_header($title, $title, build_navigation(get_string('exportexpired', 'portfolio')));
+ $PAGE->navbar->add(get_string('exportexpired', 'portfolio'));
+ $PAGE->set_title($title);
+ $PAGE->set_heading($title);
+ echo $OUTPUT->header();
echo $OUTPUT->notification(get_string('exportexpireddesc', 'portfolio'));
echo $OUTPUT->continue_button($CFG->wwwroot);
echo $OUTPUT->footer();
$baseurl = $CFG->wwwroot . '/lib/simpletest/filtersettingsperformancetester.php';
$title = 'filter_get_active_in_context performance test';
-print_header($title, $title, build_navigation($title));
+$PAGE->navbar->add($title);
+$PAGE->set_title($title);
+$PAGE->set_heading($title);
+echo $OUTPUT->header();
// Complain if we get this far and $CFG->unittestprefix is not set.
if (empty($CFG->unittestprefix)) {
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$title = 'get_string performance test';
-print_header($title, $title, build_navigation($title));
+$PAGE->navbar->add($title);
+$PAGE->set_title($title);
+$PAGE->set_heading($title);
+echo $OUTPUT->header();
$installedlangs = get_list_of_languages();
$requiredlangs = $TEST_LANGUAGES;
* @global object
*/
function upgrade_started($preinstall=false) {
- global $CFG, $DB, $PAGE;
+ global $CFG, $DB, $PAGE, $OUTPUT;
static $started = false;
$strupgrade = get_string('upgradingversion', 'admin');
$PAGE->set_generaltype('maintenance');
upgrade_get_javascript();
- print_header($strupgrade.' - Moodle '.$CFG->target_release, $strupgrade,
- build_navigation(array(array('name' => $strupgrade, 'link' => null, 'type' => 'misc'))), '',
- '', false, ' ', ' ');
+ $PAGE->set_title($strupgrade.' - Moodle '.$CFG->target_release);
+ $PAGE->set_heading($strupgrade);
+ $PAGE->navbar->add($strupgrade);
+ $PAGE->set_cacheable(false);
+ echo $OUTPUT->header();
}
ignore_user_abort(true);
return $output;
}
-/*
+/**
* Try and close the current window using JavaScript, either immediately, or after a delay.
*
* Echo's out the resulting XHTML & javascript
global $THEME, $PAGE, $OUTPUT;
if (!$PAGE->headerprinted) {
- print_header(get_string('closewindow'));
+ $PAGE->set_title(get_string('closewindow'));
+ echo $OUTPUT->header();
} else {
print_container_end_all(false, $THEME->open_header_containers);
}
function print_header_simple($title='', $heading='', $navigation='', $focus='', $meta='',
$cache=true, $button=' ', $menu='', $usexml=false, $bodytags='', $return=false) {
- global $COURSE, $CFG;
+ global $COURSE, $CFG, $PAGE, $OUTPUT;
- // if we have no navigation specified, build it
- if( empty($navigation) ){
- $navigation = build_navigation('');
+ if ($meta) {
+ throw new coding_exception('The $meta parameter to print_header is no longer supported. '.
+ 'You should be able to do everything you want with $PAGE->requires and other such mechanisms.');
}
-
- // If old style nav prepend course short name otherwise leave $navigation object alone
- if (!is_newnav($navigation)) {
- if ($COURSE->id != SITEID) {
- $shortname = '<a href="'.$CFG->wwwroot.'/course/view.php?id='. $COURSE->id .'">'. $COURSE->shortname .'</a> ->';
- $navigation = $shortname.' '.$navigation;
- }
+ if ($usexml) {
+ throw new coding_exception('The $usexml parameter to print_header is no longer supported.');
}
+ if ($bodytags) {
+ throw new coding_exception('The $bodytags parameter to print_header is no longer supported.');
+ }
+
+ $PAGE->set_title($title);
+ $PAGE->set_heading($heading);
+ $PAGE->set_focuscontrol($focus);
+ $PAGE->set_cacheable(true);
+ $PAGE->set_button($button);
- $output = print_header($COURSE->shortname .': '. $title, $COURSE->fullname .' '. $heading, $navigation, $focus, $meta,
- $cache, $button, $menu, $usexml, $bodytags, true);
+ $output = $OUTPUT->header();
if ($return) {
return $output;
if (!$PAGE->headerprinted) {
//header not yet printed
- print_header(get_string('notice'));
+ $PAGE->set_title(get_string('notice'));
+ echo $OUTPUT->header();
} else {
print_container_end_all(false, $THEME->open_header_containers);
}
$PAGE->set_pagetype('maintenance-message');
$PAGE->set_generaltype('maintenance');
- print_header(strip_tags($SITE->fullname), $SITE->fullname, 'home');
+ $PAGE->set_title(strip_tags($SITE->fullname));
+ $PAGE->set_heading($SITE->fullname);
+ echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('sitemaintenance', 'admin'));
if (isset($CFG->maintenance_message) and !html_is_blank($CFG->maintenance_message)) {
echo $OUTPUT->box_start('maintenance_message generalbox boxwidthwide boxaligncenter');
// todo this will have to change when we have things exporting content outside the course context (eg blogs)
require_login($course, false, $cm);
- $extranav[] = array('type' => 'title', 'name' => get_string('exporting', 'portfolio'));
- $navigation = build_navigation($extranav, $cm);
+ foreach ($extranav as $navitem) {
+ $PAGE->navbar->add($navitem['name']);
+ }
+ $PAGE->navbar->add(get_string('exporting', 'portfolio'));
- // finally! set up the exporter object with the portfolio instance, caller information, and navigation elements
- $exporter = new portfolio_exporter($instance, $caller, $callbackfile, $navigation);
+ // finally! set up the exporter object with the portfolio instance, and caller information elements
+ $exporter = new portfolio_exporter($instance, $caller, $callbackfile);
// set the export-specific variables, and save.
$exporter->set('user', $USER);