~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to theme/default/html/stats_page_availability.php

  • Committer: Dan Garner
  • Date: 2015-03-26 14:08:33 UTC
  • Revision ID: git-v1:70d14044444f8dc5d602b99890d59dea46d9470c
Moved web servable files to web folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/*
3
 
 * Xibo - Digital Signage - http://www.xibo.org.uk
4
 
 * Copyright (C) 2006-2013 Daniel Garner
5
 
 *
6
 
 * This file is part of Xibo.
7
 
 *
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
11
 
 * any later version. 
12
 
 *
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.
17
 
 *
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/>.
20
 
 */
21
 
use Xibo\Helper\Theme;
22
 
 
23
 
defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
24
 
?>
25
 
<div class="row">
26
 
    <div class="col-md-12">
27
 
        <div id="availabilityChart" class="morrisChart" style="height: 230px;"></div>
28
 
    </div>
29
 
</div>
30
 
 
31
 
<?php if (Theme::Get('availabilityWidget') != '') { ?>
32
 
<script type="text/javascript">
33
 
 
34
 
    var yKeys = ['value'];
35
 
    var labels = ['<?php echo Theme::Translate("Downtime"); ?>'];
36
 
    var availabilityChart = {
37
 
        type: 'bar',
38
 
        data: {
39
 
            element: 'availabilityChart',
40
 
            data: <?php echo Theme::Get('availabilityWidget'); ?>,
41
 
            xkey: 'label',
42
 
            ykeys: yKeys,
43
 
            labels: labels,
44
 
            stacked: false,
45
 
            postUnits: 'min',
46
 
            hoverCallback: function (index, options, content, row) {
47
 
                console.log(row);
48
 
                return secondsToTime(row.value * 60);
49
 
            }
50
 
        }
51
 
    };
52
 
 
53
 
    function secondsToTime(secs)
54
 
    {
55
 
        secs = Math.round(secs);
56
 
        var hours = Math.floor(secs / (60 * 60));
57
 
 
58
 
        var divisor_for_minutes = secs % (60 * 60);
59
 
        var minutes = Math.floor(divisor_for_minutes / 60);
60
 
 
61
 
        var divisor_for_seconds = divisor_for_minutes % 60;
62
 
        var seconds = Math.ceil(divisor_for_seconds);
63
 
 
64
 
        return hours + ":" + minutes + ":" + seconds;
65
 
    }
66
 
</script>
67
 
<?php } ?>