Exemplo n.º 1
0
<?php

/**
 * Script to display all slave IP addresses and subnets in content div of subnets table!
 ***************************************************************************************/
/* get all slaves */
$slaves = getAllSubnetsInSectionVlan($_GET['subnetId'], $_GET['section']);
/* if none */
if (!$slaves) {
    print "<hr>";
    print "<h4>" . _('VLAN') . " {$vlan['number']} (" . $vlan['description'] . ") " . _('has no belonging subnets') . "</h4>";
} else {
    /* print title */
    $slaveNum = sizeof($slaves);
    print "<h4>" . _('VLAN') . " {$vlan['number']} (" . $vlan['description'] . ") " . _('has') . " {$slaveNum} " . _('belonging subnets') . ":</h4><hr><br>";
    /* print HTML table */
    print '<table class="slaves table table-striped table-condensed table-hover table-full table-top">' . "\n";
    /* headers */
    print "<tr>";
    print "\t<th class='small description'>" . _('Subnet description') . "</th>";
    print "\t<th>" . _('Subnet') . "</th>";
    print "\t<th class='small hidden-xs hidden-sm'>" . _('Hosts check') . "</th>";
    print "\t<th class='small hidden-xs hidden-sm'>" . _('Used') . "</th>";
    print "\t<th class='small hidden-xs hidden-sm'>% " . _('Free') . "</th>";
    print "\t<th class='hidden-xs hidden-sm'>" . _('Requests') . "</th>";
    print " <th></th>";
    print "</tr>";
    /* print each slave */
    $usedSum = 0;
    $allSum = 0;
    # for free space check
Exemplo n.º 2
0
/**
 * Build the HTML menu for VLANS
 *
 * based on http://pastebin.com/GAFvSew4
 */
function get_menu_vlan($vlans, $sectionId)
{
    $html = array();
    # Menu start
    $html[] = '<ul id="subnets">';
    # loop through vlans
    foreach ($vlans as $item) {
        # set open / closed -> vlan directly
        if ($_REQUEST['vlanId'] == $item['vlanId'] && !isset($_REQUEST['subnetId'])) {
            $open = "open";
            $active = "active";
            $leafClass = "fa-gray";
        } elseif (isSubnetIdVlan($_REQUEST['subnetId'], $item['vlanId'])) {
            $open = "open";
            $active = "";
            $leafClass = "fa-gray";
        } else {
            $open = "close";
            $active = "";
            $leafClass = "fa-gray";
        }
        # new item
        $html[] = '<li class="folder folder-' . $open . ' ' . $active . '"><i class="fa fa-gray fa-folder-' . $open . '-o" rel="tooltip" data-placement="right" data-html="true" title="' . _('VLAN contains subnets') . '.<br>' . _('Click on folder to open/close') . '"></i>';
        $html[] = '<a href="vlan/' . $sectionId . '/' . $item['vlanId'] . '/" rel="tooltip" data-placement="right" title="' . $item['description'] . '">' . $item['number'] . ' (' . $item['name'] . ')</a>';
        # fetch all subnets in VLAN
        $subnets = getAllSubnetsInSectionVlan($item['vlanId'], $sectionId);
        # if some exist print next ul
        if ($subnets) {
            # print subnet
            if ($open == "open") {
                $html[] = '<ul class="submenu submenu-' . $open . '">';
            } else {
                $html[] = '<ul class="submenu submenu-' . $open . '" style="display:none">';
            }
            # hide - prevent flickering
            # loop through subnets
            foreach ($subnets as $subnet) {
                # check permission
                $permission = checkSubnetPermission($subnet['id']);
                if ($permission > 0) {
                    # for active class
                    if (isset($_REQUEST['subnetId']) && $subnet['id'] == $_REQUEST['subnetId']) {
                        $active = "active";
                        $leafClass = "";
                    } else {
                        $active = "";
                        $leafClass = "icon-gray";
                    }
                    # check if showName is set
                    if ($subnet['showName'] == 1) {
                        $html[] = '<li class="leaf ' . $active . '"><i class="' . $leafClass . ' fa fa-gray fa-angle-right"></i>';
                        $html[] = '<a href="subnets/' . $subnet['sectionId'] . '/' . $subnet['id'] . '/" rel="tooltip" data-placement="right" title="' . Transform2long($subnet['subnet']) . '/' . $subnet['mask'] . '">' . $subnet['description'] . '</a></li>';
                    } else {
                        $html[] = '<li class="leaf ' . $active . '""><i class="' . $leafClass . ' fa fa-gray fa-angle-right"></i>';
                        $html[] = '<a href="subnets/' . $subnet['sectionId'] . '/' . $subnet['id'] . '/" rel="tooltip" data-placement="right" title="' . $subnet['description'] . '">' . Transform2long($subnet['subnet']) . '/' . $subnet['mask'] . '</a></li>';
                    }
                }
            }
            # close ul
            $html[] = '</ul>';
            $html[] = '</li>';
        }
    }
    # Close menu
    $html[] = '</ul>';
    return implode("\n", $html);
}
Exemplo n.º 3
0
<?php

/**
 * Script to display all slave IP addresses and subnets in content div of subnets table!
 ***************************************************************************************/
/* get all slaves */
$slaves = getAllSubnetsInSectionVlan($_REQUEST['vlanId'], $_REQUEST['section']);
/* if none */
if (!$slaves) {
    print "<hr>";
    print "<h4>" . _('VLAN') . " {$vlan['number']} (" . $vlan['description'] . ") " . _('has no belonging subnets') . "</h4>";
} else {
    /* print title */
    $slaveNum = sizeof($slaves);
    print "<h4>" . _('VLAN') . " {$vlan['number']} (" . $vlan['description'] . ") " . _('has') . " {$slaveNum} " . _('belonging subnets') . ":</h4><hr><br>";
    /* print HTML table */
    print '<table class="slaves table table-striped table-condensed table-hover table-full table-top">' . "\n";
    /* headers */
    print "<tr>";
    print "\t<th class='small description'>" . _('Subnet description') . "</th>";
    print "\t<th>" . _('Subnet') . "</th>";
    print "\t<th class='small hidden-xs hidden-sm'>" . _('Hosts check') . "</th>";
    print "\t<th class='small hidden-xs hidden-sm'>" . _('Used') . "</th>";
    print "\t<th class='small hidden-xs hidden-sm'>% " . _('Free') . "</th>";
    print "\t<th class='hidden-xs hidden-sm'>" . _('Requests') . "</th>";
    print " <th></th>";
    print "</tr>";
    /* print each slave */
    $usedSum = 0;
    $allSum = 0;
    # for free space check