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


PHP Subnets::reset_subnet_slaves_recursive方法代码示例

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


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

示例1: fetch_subnet_slaves_changlog_entries_recursive

 /**
  * Fetches changelog entries for all slave subnets recursive
  *
  * @access public
  * @param mixed $subnetId
  * @param int $limit (default: 50)
  * @return void
  */
 public function fetch_subnet_slaves_changlog_entries_recursive($subnetId, $limit = 50)
 {
     # limit check
     if (!is_numeric($limit)) {
         $this->Result->show("danger", "Invalid limit", true);
         return false;
     }
     # $subnetId check
     if (!is_numeric($subnetId)) {
         $this->Result->show("danger", "Invalid subnet Id", true);
         return false;
     }
     # fetch all slave subnet ids
     $Subnets = new Subnets($this->Database);
     $Subnets->reset_subnet_slaves_recursive();
     $Subnets->fetch_subnet_slaves_recursive($subnetId);
     # remove master subnet ID
     $key = array_search($subnetId, $Subnets->slaves);
     unset($Subnets->slaves[$key]);
     $Subnets->slaves = array_unique($Subnets->slaves);
     # if some slaves are present get changelog
     if (sizeof($Subnets->slaves) > 0) {
         # set query
         $query = "select\n\t\t\t\t\t\t`u`.`real_name`,`o`.`sectionId`,`o`.`subnet`,`o`.`mask`,`o`.`isFolder`,`o`.`description`,`o`.`id`,`c`.`caction`,`c`.`cresult`,`c`.`cdate`,`c`.`cdiff`  from `changelog` as `c`, `users` as `u`, `subnets` as `o`\n\t\t\t\t\t\twhere `c`.`cuser` = `u`.`id` and `c`.`coid`=`o`.`id`\n\t\t\t\t\t\tand (";
         foreach ($Subnets->slaves as $slaveId) {
             if (!isset($args)) {
                 $args = array();
             }
             $query .= "`c`.`coid` = ? or ";
             $args[] = $slaveId;
             //set keys
         }
         $query = substr($query, 0, -3);
         $query .= ") and `c`.`ctype` = 'subnet' order by `c`.`cid` desc limit {$limit};";
         # fetch
         try {
             $logs = $this->Database->getObjectsQuery($query, $args);
         } catch (Exception $e) {
             $this->Result->show("danger", $e->getMessage(), false);
             return false;
         }
         # return result
         return $logs;
     } else {
         return false;
     }
 }
开发者ID:routenull0,项目名称:phpipam,代码行数:55,代码来源:class.Log.php

示例2: foreach

         }
         # save to update array
         $values[$myField['name']] = $_POST[$myField['name']];
     }
 }
 # execute
 if (!$Subnets->modify_subnet($_POST['action'], $values)) {
     $Result->show("danger", _('Error editing subnet'), true);
 } else {
     # if add save id !
     if ($_POST['action'] == "add") {
         $new_subnet_id = $Subnets->lastInsertId;
     }
     # update also all slave subnets if section changes!
     if (isset($values['sectionId']) && $_POST['action'] == "edit" || $_POST['action'] == "delete") {
         $Subnets->reset_subnet_slaves_recursive();
         $Subnets->fetch_subnet_slaves_recursive($_POST['subnetId']);
         $Subnets->remove_subnet_slaves_master($_POST['subnetId']);
         if (sizeof($Subnets->slaves) > 0) {
             foreach ($Subnets->slaves as $slaveId) {
                 if ($_POST['action'] == "edit") {
                     $Admin->object_modify("subnets", "edit", "id", array("id" => $slaveId, "sectionId" => $_POST['sectionIdNew']));
                 } else {
                     $Admin->object_modify("subnets", "delete", "id", array("id" => $slaveId));
                 }
             }
         }
     }
     # edit success
     if ($_POST['action'] == "delete") {
         $Result->show("success", _('Subnet, IP addresses and all belonging subnets deleted successfully') . '!', false);
开发者ID:jselan,项目名称:phpipam,代码行数:31,代码来源:edit-result.php


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