当前位置: 首页>>代码示例>>PHP>>正文


PHP getlocations函数代码示例

本文整理汇总了PHP中getlocations函数的典型用法代码示例。如果您正苦于以下问题:PHP getlocations函数的具体用法?PHP getlocations怎么用?PHP getlocations使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getlocations函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

    echo '</ul></li>';
} else {
    echo '<li class="dropdown-submenu"><a href="#">No devices</a></li>';
}
if (count($devices_groups) > 0) {
    echo '<li class="dropdown-submenu"><a href="#"><i class="fa fa-th fa-fw fa-lg" aria-hidden="true"></i> Device Groups</a><ul class="dropdown-menu scrollable-menu">';
    foreach ($devices_groups as $group) {
        echo '<li><a href="' . generate_url(array('page' => 'devices', 'group' => $group['id'])) . '" title="' . $group['desc'] . '"><i class="fa fa-th fa-fw fa-lg" aria-hidden="true"></i> ' . ucfirst($group['name']) . '</a></li>';
    }
    unset($group);
    echo '</ul></li>';
}
if ($_SESSION['userlevel'] >= '10') {
    if ($config['show_locations']) {
        if ($config['show_locations_dropdown']) {
            $locations = getlocations();
            if (count($locations) > 0) {
                echo '
                    <li role="presentation" class="divider"></li>
                    <li class="dropdown-submenu">
                    <a href="#"><i class="fa fa-map-marker fa-fw fa-lg" aria-hidden="true"></i> Locations</a>
                    <ul class="dropdown-menu scrollable-menu">
                ';
                foreach ($locations as $location) {
                    echo '            <li><a href="devices/location=' . urlencode($location) . '/"><i class="fa fa-building-o fa-fw fa-lg" aria-hidden="true"></i> ' . $location . ' </a></li>';
                }
                echo '
                    </ul>
                    </li>
                ';
            }
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:print-menubar.php

示例2: drawRegionsMap

 */
?>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
    google.load('visualization', '1', {'packages': ['geochart']});
    google.setOnLoadCallback(drawRegionsMap);
    function drawRegionsMap() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Site');
        data.addColumn('number', 'Status');
        data.addColumn('number', 'Size');
        data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});
        data.addRows([
<?php 
$locations = array();
foreach (getlocations() as $location) {
    $devices = array();
    $devices_down = array();
    $devices_up = array();
    $count = 0;
    $down = 0;
    foreach (dbFetchRows("SELECT devices.device_id,devices.hostname,devices.status FROM devices LEFT JOIN devices_attribs ON devices.device_id = devices_attribs.device_id WHERE devices.location = ?  && devices.disabled = 0 && devices.ignore = 0 GROUP BY devices.hostname", array($location)) as $device) {
        if ($config['frontpage_globe']['markers'] == 'devices' || empty($config['frontpage_globe']['markers'])) {
            $devices[] = $device['hostname'];
            $count++;
            if ($device['status'] == "0") {
                $down++;
                $devices_down[] = $device['hostname'] . " DOWN";
            } else {
                $devices_up[] = $device;
            }
开发者ID:borkz,项目名称:librenms,代码行数:31,代码来源:globe.php

示例3: show_map

function show_map($config)
{
    ?>
<div class="row-fluid">
    <div class="span12" style="padding: 10px;">
	<script type='text/javascript' src='https://www.google.com/jsapi'></script>
	<script type='text/javascript'>
	    google.load('visualization', '1.1', {'packages': ['geochart']});
	    google.setOnLoadCallback(drawRegionsMap);
	    function drawRegionsMap() {
		var data = new google.visualization.DataTable();
		data.addColumn('number', 'Latitude');
                data.addColumn('number', 'Longitude');
                data.addColumn('string', 'Location');
		data.addColumn('number', 'Status');
		data.addColumn('number', 'Devices');
		data.addColumn({type: 'string', role: 'tooltip'});
		data.addRows([
		<?php 
    $locations_up = array();
    $locations_down = array();
    $devicesArray = array();
    foreach (dbFetchRows("SELECT * FROM devices") as $device) {
        $devicesArray[] = array("device_id" => $device['device_id'], "hostname" => $device['hostname'], "location" => $device['location'], "status" => $device['status'], "ignore" => $device['ignore'], "disabled" => $device['disabled'], "location_lat" => $device['location_lat'], "location_lon" => $device['location_lon']);
    }
    foreach (getlocations() as $location) {
        $location = addslashes($location);
        $devices = array();
        $devices_down = array();
        $devices_up = array();
        $count = 0;
        $down = 0;
        foreach ($devicesArray as $device) {
            if ($device['location'] == $location) {
                $devices[] = $device['hostname'];
                $count++;
                if ($device['status'] == "0" && $device['disabled'] == "0" && $device['ignore'] == "0") {
                    $down++;
                    $devices_down[] = $device['hostname'];
                } elseif ($device['status'] == "1") {
                    $devices_up[] = $device['hostname'];
                    $lat = $device['location_lat'];
                    $lon = $device['location_lon'];
                }
            }
        }
        $count = $count < 100 ? $count : "100";
        if ($down > 0) {
            $locations_down[] = "[" . $lat . ", " . $lon . ", '" . $location . "', " . $down . ", " . $count * $down . ", '" . count($devices_up) . " Devices OK, " . count($devices_down) . " Devices DOWN: (" . implode(", ", $devices_down) . ")']";
        } else {
            $locations_up[] = "[" . $lat . ", " . $lon . ", '" . $location . "', 0, " . $count . ", '" . count($devices_up) . " Devices UP: (" . implode(", ", $devices_up) . ")']";
        }
    }
    unset($devicesArray);
    echo implode(",\n", array_merge($locations_up, $locations_down));
    ?>
		]);
		var options = {
		    region: '<?php 
    echo $config['frontpage']['map']['region'];
    ?>
',
		    resolution: '<?php 
    echo $config['frontpage']['map']['resolution'];
    ?>
',
		    displayMode: 'markers',
		    keepAspectRatio: 0,
		    width: 1160,
		    height: 480,
		    is3D: true,
		    legend: 'none',
                    enableRegionInteractivity: true,
		    <?php 
    if ($config['frontpage']['map']['realworld']) {
        echo "\t\t    datalessRegionColor: '#93CA76',";
    } else {
        echo "\t\t    datalessRegionColor: '#d5d5d5',";
    }
    ?>
                    <?php 
    if ($config['frontpage']['map']['realworld']) {
        echo "\t\t    backgroundColor: {fill: '#cceef0'},";
    }
    ?>
		    magnifyingGlass: {enable: true, zoomFactor: 5},
		    colorAxis: {values: [0, 1, 2, 3], colors: ['darkgreen', 'orange', 'orangered', 'red']},
		    markerOpacity: 0.75,
                    sizeAxis: {minValue: 1,  maxValue: 10, minSize: 10, maxSize: 40}
		};
		var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
		chart.draw(data, options);
		google.visualization.events.addListener(chart, 'ready', onReady);
		function onReady() {
		    google.visualization.events.addListener(chart, 'select', gotoLocation);
		}
		function gotoLocation() {
		    var selection = chart.getSelection();
		    var item = selection[0];
		    var url = '<?php 
//.........这里部分代码省略.........
开发者ID:RomanBogachev,项目名称:observium,代码行数:101,代码来源:default.php


注:本文中的getlocations函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。