本文整理汇总了PHP中subnetGetVLANdetailsById函数的典型用法代码示例。如果您正苦于以下问题:PHP subnetGetVLANdetailsById函数的具体用法?PHP subnetGetVLANdetailsById怎么用?PHP subnetGetVLANdetailsById使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了subnetGetVLANdetailsById函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: printSubnets
/**
* Print subnets structure
*/
function printSubnets($subnets, $actions = true, $vrf = "0", $custom = array())
{
$html = array();
$rootId = 0;
# root is 0
if (sizeof($subnets) > 0) {
foreach ($subnets as $item) {
$children[$item['masterSubnetId']][] = $item;
}
}
# loop will be false if the root has no children (i.e., an empty menu!)
$loop = !empty($children[$rootId]);
# initializing $parent as the root
$parent = $rootId;
$parent_stack = array();
# display selected subnet as opened
if (isset($_REQUEST['subnetId'])) {
$allParents = getAllParents($_REQUEST['subnetId']);
}
# return table content (tr and td's)
while ($loop && (($option = each($children[$parent])) || $parent > $rootId)) {
# repeat
$repeat = str_repeat(" - ", count($parent_stack));
# dashes
if (count($parent_stack) == 0) {
$dash = "";
} else {
$dash = "-";
}
if (count($parent_stack) == 0) {
$margin = "0px";
$padding = "0px";
} else {
# padding
$padding = "10px";
# margin
$margin = count($parent_stack) * 10 - 10;
$margin = $margin * 2;
$margin = $margin . "px";
}
# count levels
$count = count($parent_stack) + 1;
# get subnet details
# get VLAN
$vlan = subnetGetVLANdetailsById($option['value']['vlanId']);
$vlan = $vlan['number'];
if (empty($vlan) || $vlan == "0") {
$vlan = "";
}
# no VLAN
# description
if (strlen($option['value']['description']) == 0) {
$description = "/";
} else {
$description = $option['value']['description'];
}
# description
# requests
if ($option['value']['allowRequests'] == 1) {
$requests = "<i class='fa fa-gray fa-check'></i>";
} else {
$requests = "";
}
# request disabled
# hosts check
if ($option['value']['pingSubnet'] == 1) {
$pCheck = "<i class='fa fa-gray fa-check'></i>";
} else {
$pCheck = "";
}
# ping check disabled
#vrf
if ($vrf == "1") {
# get VRF details
if ($option['value']['vrfId'] != "0" && $option['value']['vrfId'] != "NULL") {
$vrfTmp = getVRFDetailsById($option['value']['vrfId']);
$vrfText = $vrfTmp['name'];
} else {
$vrfText = "";
}
}
# print table line
if (strlen($option['value']['subnet']) > 0) {
// verify permission
$permission = checkSubnetPermission($option['value']['id']);
// print item
if ($permission != 0) {
$html[] = "<tr>";
# which level?
if ($count == 1) {
# is folder?
if ($option['value']['isFolder'] == 1) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-sfolder fa-pad-right-3 fa-folder-open'></i> <a href='folder/" . $option['value']['sectionId'] . "/" . $option['value']['id'] . "/'> {$description}</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-sfolder fa-pad-right-3 fa-folder-open'></i> {$description}</td>";
} else {
# last?
if (!empty($children[$option['value']['id']])) {
//.........这里部分代码省略.........
开发者ID:btorresgil,项目名称:phpipam,代码行数:101,代码来源:functions-common.php
示例2: printToolsSubnets
/**
* Print subnets structure
*/
function printToolsSubnets($subnets, $custom)
{
$html = array();
$rootId = 0;
# root is 0
# remove all not permitted!
foreach ($subnets as $k => $s) {
$permission = checkSubnetPermission($s['id']);
if ($permission == "0") {
unset($subnets[$k]);
}
}
if (sizeof($subnets) > 0) {
foreach ($subnets as $item) {
$children[$item['masterSubnetId']][] = $item;
}
}
# loop will be false if the root has no children (i.e., an empty menu!)
$loop = !empty($children[$rootId]);
# initializing $parent as the root
$parent = $rootId;
$parent_stack = array();
# display selected subnet as opened
if (isset($_GET['subnetId'])) {
$allParents = getAllParents($_GET['subnetId']);
}
# return table content (tr and td's)
while ($loop && (($option = each($children[$parent])) || $parent > $rootId)) {
# repeat
$repeat = str_repeat(" - ", count($parent_stack));
# dashes
if (count($parent_stack) == 0) {
$dash = "";
} else {
$dash = "-";
}
if (count($parent_stack) == 0) {
$margin = "0px";
$padding = "0px";
} else {
# padding
$padding = "10px";
# margin
$margin = count($parent_stack) * 10 - 10;
$margin = $margin * 2;
$margin = $margin . "px";
}
# count levels
$count = count($parent_stack) + 1;
# get subnet details
# get VLAN
$vlan = subnetGetVLANdetailsById($option['value']['vlanId']);
$vlan = $vlan['number'];
if (empty($vlan) || $vlan == "0") {
$vlan = "";
}
# no VLAN
# description
if (strlen($option['value']['description']) == 0) {
$description = "/";
} else {
$description = $option['value']['description'];
}
# description
# requests
if ($option['value']['allowRequests'] == 1) {
$requests = "<i class='fa fa-gray fa-check'></i>";
} else {
$requests = "";
}
# request disabled
# hosts check
if ($option['value']['pingSubnet'] == 1) {
$pCheck = "<i class='fa fa-gray fa-check'></i>";
} else {
$pCheck = "";
}
# ping check disabled
# print table line
if (strlen($option['value']['subnet']) > 0) {
$html[] = "<tr>";
# folder
if ($option['value']['isFolder'] == 1) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-sfolder fa-folder-open'></i> <a href='" . create_link("folder", $option['value']['sectionId'], $option['value']['id']) . "'>{$description}</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-sfolder fa-folder-open'></i> {$description}</td>";
} else {
if ($count == 1) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-folder-open-o'></i><a href='" . create_link("subnets", $option['value']['sectionId'], $option['value']['id']) . "'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-folder-open-o'></i> {$description}</td>";
} else {
# last?
if (!empty($children[$option['value']['id']])) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-folder-open-o'></i><a href='" . create_link("subnets", $option['value']['sectionId'], $option['value']['id']) . "'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-folder-open-o'></i> {$description}</td>";
} else {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-angle-right'></i><a href='" . create_link("subnets", $option['value']['sectionId'], $option['value']['id']) . "'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-angle-right'></i> {$description}</td>";
//.........这里部分代码省略.........
开发者ID:retexica,项目名称:phpipam,代码行数:101,代码来源:functions-tools.php
示例3: foreach
print "</tr>";
# subnets
if ($subnets) {
foreach ($subnets as $subnet) {
# check permission
$permission = checkSubnetPermission($subnet['id']);
if ($permission != "0") {
# check if it is master
if ($subnet['masterSubnetId'] == 0 || empty($subnet['masterSubnetId'])) {
$masterSubnet = true;
} else {
$masterSubnet = false;
}
print "<tr>";
# get VLAN details
$subnet['VLAN'] = subnetGetVLANdetailsById($subnet['vlanId']);
$subnet['VLAN'] = $subnet['VLAN']['number'];
# reformat empty VLAN
if (empty($subnet['VLAN']) || $subnet['VLAN'] == 0) {
$subnet['VLAN'] = "";
}
# get section name
$section = getSectionDetailsById($subnet['sectionId']);
print "\t<td>{$subnet['VLAN']}</td>";
print "\t<td>{$subnet['description']}</td>";
print "\t<td><a href='subnets/{$section['id']}/{$subnet['id']}/'>" . transform2long($subnet['subnet']) . "/{$subnet['mask']}</a></td>";
if ($masterSubnet) {
print ' <td>/</td>' . "\n";
} else {
$master = getSubnetDetailsById($subnet['masterSubnetId']);
# orphaned
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:vrf.php
示例4: checkAdmin
<?php
/**
* Print all available VRFs and configurations
************************************************/
/* required functions */
require_once '../../functions/functions.php';
/* verify that user is admin */
checkAdmin();
/* get post */
$vlanPost = $_POST;
/* get all available VRFs */
$vlan = subnetGetVLANdetailsById($_POST['vlanId']);
/* get custom fields */
$custom = getCustomFields('vlans');
if ($_POST['action'] == "delete") {
$readonly = "readonly";
} else {
$readonly = "";
}
/* set form name! */
if (isset($_POST['fromSubnet'])) {
$formId = "vlanManagementEditFromSubnet";
} else {
$formId = "vlanManagementEdit";
}
?>
<script type="text/javascript">
$(document).ready(function(){
if ($("[rel=tooltip]").length) { $("[rel=tooltip]").tooltip(); }
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:manageVLANEdit.php
示例5: getCustomFields
}
/* get custom subnet fields */
$customSubnetFields = getCustomFields('subnets');
$customSubnetFieldsSize = sizeof($customSubnetFields);
/**
* Get all ip addresses in subnet and subnet details!
*/
$ipaddresses = getIpAddressesBySubnetId($subnetId);
# for stats only
$SubnetDetails = getSubnetDetailsById($subnetId);
# die if empty!
if (sizeof($SubnetDetails) == 0) {
die('<div class="alert alert-danger">' . _('Subnet does not exist') . '!</div>');
}
# reset VLAN number!
$SubnetDetails['VLAN'] = subnetGetVLANdetailsById($SubnetDetails['vlanId']);
# get all site settings
$settings = getAllSettings();
/**
* Parse IP addresses
*
* We provide subnet and mask, all other is calculated based on it (subnet, broadcast,...)
*/
$SubnetParsed = parseIpAddress(transform2long($SubnetDetails['subnet']), $SubnetDetails['mask']);
# set rowspan
$rowSpan = 10 + $customSubnetFieldsSize;
# permissions
$permission = checkSubnetPermission($subnetId);
# section permissions
$permissionsSection = checkSectionPermission($SubnetDetails['sectionId']);
# if 0 die
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:subnetDetailsSlaves.php
示例6: printSubnets
/**
* Print subnets structure
*/
function printSubnets($subnets, $actions = true, $vrf = "0", $custom = array())
{
$html = array();
$rootId = 0;
# root is 0
if (sizeof($subnets) > 0) {
foreach ($subnets as $item) {
$children[$item['masterSubnetId']][] = $item;
}
}
# loop will be false if the root has no children (i.e., an empty menu!)
$loop = !empty($children[$rootId]);
# initializing $parent as the root
$parent = $rootId;
$parent_stack = array();
# display selected subnet as opened
if (isset($_REQUEST['subnetId'])) {
$allParents = getAllParents($_REQUEST['subnetId']);
}
# return table content (tr and td's)
while ($loop && (($option = each($children[$parent])) || $parent > $rootId)) {
# repeat
$repeat = str_repeat(" - ", count($parent_stack));
# dashes
if (count($parent_stack) == 0) {
$dash = "";
} else {
$dash = "-";
}
if (count($parent_stack) == 0) {
$margin = "0px";
$padding = "0px";
} else {
# padding
$padding = "10px";
# margin
$margin = count($parent_stack) * 10 - 10;
$margin = $margin * 2;
$margin = $margin . "px";
}
# count levels
$count = count($parent_stack) + 1;
# get subnet details
# get VLAN
$vlan = subnetGetVLANdetailsById($option['value']['vlanId']);
$vlan = $vlan['number'];
if (empty($vlan) || $vlan == "0") {
$vlan = "";
}
# no VLAN
# description
if (strlen($option['value']['description']) == 0) {
$description = "/";
} else {
$description = $option['value']['description'];
}
# description
# requests
if ($option['value']['allowRequests'] == 1) {
$requests = _("enabled");
} else {
$requests = "";
}
# request disabled
# hosts check
if ($option['value']['pingSubnet'] == 1) {
$pCheck = _("enabled");
} else {
$pCheck = "";
}
# ping check disabled
#vrf
if ($vrf == "1") {
# get VRF details
if ($option['value']['vrfId'] != "0" && $option['value']['vrfId'] != "NULL") {
$vrfTmp = getVRFDetailsById($option['value']['vrfId']);
$vrfText = $vrfTmp['name'];
} else {
$vrfText = "";
}
}
// <eNovance>
// count the number of free and offline hosts
$ipaddresses = getIpAddressesBySubnetId($option['value']['id']);
$reservedHosts = 0;
foreach ($ipaddresses as $ip) {
if ($ip['state'] == "2") {
$reservedHosts += 1;
}
}
$subnetDetails = calculateSubnetDetails(count($ipaddresses), $option['value']['mask'], $option['value']['subnet']);
$freeHosts = $subnetDetails['freehosts'];
// </eNovance>
# print table line
if (strlen($option['value']['subnet']) > 0) {
// verify permission
$permission = checkSubnetPermission($option['value']['id']);
//.........这里部分代码省略.........
开发者ID:krys1976,项目名称:phpipam-1,代码行数:101,代码来源:functions-common.php
示例7: printAdminSubnets
/**
* Print subnets structure
*/
function printAdminSubnets($subnets, $actions = true, $vrf = "0")
{
$html = array();
$rootId = 0;
# root is 0
if (sizeof($subnets) > 0) {
foreach ($subnets as $item) {
$item = (array) $item;
$children[$item['masterSubnetId']][] = $item;
}
}
/* get custom fields */
$custom = getCustomFields('subnets');
global $settings;
/* set hidden fields */
$ffields = json_decode($settings['hiddenCustomFields'], true);
if (is_array($ffields['subnets'])) {
$ffields = $ffields['subnets'];
} else {
$ffields = array();
}
# loop will be false if the root has no children (i.e., an empty menu!)
$loop = !empty($children[$rootId]);
# initializing $parent as the root
$parent = $rootId;
$parent_stack = array();
# display selected subnet as opened
if (isset($_GET['subnetId'])) {
if (!is_numeric($_GET['subnetId'])) {
die('<div class="alert alert-danger">' . _("Invalid ID") . '</div>');
}
$allParents = getAllParents($_GET['subnetId']);
}
# return table content (tr and td's)
while ($loop && (($option = each($children[$parent])) || $parent > $rootId)) {
# repeat
$repeat = str_repeat(" - ", count($parent_stack));
# dashes
if (count($parent_stack) == 0) {
$dash = "";
} else {
$dash = "-";
}
if (count($parent_stack) == 0) {
$margin = "0px";
$padding = "0px";
} else {
# padding
$padding = "10px";
# margin
$margin = count($parent_stack) * 10 - 10;
$margin = $margin * 2;
$margin = $margin . "px";
}
# count levels
$count = count($parent_stack) + 1;
# get VLAN
$vlan = subnetGetVLANdetailsById($option['value']['vlanId']);
$vlan = $vlan['number'];
if (empty($vlan) || $vlan == "0") {
$vlan = "";
}
# no VLAN
# description
if (strlen($option['value']['description']) == 0) {
$description = "/";
} else {
$description = $option['value']['description'];
}
# description
# requests
if ($option['value']['allowRequests'] == 1) {
$requests = "<i class='fa fa-gray fa-check'></i>";
} else {
$requests = "";
}
# request disabled
# hosts check
if ($option['value']['pingSubnet'] == 1) {
$pCheck = "<i class='fa fa-gray fa-check'></i>";
} else {
$pCheck = "";
}
# ping check disabled
#vrf
if ($vrf == "1") {
# get VRF details
if ($option['value']['vrfId'] != "0" && $option['value']['vrfId'] != "NULL") {
$vrfTmp = getVRFDetailsById($option['value']['vrfId']);
$vrfText = $vrfTmp['name'];
} else {
$vrfText = "";
}
}
# print table line
if (strlen($option['value']['subnet']) > 0) {
$html[] = "<tr>";
//.........这里部分代码省略.........
开发者ID:martinsv,项目名称:phpipam,代码行数:101,代码来源:functions-admin.php
注:本文中的subnetGetVLANdetailsById函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论