Issue #390: Code cleanup to fix code standards codesniffer errors.

This commit is contained in:
abhinavgandham
2026-01-12 15:08:32 +10:00
parent 42dbec5b4d
commit 7f968b2365
52 changed files with 481 additions and 363 deletions

View File

@@ -41,15 +41,17 @@ defined('MOODLE_INTERNAL') || die();
</div>
<div class="auth_outage_info_description"><?php echo $viewbag['outage']->get_description(); ?></div>
<?php if ($viewbag['admin']): ?>
<?php if ($viewbag['admin']) : ?>
<?php
$adminlinks = [];
foreach ([
foreach (
[
'startofwarning' => -$viewbag['outage']->get_warning_duration(),
'15secondsbefore' => -15,
'start' => 0,
'endofoutage' => $viewbag['outage']->get_duration_planned() - 1,
] as $title => $delta) {
] as $title => $delta
) {
$adminlinks[] = html_writer::link(
new moodle_url(
'/auth/outage/info.php',
@@ -59,7 +61,7 @@ defined('MOODLE_INTERNAL') || die();
'auth_outage_delta' => $delta,
]
),
get_string('info'.$title, 'auth_outage')
get_string('info' . $title, 'auth_outage')
);
}
$adminlinks[] = html_writer::link(

View File

@@ -41,11 +41,11 @@ echo $viewbag['warning'];
<section id="section_planned_outages">
<?php echo $output->rendersubtitle('outageslistfuture'); ?>
<?php if (empty($viewbag['unended'])): ?>
<?php if (empty($viewbag['unended'])) : ?>
<p>
<small><?php echo get_string('notfound', 'auth_outage'); ?></small>
</p>
<?php else: ?>
<?php else : ?>
<?php
$table = new planned_table();
$table->show_data($viewbag['unended']);
@@ -65,7 +65,7 @@ echo $viewbag['warning'];
$urlnew->param('starttime', $next);
echo $output->single_button($urlnew, get_string('outagecreate', 'auth_outage'));
if ($default) {
echo ' ' . userdate( $next, get_string('datetimeformat', 'auth_outage'));
echo ' ' . userdate($next, get_string('datetimeformat', 'auth_outage'));
}
}
endif; ?>
@@ -73,11 +73,11 @@ echo $viewbag['warning'];
<section id="section_outage_history">
<?php echo $output->rendersubtitle('outageslistpast'); ?>
<?php if (empty($viewbag['ended'])): ?>
<?php if (empty($viewbag['ended'])) : ?>
<p>
<small><?php echo get_string('notfound', 'auth_outage'); ?></small>
</p>
<?php else: ?>
<?php else : ?>
<?php
$table = new history_table();
$table->show_data($viewbag['ended']);

View File

@@ -49,19 +49,25 @@ if (!$viewbag['static']) {
if (is_siteadmin()) {
$link = html_writer::link(
new moodle_url('/auth/outage/finish.php', ['id' => $viewbag['outage']->id]),
$OUTPUT->pix_icon('t/check', get_string('finish', 'auth_outage'), 'moodle', array('class' => 'iconsmall')) . get_string('finish', 'auth_outage'),
$OUTPUT->pix_icon(
't/check',
get_string('finish', 'auth_outage'),
'moodle',
['class' => 'iconsmall']
)
. get_string('finish', 'auth_outage'),
[
'title' => get_string('finish', 'auth_outage'),
'class' => 'auth_outage_warningbar_box_finish',
]
'title' => get_string('finish', 'auth_outage'),
'class' => 'auth_outage_warningbar_box_finish',
]
);
$title .= ' '.html_writer::span($link, '', ['id' => 'auth_outage_warningbar_button']);
$title .= ' ' . html_writer::span($link, '', ['id' => 'auth_outage_warningbar_button']);
}
}
?>
<style>
<?php
readfile($CFG->dirroot.'/auth/outage/views/warningbar/warningbar.css');
readfile($CFG->dirroot . '/auth/outage/views/warningbar/warningbar.css');
echo outagelib::get_config()->css;
?>
</style>
@@ -73,11 +79,11 @@ if (!$viewbag['static']) {
</div>
</div>
<?php if (!$viewbag['static']): ?>
<?php if (!$viewbag['static']) : ?>
<script>
document.body.className += ' auth_outage';
<?php
require(__DIR__.'/warningbar.js');
require(__DIR__ . '/warningbar.js');
$json = json_encode([
'countdown' => $countdown,
'ongoing' => $ongoing,
@@ -89,7 +95,7 @@ if (!$viewbag['static']) {
'preview' => $viewbag['preview'],
'checkfinishedurl' => (string)(new moodle_url('/auth/outage/checkfinished.php')),
]);
echo 'authOutageWarningBar.init('.$json.');';
echo 'authOutageWarningBar.init(' . $json . ');';
?>
</script>
<?php endif;