From 9d460a91d9cd94e5d2e176ed54882b7f465fdcab Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+github@gmail.com> Date: Tue, 26 Mar 2019 14:17:58 +0100 Subject: [PATCH] use consistent page titles, fixes #3 --- controllers/statistics.php | 23 ++++++++++++++++++++--- views/statistics/archive.php | 1 - views/statistics/database.php | 1 - views/statistics/files.php | 5 ++++- views/statistics/semesters.php | 4 ++-- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/controllers/statistics.php b/controllers/statistics.php index 1e720ed..24611ea 100644 --- a/controllers/statistics.php +++ b/controllers/statistics.php @@ -22,10 +22,10 @@ class StatisticsController extends PluginController $this->semester = Semester::findByTimestamp(strtotime('+8 weeks')); } - PageLayout::setTitle(sprintf( + $this->setTitle( _('Plugin-Statistiken (StandardPlugins der Veranstaltungen) für das %s'), $this->semester->name - )); + ); $this->getCached($this->semester->id, function () { $query = "SELECT plugins.pluginid AS id, @@ -85,7 +85,7 @@ class StatisticsController extends PluginController public function semesters_action() { - PageLayout::setTitle(_('Statistik der Semester')); + $this->setTitle(_('Semester')); $this->getCached('semesters', function () { // TODO: This query is slow due to missing indices either on @@ -125,6 +125,8 @@ class StatisticsController extends PluginController public function files_action () { + $this->setTitle(_('Dateien')); + $this->additional_labels = [ 'institute' => _('Einrichtungen'), 'message' => _('Nachrichten'), @@ -279,6 +281,8 @@ class StatisticsController extends PluginController public function widgets_action() { + $this->setTitle(_('Widgets')); + $query = "SELECT plu.pluginid, plu.enabled = 'yes' AS `enabled`, plu.pluginname AS `name`, @@ -306,6 +310,8 @@ class StatisticsController extends PluginController public function archive_action() { + $this->setTitle(_('Archiv')); + $query = "SELECT COUNT(DISTINCT semester) AS semesters, COUNT(name) AS courses, SUM(archiv_file_id != '') AS files, @@ -318,6 +324,8 @@ class StatisticsController extends PluginController public function database_action() { + $this->setTitle(_('Datenbank')); + $query = "SELECT `TABLE_NAME`, `TABLE_ROWS`, `DATA_LENGTH`, `INDEX_LENGTH`, @@ -477,4 +485,13 @@ class StatisticsController extends PluginController $this->$key = $value; } } + + private function setTitle($title) + { + $args = func_get_args(); + $title = vsprintf(array_shift($args), $args); + + $title = "{$this->plugin->getPluginname()} - {$title}"; + PageLayout::setTitle($title); + } } diff --git a/views/statistics/archive.php b/views/statistics/archive.php index 922bd3f..09bed40 100644 --- a/views/statistics/archive.php +++ b/views/statistics/archive.php @@ -3,7 +3,6 @@ <col width="200px"> <col> </colgroup> - <caption><?= _('Archiv-Statistik') ?></caption> <thead> <tr> <th colspan="2"><?= _('Informationen') ?></th> diff --git a/views/statistics/database.php b/views/statistics/database.php index c90203c..6852391 100644 --- a/views/statistics/database.php +++ b/views/statistics/database.php @@ -11,7 +11,6 @@ $relsize = function ($number) use ($numberReady) { }; ?> <table class="default statistics sortable-table"> - <caption><?= _('Datenbank-Statistik') ?></caption> <thead> <tr> <th data-sort="text"><?= _('Tabelle') ?></th> diff --git a/views/statistics/files.php b/views/statistics/files.php index 0cdad39..60f4097 100644 --- a/views/statistics/files.php +++ b/views/statistics/files.php @@ -1,5 +1,8 @@ <table class="default statistics"> - <caption><?= strftime('Dateiübersicht vom %x %X', $timestamp) ?></caption> + <caption> + <?= _('Stand') ?>: + <?= strftime('%x %X', $timestamp) ?> + </caption> <thead> <tr> <th rowspan="2"><?= _('Semester') ?></th> diff --git a/views/statistics/semesters.php b/views/statistics/semesters.php index 95d309b..cd80401 100644 --- a/views/statistics/semesters.php +++ b/views/statistics/semesters.php @@ -16,8 +16,8 @@ $numberReady = function ($number) { <thead> <tr> <th><?= _('Semester') ?></th> - <th><?= _('Studenten') ?></th> - <th><?= _('Dozenten') ?></th> + <th><?= _('Studierende') ?></th> + <th><?= _('Lehrende') ?></th> <th><?= _('Seminare') ?></th> </tr> </thead> -- GitLab