diff --git a/.travis.yml b/.travis.yml index 0bf66d5..7522fdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,16 +28,18 @@ env: matrix: include: - - php: 5.6 - env: DB=pgsql MOODLE_BRANCH=MOODLE_33_STABLE NODEJS=8 - php: 7.0 - env: DB=mysqli MOODLE_BRANCH=MOODLE_35_STABLE - - php: 7.1 - env: DB=mysqli MOODLE_BRANCH=MOODLE_33_STABLE NODEJS=8 + env: DB=pgsql MOODLE_BRANCH=MOODLE_35_STABLE + - php: 7.0 + env: DB=mysqli MOODLE_BRANCH=MOODLE_36_STABLE NODEJS=8 + - php: 7.2 + env: DB=pgsql MOODLE_BRANCH=MOODLE_37_STABLE + - php: 7.2 + env: DB=pgsql MOODLE_BRANCH=MOODLE_38_STABLE - php: 7.4 - env: DB=mysqli MOODLE_BRANCH=master - - php: 7.4 - env: DB=pgsql MOODLE_BRANCH=master + env: DB=pgsql MOODLE_BRANCH=MOODLE_39_STABLE + - php: 7.2 + env: DB=mysqli MOODLE_BRANCH=MOODLE_39_STABLE before_install: - export MOODLE_VERSION=$(echo "$MOODLE_BRANCH" | cut -d'_' -f 2) diff --git a/classes/local/outagelib.php b/classes/local/outagelib.php index c651e7c..e17dce1 100644 --- a/classes/local/outagelib.php +++ b/classes/local/outagelib.php @@ -103,6 +103,7 @@ class outagelib { * @return string|void CSS and HTML for the warning bar if it should be displayed */ public static function get_inject_code() { + global $PAGE; // Ensure we do not kill the whole website in case of an error. try { // Check if we should inject the code. @@ -132,7 +133,8 @@ class outagelib { } // There is a previewing or active outage. - return renderer::get()->render_warningbar($active, $time, false, $preview); + $renderer = $PAGE->get_renderer('auth_outage'); + return $renderer->render_warningbar($active, $time, false, $preview); } catch (Exception $e) { debugging('Exception occured while injecting our code: '.$e->getMessage()); debugging($e->getTraceAsString(), DEBUG_DEVELOPER); diff --git a/classes/output/renderer.php b/classes/output/renderer.php index d8f59bd..55cb854 100644 --- a/classes/output/renderer.php +++ b/classes/output/renderer.php @@ -44,15 +44,6 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class renderer extends plugin_renderer_base { - /** - * Returns the outage renderer. - * @return renderer The outage renderer. - */ - public static function get() { - global $PAGE; - return $PAGE->get_renderer('auth_outage'); - } - /** * Outputs the view in a separate scope to avoid conflicts with variable names. * @param string $view View PHP file. @@ -154,8 +145,6 @@ class renderer extends plugin_renderer_base { * @return string The formatted HTML. */ private function renderoutage(outage $outage, $buttons) { - global $OUTPUT; - if ($outage->createdby == 0) { $created = get_string('na', 'auth_outage'); } else { @@ -179,14 +168,14 @@ class renderer extends plugin_renderer_base { $url = new moodle_url('/auth/outage/edit.php', ['edit' => $outage->id]); $img = html_writer::empty_tag( 'img', - ['src' => $OUTPUT->image_url('t/edit'), 'alt' => get_string('edit'), 'class' => 'iconsmall'] + ['src' => $this->output->image_url('t/edit'), 'alt' => get_string('edit'), 'class' => 'iconsmall'] ); $linkedit = html_writer::link($url, $img, ['title' => get_string('edit')]); $url = new moodle_url('/auth/outage/delete.php', ['id' => $outage->id]); $img = html_writer::empty_tag( 'img', - ['src' => $OUTPUT->image_url('t/delete'), 'alt' => get_string('delete'), 'class' => 'iconsmall'] + ['src' => $this->output->image_url('t/delete'), 'alt' => get_string('delete'), 'class' => 'iconsmall'] ); $linkdelete = html_writer::link($url, $img, ['title' => get_string('delete')]); diff --git a/delete.php b/delete.php index eb594a2..b3a9713 100644 --- a/delete.php +++ b/delete.php @@ -33,6 +33,7 @@ require_once($CFG->libdir.'/formslib.php'); admin_externalpage_setup('auth_outage_manage'); $PAGE->set_url(new moodle_url('/auth/outage/manage.php')); +$output = $PAGE->get_renderer('auth_outage'); $mform = new delete(); if ($mform->is_cancelled()) { @@ -52,10 +53,10 @@ $dataid = new stdClass(); $dataid->id = $outage->id; $mform->set_data($dataid); -echo $OUTPUT->header(); +echo $output->header(); -echo renderer::get()->renderdeleteconfirmation($outage); +echo $output->renderdeleteconfirmation($outage); $mform->display(); -echo $OUTPUT->footer(); +echo $output->footer(); diff --git a/edit.php b/edit.php index e2b0e18..eebb285 100644 --- a/edit.php +++ b/edit.php @@ -34,6 +34,7 @@ require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/formslib.php'); admin_externalpage_setup('auth_outage_manage'); +$output = $PAGE->get_renderer('auth_outage'); $PAGE->set_url(new moodle_url('/auth/outage/manage.php')); $mform = new edit(); @@ -83,7 +84,7 @@ if ($outage == null) { $mform->set_data($outage); $PAGE->navbar->add(get_string($action.'crumb', 'auth_outage')); -echo $OUTPUT->header(); -echo renderer::get()->rendersubtitle($action); +echo $output->header(); +echo $output->rendersubtitle($action); $mform->display(); -echo $OUTPUT->footer(); +echo $output->footer(); diff --git a/finish.php b/finish.php index 047e3eb..868b1bf 100644 --- a/finish.php +++ b/finish.php @@ -33,6 +33,7 @@ require_once($CFG->libdir.'/formslib.php'); admin_externalpage_setup('auth_outage_manage'); $PAGE->set_url(new moodle_url('/auth/outage/manage.php')); +$output = $PAGE->get_renderer('auth_outage'); $mform = new finish(); if ($mform->is_cancelled()) { @@ -52,10 +53,10 @@ $dataid = new stdClass(); $dataid->id = $outage->id; $mform->set_data($dataid); -echo $OUTPUT->header(); +echo $output->header(); -echo renderer::get()->renderfinishconfirmation($outage); +echo $output->renderfinishconfirmation($outage); $mform->display(); -echo $OUTPUT->footer(); +echo $output->footer(); diff --git a/manage.php b/manage.php index 967d083..582438d 100644 --- a/manage.php +++ b/manage.php @@ -32,16 +32,17 @@ require_once($CFG->libdir.'/adminlib.php'); admin_externalpage_setup('auth_outage_manage'); $PAGE->set_url(new moodle_url('/auth/outage/manage.php')); +$output = $PAGE->get_renderer('auth_outage'); -echo $OUTPUT->header(); +echo $output->header(); // Give it a consistent time so all outages are listed. Useful when debugging. $now = time(); -renderer::get()->output_view('manage.php', [ +$output->output_view('manage.php', [ 'unended' => outagedb::get_all_unended($now), 'ended' => outagedb::get_all_ended($now), 'warning' => outagelib::generate_plugin_configuration_warning(), ]); -echo $OUTPUT->footer(); +echo $output->footer(); diff --git a/views/manage.php b/views/manage.php index f2fee40..94a997f 100644 --- a/views/manage.php +++ b/views/manage.php @@ -31,14 +31,15 @@ use auth_outage\local\outagelib; defined('MOODLE_INTERNAL') || die(); -global $OUTPUT; +global $PAGE; +$output = $PAGE->get_renderer('auth_outage'); $urlnew = new moodle_url('/auth/outage/edit.php'); echo $viewbag['warning']; ?>
- rendersubtitle('outageslistfuture'); ?> + rendersubtitle('outageslistfuture'); ?>

@@ -61,7 +62,7 @@ echo $viewbag['warning']; echo '

'; $next = outagelib::get_next_window($next); $urlnew->param('starttime', $next); - echo $OUTPUT->single_button($urlnew, get_string('outagecreate', 'auth_outage')); + echo $output->single_button($urlnew, get_string('outagecreate', 'auth_outage')); if ($default) { echo ' ' . userdate( $next, get_string('datetimeformat', 'auth_outage')); } @@ -70,7 +71,7 @@ echo $viewbag['warning'];

- rendersubtitle('outageslistpast'); ?> + rendersubtitle('outageslistpast'); ?>