3
* Xibo - Digital Signage - http://www.xibo.org.uk
4
* Copyright (C) 2006-2013 Daniel Garner
6
* This file is part of Xibo.
8
* Xibo is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Affero General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
13
* Xibo is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Affero General Public License for more details.
18
* You should have received a copy of the GNU Affero General Public License
19
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
use Xibo\Helper\Theme;
23
defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
26
<div class="col-md-12">
27
<div id="availabilityChart" class="morrisChart" style="height: 230px;"></div>
31
<?php if (Theme::Get('availabilityWidget') != '') { ?>
32
<script type="text/javascript">
34
var yKeys = ['value'];
35
var labels = ['<?php echo Theme::Translate("Downtime"); ?>'];
36
var availabilityChart = {
39
element: 'availabilityChart',
40
data: <?php echo Theme::Get('availabilityWidget'); ?>,
46
hoverCallback: function (index, options, content, row) {
48
return secondsToTime(row.value * 60);
53
function secondsToTime(secs)
55
secs = Math.round(secs);
56
var hours = Math.floor(secs / (60 * 60));
58
var divisor_for_minutes = secs % (60 * 60);
59
var minutes = Math.floor(divisor_for_minutes / 60);
61
var divisor_for_seconds = divisor_for_minutes % 60;
62
var seconds = Math.ceil(divisor_for_seconds);
64
return hours + ":" + minutes + ":" + seconds;