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


PHP IPAddress::getHTMLTableCellsForItem方法代码示例

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


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

示例1: getHTMLTableCellsForItem

 /**
  * @since version 0.84
  *
  * @param $row             HTMLTableRow object (default NULL)
  * @param $item            CommonDBTM object (default NULL)
  * @param $father          HTMLTableCell object (default NULL)
  * @param $options   array
  **/
 static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
 {
     global $DB, $CFG_GLPI;
     $column_name = __CLASS__;
     if (empty($item)) {
         if (empty($father)) {
             return;
         }
         $item = $father->getItem();
     }
     switch ($item->getType()) {
         case 'FQDN':
             $JOINS = "";
             $ORDER = "`glpi_networknames`.`name`";
             if (isset($options['order'])) {
                 switch ($options['order']) {
                     case 'name':
                         break;
                     case 'ip':
                         $JOINS = " LEFT JOIN `glpi_ipaddresses`\n                                    ON (`glpi_ipaddresses`.`items_id` = `glpi_networknames`.`id`\n                                        AND `glpi_ipaddresses`.`itemtype` = 'NetworkName'\n                                        AND `glpi_ipaddresses`.`is_deleted` = '0')";
                         $ORDER = "ISNULL (`glpi_ipaddresses`.`id`),\n                               `glpi_ipaddresses`.`binary_3`, `glpi_ipaddresses`.`binary_2`,\n                               `glpi_ipaddresses`.`binary_1`, `glpi_ipaddresses`.`binary_0`";
                         break;
                     case 'alias':
                         $JOINS = " LEFT JOIN `glpi_networkaliases`\n                                    ON (`glpi_networkaliases`.`networknames_id`\n                                          = `glpi_networknames`.`id`)";
                         $ORDER = "ISNULL(`glpi_networkaliases`.`name`),\n                               `glpi_networkaliases`.`name`";
                         break;
                 }
             }
             $query = "SELECT `glpi_networknames`.`id`\n                      FROM `glpi_networknames`\n                      {$JOINS}\n                      WHERE `glpi_networknames`.`fqdns_id` = '" . $item->fields["id"] . "'\n                            AND `glpi_networknames`.`is_deleted` = '0'\n                      ORDER BY {$ORDER}";
             break;
         case 'NetworkPort':
             $query = "SELECT `id`\n                      FROM `glpi_networknames`\n                      WHERE `itemtype` = '" . $item->getType() . "'\n                            AND `items_id` = '" . $item->getID() . "'\n                            AND `glpi_networknames`.`is_deleted` = '0'";
             break;
         case 'NetworkEquipment':
             $query = "SELECT `glpi_networknames`.`id`\n                      FROM `glpi_networknames`, `glpi_networkports`\n                      WHERE `glpi_networkports`.`itemtype` = '" . $item->getType() . "'\n                            AND `glpi_networkports`.`items_id` ='" . $item->getID() . "'\n                            AND `glpi_networknames`.`itemtype` = 'NetworkPort'\n                            AND `glpi_networknames`.`items_id` = `glpi_networkports`.`id`\n                            AND `glpi_networknames`.`is_deleted` = '0'";
             break;
     }
     if (isset($options['SQL_options'])) {
         $query .= " " . $options['SQL_options'];
     }
     $canedit = isset($options['canedit']) && $options['canedit'];
     $createRow = isset($options['createRow']) && $options['createRow'];
     $options['createRow'] = false;
     $address = new self();
     foreach ($DB->request($query) as $line) {
         if ($address->getFromDB($line["id"])) {
             if ($createRow) {
                 $row = $row->createAnotherRow();
             }
             if (isset($options['massiveactionnetworkname']) && $options['massiveactionnetworkname']) {
                 $header = $row->getGroup()->getHeaderByName('Internet', 'delete');
                 $cell_value = Html::getMassiveActionCheckBox(__CLASS__, $line["id"]);
                 $delete_cell = $row->addCell($header, $cell_value, $father);
             }
             $internetName = $address->getInternetName();
             if (empty($internetName)) {
                 $internetName = "(" . $line["id"] . ")";
             }
             $content = $internetName;
             if (Session::haveRight('internet', READ)) {
                 $content = "<a href='" . $address->getLinkURL() . "'>" . $internetName . "</a>";
             }
             if (!isset($options['dont_display'][$column_name])) {
                 $header = $row->getGroup()->getHeaderByName('Internet', $column_name);
                 $name_cell = $row->addCell($header, $content, $father, $address);
                 if (isset($options['display_isDynamic']) && $options['display_isDynamic']) {
                     $dyn_header = $row->getGroup()->getHeaderByName('Internet', $column_name . '_dynamic');
                     $dynamic_cell = $row->addCell($dyn_header, Dropdown::getYesNo($address->fields['is_dynamic']), $name_cell);
                     $father_for_children = $dynamic_cell;
                 } else {
                     $father_for_children = $name_cell;
                 }
             } else {
                 $father_for_children = $father;
             }
             NetworkAlias::getHTMLTableCellsForItem($row, $address, $father_for_children, $options);
             IPAddress::getHTMLTableCellsForItem($row, $address, $father_for_children, $options);
         }
     }
 }
开发者ID:kipman,项目名称:glpi,代码行数:88,代码来源:networkname.class.php


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