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


PHP Subnets::fetch_subnet_slaves方法代码示例

本文整理汇总了PHP中Subnets::fetch_subnet_slaves方法的典型用法代码示例。如果您正苦于以下问题:PHP Subnets::fetch_subnet_slaves方法的具体用法?PHP Subnets::fetch_subnet_slaves怎么用?PHP Subnets::fetch_subnet_slaves使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subnets的用法示例。


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

示例1: DNS

    if ($sort['direction'] == "asc") {
        $sort['directionNext'] = "desc";
    } else {
        $sort['directionNext'] = "asc";
    }
    # subnet-related variables
    $subnet = (array) $Subnets->fetch_subnet(null, $_POST['subnetId']);
    //subnet details
    $subnet_detailed = $Subnets->get_network_boundaries($subnet['subnet'], $subnet['mask']);
    //set network boundaries
    $slaves = $Subnets->has_slaves($subnet['id']) ? true : false;
    //check if subnet has slaves and set slaves flag true/false
    # fetch all addresses - sorted
    if ($slaves) {
        $addresses = $Addresses->fetch_subnet_addresses_recursive($subnet['id'], false, $sort['field'], $sort['direction']);
        $slave_subnets = (array) $Subnets->fetch_subnet_slaves($subnet['id']);
    } else {
        $addresses = $Addresses->fetch_subnet_addresses($subnet['id'], $sort['field'], $sort['direction']);
    }
    # set permissions
    $subnet_permission = $Subnets->check_permission($User->user, $subnet['id']);
}
# We need DNS object
$DNS = new DNS($Database, $User->settings);
/* verifications */
# checks
if (sizeof($subnet) == 0) {
    $Result->show("danger", _('Subnet does not exist'), true);
}
//subnet doesnt exist
if ($subnet_permission == 0) {
开发者ID:rtd,项目名称:phpipam,代码行数:31,代码来源:print-address-table.php

示例2: elseif

} elseif (!isset($out)) {
    print "<hr>";
    print "<blockquote style='margin-top:20px;margin-left:20px;'>";
    print "<p>" . _("No subnet selected for threshold check available") . "</p>";
    print "<small>" . _("No subnet with threshold check available") . "</small>";
    print "</blockquote>";
} else {
    print "<div class='hContent' style='padding:10px;'>";
    // count usage
    foreach ($out as $k => $s) {
        //check if subnet has slaves and set slaves flag true/false
        $slaves = $Subnets->has_slaves($s->id) ? true : false;
        # fetch all addresses and calculate usage
        if ($slaves) {
            $addresses = $Addresses->fetch_subnet_addresses_recursive($s->id, false);
            $slave_subnets = (array) $Subnets->fetch_subnet_slaves($s->id);
            // save count
            $addresses_cnt = gmp_strval(sizeof($addresses));
            # full ?
            if (sizeof($slave_subnets) > 0) {
                foreach ($slave_subnets as $ss) {
                    if ($ss->isFull == 1) {
                        # calculate max
                        $max_hosts = $Subnets->get_max_hosts($ss->mask, $Subnets->identify_address($ss->subnet), true);
                        # count
                        $count_hosts = $Addresses->count_subnet_addresses($ss->id);
                        # add
                        $addresses_cnt = gmp_strval(gmp_add($addresses_cnt, gmp_sub($max_hosts, $count_hosts)));
                    }
                }
            }
开发者ID:korhaldragonir,项目名称:phpipam,代码行数:31,代码来源:threshold.php


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