summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/index/index.phtml
blob: 220dec7724c465927fb3080a35a62fa0ba2534c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
?>
<script type="text/javascript">
    <?php
    echo 'var map_default_zoom = ' . (!empty($this->default_zoom) ? $this->default_zoom : "null") . ";\n";
    echo 'var map_default_long = ' . (!empty($this->default_long) ? $this->default_long : "null") . ";\n";
    echo 'var map_default_lat = ' . (!empty($this->default_lat) ? $this->default_lat : "null") . ";\n";
    echo 'var map_max_zoom = ' . $this->max_zoom . ";\n";
    echo 'var map_max_native_zoom = ' . $this->max_native_zoom . ";\n";
    echo 'var map_min_zoom = ' . $this->min_zoom . ";\n";
    echo 'var disable_cluster_at_zoom = ' . $this->disable_cluster_at_zoom . ";\n";
    echo "var tile_url = '" . $this->tile_url . "';\n";
    echo "var cluster_problem_count = " . $this->cluster_problem_count . ";\n";
    echo 'var map_show_host = "' . $this->host . "\";\n";
    ?>
    var service_status = {};
    service_status[0] = ['<?= $this->translate('OK', 'icinga.state') ?>', 'OK'];
    service_status[1] = ['<?= $this->translate('WARNING', 'icinga.state') ?>', 'WARNING'];
    service_status[2] = ['<?= $this->translate('CRITICAL', 'icinga.state') ?>', 'CRITICAL'];
    service_status[3] = ['<?= $this->translate('UNKNOWN', 'icinga.state') ?>', 'UNKNOWN'];
    service_status[99] = ['<?= $this->translate('PENDING', 'icinga.state') ?>', 'PENDING'];

    // @TODO: Is there a better way of translation in JS-Code?
    <?php
    $toTranslate = array(
        "btn-zoom-in" => "Zoom in",
        "btn-zoom-out" => "Zoom out",
        "btn-dashboard" => "Add to dashboard",
        "btn-fullscreen" => "Fullscreen",
        "btn-default" => "Show default view",
        "btn-locate" => "Show current location",
        "host-down" => "Host is down"
    );

    print("var translation = {");
    foreach ($toTranslate as $key => $value) {
        printf("'%s': '%s',", $key, $this->translate($value));
    }
    print("};\n");
    ?>

    var url_parameters = "<?=$this->url_parameters; ?>";
    var id = '<?= $this->id ?>';
    var dashlet = <?= $this->compact ? 'true' : 'false' ?>;
    var expand = <?= $this->expand ? 'true' : 'false' ?>;
</script>
<div class="controls">
    <?php if (!$this->compact && !$this->fullscreen): ?>
        <?= $this->tabs ?>
    <?php endif ?>
</div>
<div class="content">
    <div <?= ($this->compact ? 'style="height:' . $this->dashletHeight . 'px;" ' : ""); ?>id="map-<?= $this->id ?>"
         class="map<?php if ($this->compact): ?>
 compact
<?php endif ?>"></div>
</div>