Also created layout-popup.php for standardwhite theme to provide a simpler template
}
// This is only set by the {@link redirect()} method
$output .= $this->metarefreshtag;
+
+ // Check if a periodic refresh delay has been set and make sure we arn't
+ // already meta refreshing
+ if ($this->metarefreshtag=='' && $this->page->periodicrefreshdelay!==null) {
+ $metarefesh = '<meta http-equiv="refresh" content="%d;url=%s" />';
+ $output .= sprintf($metarefesh, $this->page->periodicrefreshdelay, $this->page->url->out());
+ }
+
ob_start();
include($CFG->javascript);
$output .= ob_get_contents();
$this->metarefreshtag = '<meta http-equiv="refresh" content="'. $delay .'; url='. $encodedurl .'" />'."\n";
$this->page->requires->js_function_call('document.location.replace', array($url))->after_delay($delay+3);
}
+ $this->page->set_generaltype('popup');
+ $this->page->set_title('redirect');
$output = $this->header();
$output .= $this->notification($message, $messageclass);
$output .= $this->footer();
protected $_button = '';
+ /**
+ * Sets the page to refresh after a given delay (in seconds) using meta refresh
+ * in {@link standard_head_html()} in outputlib.php
+ * If set to null(default) the page is not refreshed
+ * @var int|null
+ */
+ protected $_periodicrefreshdelay = null;
+
/**
* This is simply to improve backwards compatability. If old code relies on
* a page class that implements print_header, or complex logic in
return $this->_button;
}
+ /**
+ *
+ */
+ public function get_periodicrefreshdelay() {
+ return $this->_periodicrefreshdelay;
+ }
+
/**
* 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
$this->_cacheable = $cacheable;
}
+ /**
+ * Sets the page to periodically refresh
+ *
+ * This function must be called before $OUTPUT->header has been called or
+ * a coding exception will be thrown.
+ *
+ * @param int $delay Sets the delay before refreshing the page, if set to null
+ * refresh is cancelled
+ */
+ public function set_periodic_refresh_delay($delay=null) {
+ if ($this->_state > self::STATE_BEFORE_HEADER) {
+ throw new coding_exception('You cannot set a periodic refresh delay after the header has been printed');
+ }
+ if ($delay===null) {
+ $this->_periodicrefreshdelay = null;
+ } else if (is_int($delay)) {
+ $this->_periodicrefreshdelay = $delay;
+ }
+ }
+
/// Initialisation methods =====================================================
/// These set various things up in a default way.
--- /dev/null
+<?php echo $OUTPUT->doctype() ?>
+<html <?php echo $OUTPUT->htmlattributes() ?>>
+<head>
+ <title><?php echo $PAGE->title ?></title>
+ <link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
+ <?php echo $OUTPUT->standard_head_html() ?>
+</head>
+<body id="<?php echo $PAGE->pagetype ?>" class="<?php echo $PAGE->bodyclasses ?>">
+<?php echo $OUTPUT->standard_top_of_body_html() ?>
+
+<div id="page">
+
+<?php if ($navigation) { // This is the navigation bar with breadcrumbs ?>
+ <div class="navbar clearfix">
+ <div class="breadcrumb"><?php print_navigation($navigation); ?></div>
+ <div class="navbutton"><?php echo $PAGE->button; ?></div>
+ </div>
+<?php } else if ($PAGE->heading) { // If no navigation, but a heading, then print a line ?>
+ <hr />
+<?php } ?>
+<!-- END OF HEADER -->
+
+ <div id="content" class="clearfix">
+ [MAIN CONTENT GOES HERE]
+ </div>
+
+<!-- START OF FOOTER -->
+ <div id="footer" class="clearfix">
+
+ </div>
+</div>
+<?php echo $OUTPUT->standard_end_of_body_html() ?>
+</body>
+</html>
\ No newline at end of file