Skip to content
Snippets Groups Projects
Commit 7a964a0c authored by David Siegfried's avatar David Siegfried
Browse files

add more stats

parent 25454a48
No related branches found
No related tags found
No related merge requests found
...@@ -20,11 +20,15 @@ class StatisticsController extends Controller ...@@ -20,11 +20,15 @@ class StatisticsController extends Controller
Navigation::activateItem('simplebbbconnector/statistics/index'); Navigation::activateItem('simplebbbconnector/statistics/index');
PageLayout::setTitle(_('Statistik')); PageLayout::setTitle(_('Statistik'));
$current_month_complete = Metric::getStatistics('current_month'); $current_month_complete = Metric::getStatistics('current_month');
$today_complete = Metric::getStatistics('today'); $current_week_complete = Metric::getStatistics('current_week');
$last_week_complete = Metric::getStatistics('last_week');
$today_complete = Metric::getStatistics('today');
$this->labels = json_encode(array_keys($current_month_complete)); $this->labels = json_encode(array_keys($current_month_complete));
$this->current_month_complete = json_encode(array_map('intval', array_values($current_month_complete))); $this->current_month_complete = json_encode(array_map('intval', array_values($current_month_complete)));
$this->today_complete = json_encode(array_map('intval', array_values($today_complete))); $this->current_week_complete = json_encode(array_map('intval', array_values($current_week_complete)));
$this->biggest_meetings = Metric::getStatistics('current_month', 'all', 10); $this->last_week_complete = json_encode(array_map('intval', array_values($last_week_complete)));
$this->today_complete = json_encode(array_map('intval', array_values($today_complete)));
$this->biggest_meetings = Metric::getStatistics('current_month', 'all', 10);
} }
} }
\ No newline at end of file
...@@ -137,22 +137,26 @@ class Metric extends SimpleORMap ...@@ -137,22 +137,26 @@ class Metric extends SimpleORMap
return \DBManager::get()->fetchOne($sql, $attributes); return \DBManager::get()->fetchOne($sql, $attributes);
} }
public static function getBiggestMeetings($filter = '')
{
}
private static function getFilter($filter = '') private static function getFilter($filter = '')
{ {
$result = []; $result = [];
if ($filter === 'current_month') { if ($filter === 'current_month') {
$result[] = (new \DateTime('first day of this month 00:00:00'))->format(self::BBB_DATETIME_FORMAT); $result[] = date(self::BBB_DATETIME_FORMAT, strtotime('first day of this month 00:00:00'));
$result[] = (new \DateTime('first day of next month 00:00:00'))->format(self::BBB_DATETIME_FORMAT); $result[] = date(self::BBB_DATETIME_FORMAT, strtotime('first day of next month 00:00:00'));
} }
if ($filter === 'today') { if ($filter === 'today') {
$result[] = (new \DateTime('today 00:00:00'))->format(self::BBB_DATETIME_FORMAT); $result[] = date(self::BBB_DATETIME_FORMAT, strtotime('today 00:00:00'));
$result[] = (new \DateTime('next day 00:00:00'))->format(self::BBB_DATETIME_FORMAT); $result[] = date(self::BBB_DATETIME_FORMAT, strtotime('next day 00:00:00'));
} }
if ($filter === 'current_week') {
$result[] = date(self::BBB_DATETIME_FORMAT, strtotime('monday this week 00:00:00'));
$result[] = date(self::BBB_DATETIME_FORMAT, strtotime('sunday this week 00:00:00'));
}
if ($filter === 'last_week') {
$result[] = date(self::BBB_DATETIME_FORMAT, strtotime('monday last week 00:00:00'));
$result[] = date(self::BBB_DATETIME_FORMAT, strtotime('sunday last week 00:00:00'));
}
return $result; return $result;
} }
} }
\ No newline at end of file
...@@ -7,7 +7,21 @@ ...@@ -7,7 +7,21 @@
<section> <section>
<canvas id="bar-chart" style="width: 100%; height: 400px"></canvas> <canvas id="bar-chart" style="width: 100%; height: 400px"></canvas>
<script> <script>
var ctx = document.getElementById('bar-chart').getContext('2d'); var ctx = document.getElementById('bar-chart').getContext('2d')
window.chartColors = {
redDark: 'rgba(255, 99, 132, 0.2)',
red: 'rgba(255, 99, 132, 1)',
blueDark: 'rgba(54, 162, 235, 0.2)',
blue: 'rgba(54, 162, 235, 1)',
yellowDark: 'rgba(255, 206, 86, 0.2)',
yellow: 'rgba(255, 206, 86, 1)',
greenDark: 'rgba(75, 192, 192, 0.2)',
green:'rgba(75, 192, 192, 1)',
purpleDark: 'rgba(153, 102, 255, 0.2)',
purple:'rgba(153, 102, 255, 1)',
brownDark:'rgba(255, 159, 64, 0.2)',
brown:'rgba(255, 159, 64, 1)'
};
var myChart = new Chart(ctx, { var myChart = new Chart(ctx, {
type: 'bar', type: 'bar',
data: { data: {
...@@ -16,43 +30,92 @@ ...@@ -16,43 +30,92 @@
label: '# <?= strftime('%B')?>', label: '# <?= strftime('%B')?>',
data: <?= $current_month_complete ?>, data: <?= $current_month_complete ?>,
backgroundColor: [ backgroundColor: [
'rgba(255, 99, 132, 0.2)', window.chartColors.redDark,
'rgba(54, 162, 235, 0.2)', window.chartColors.redDark,
'rgba(255, 206, 86, 0.2)', window.chartColors.redDark,
'rgba(75, 192, 192, 0.2)', window.chartColors.redDark,
'rgba(153, 102, 255, 0.2)', window.chartColors.redDark,
'rgba(255, 159, 64, 0.2)' window.chartColors.redDark,
window.chartColors.redDark,
], ],
borderColor: [ borderColor: [
'rgba(255, 99, 132, 1)', window.chartColors.red,
'rgba(54, 162, 235, 1)', window.chartColors.red,
'rgba(255, 206, 86, 1)', window.chartColors.red,
'rgba(75, 192, 192, 1)', window.chartColors.red,
'rgba(153, 102, 255, 1)', window.chartColors.red,
'rgba(255, 159, 64, 1)' window.chartColors.red,
window.chartColors.red,
], ],
borderWidth: 1 borderWidth: 1
}, { }, {
label: '# <?= _('Heute')?>', label: '# <?= _('Heute')?>',
data: <?= $today_complete ?>, data: <?= $today_complete ?>,
backgroundColor: [ backgroundColor: [
'rgba(255, 99, 132, 0.2)', window.chartColors.blueDark,
'rgba(54, 162, 235, 0.2)', window.chartColors.blueDark,
'rgba(255, 206, 86, 0.2)', window.chartColors.blueDark,
'rgba(75, 192, 192, 0.2)', window.chartColors.blueDark,
'rgba(153, 102, 255, 0.2)', window.chartColors.blueDark,
'rgba(255, 159, 64, 0.2)' window.chartColors.blueDark,
window.chartColors.blueDark,
], ],
borderColor: [ borderColor: [
'rgba(255, 99, 132, 1)', window.chartColors.blue,
'rgba(54, 162, 235, 1)', window.chartColors.blue,
'rgba(255, 206, 86, 1)', window.chartColors.blue,
'rgba(75, 192, 192, 1)', window.chartColors.blue,
'rgba(153, 102, 255, 1)', window.chartColors.blue,
'rgba(255, 159, 64, 1)' window.chartColors.blue,
window.chartColors.blue,
], ],
borderWidth: 1 borderWidth: 1
}] }, {
label: '# <?= _('Diese Woche')?>',
data: <?= $current_week_complete ?>,
backgroundColor: [
window.chartColors.greenDark,
window.chartColors.greenDark,
window.chartColors.greenDark,
window.chartColors.greenDark,
window.chartColors.greenDark,
window.chartColors.greenDark,
window.chartColors.greenDark,
],
borderColor: [
window.chartColors.green,
window.chartColors.green,
window.chartColors.green,
window.chartColors.green,
window.chartColors.green,
window.chartColors.green,
window.chartColors.green,
],
borderWidth: 1
}, {
label: '# <?= _('Letzte Woche')?>',
data: <?= $last_week_complete ?>,
backgroundColor: [
window.chartColors.yellowDark,
window.chartColors.yellowDark,
window.chartColors.yellowDark,
window.chartColors.yellowDark,
window.chartColors.yellowDark,
window.chartColors.yellowDark,
window.chartColors.yellowDark,
],
borderColor: [
window.chartColors.yellow,
window.chartColors.yellow,
window.chartColors.yellow,
window.chartColors.yellow,
window.chartColors.yellow,
window.chartColors.yellow,
window.chartColors.yellow,
],
borderWidth: 1
}
]
}, },
options: { options: {
scales: { scales: {
...@@ -68,30 +131,30 @@ ...@@ -68,30 +131,30 @@
</section> </section>
<? if (!empty($biggest_meetings)) : ?> <? if (!empty($biggest_meetings)) : ?>
<table class="default"> <table class="default">
<caption><?= _('Die größesten Konferezen')?></caption> <caption><?= sprintf(_('Die größesten Konferezen (im %s)'), strftime('%B')) ?></caption>
<thead> <thead>
<tr> <tr>
<th><?= _('Meeting-Name')?></th> <th><?= _('Meeting-Name') ?></th>
<th><?= _('Anzahl TeilnehmerInnen')?></th> <th><?= _('Anzahl TeilnehmerInnen') ?></th>
<th><?= _('Anzahl Video')?></th> <th><?= _('Anzahl Video') ?></th>
<th><?= _('Anzahl ZuhörerInnen')?></th> <th><?= _('Anzahl ZuhörerInnen') ?></th>
<th><?= _('Anzahl Audio')?></th> <th><?= _('Anzahl Audio') ?></th>
<th><?= _('Anzahl ModeratorenInnen')?></th> <th><?= _('Anzahl ModeratorenInnen') ?></th>
<th><?= _('Ist BreakOut-Raum')?></th> <th><?= _('Ist BreakOut-Raum') ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<? foreach($biggest_meetings as $meeting) : ?> <? foreach ($biggest_meetings as $meeting) : ?>
<tr> <tr>
<td><?= htmlReady($meeting['meeting_name'])?></td> <td><?= htmlReady($meeting['meeting_name']) ?></td>
<td><?= htmlReady($meeting['participant_count'])?></td> <td><?= htmlReady($meeting['participant_count']) ?></td>
<td><?= htmlReady($meeting['video_count'])?></td> <td><?= htmlReady($meeting['video_count']) ?></td>
<td><?= htmlReady($meeting['listener_count'])?></td> <td><?= htmlReady($meeting['listener_count']) ?></td>
<td><?= htmlReady($meeting['voice_participant_count'])?></td> <td><?= htmlReady($meeting['voice_participant_count']) ?></td>
<td><?= htmlReady($meeting['moderator_count'])?></td> <td><?= htmlReady($meeting['moderator_count']) ?></td>
<td><?= $meeting['is_break_out'] === 1 ? _('Ja'): _('Nein')?></td> <td><?= $meeting['is_break_out'] === 1 ? _('Ja') : _('Nein') ?></td>
</tr> </tr>
<? endforeach?> <? endforeach ?>
</tbody> </tbody>
</table> </table>
<? endif ?> <? endif ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment