/** * Get available display options array * * @since version 0.84 * * @return all the options **/ static function getAvailableDisplayOptions() { $options[__('Global displays')] = array('characteristics' => array('name' => __('Characteristics'), 'default' => true), 'internet' => array('name' => __('Internet information'), 'default' => true), 'dynamic_import' => array('name' => __('Automatic inventory'), 'default' => false)); $options[__('Common options')] = NetworkPortInstantiation::getGlobalInstantiationNetworkPortDisplayOptions(); $options[__('Internet information')] = array('names' => array('name' => NetworkName::getTypeName(2), 'default' => false), 'aliases' => array('name' => NetworkAlias::getTypeName(2), 'default' => false), 'ipaddresses' => array('name' => IPAddress::getTypeName(2), 'default' => true), 'ipnetworks' => array('name' => IPNetwork::getTypeName(2), 'default' => true)); foreach (self::getNetworkPortInstantiations() as $portType) { $portTypeName = $portType::getTypeName(0); $options[$portTypeName] = $portType::getInstantiationNetworkPortDisplayOptions(); } return $options; }
/** * @param $tab array the array to fill * @param $joinparams array * @param $itemtype **/ static function getSearchOptionsToAdd(array &$tab, array $joinparams, $itemtype) { $tab[126]['table'] = 'glpi_ipaddresses'; $tab[126]['field'] = 'name'; $tab[126]['name'] = __('IP'); $tab[126]['forcegroupby'] = true; $tab[126]['massiveaction'] = false; $tab[126]['joinparams'] = array('jointype' => 'mainitemtype_mainitem', 'condition' => 'AND NEWTABLE.`is_deleted` = 0'); $tab[127]['table'] = 'glpi_networknames'; $tab[127]['field'] = 'name'; $tab[127]['name'] = self::getTypeName(Session::getPluralNumber()); $tab[127]['forcegroupby'] = true; $tab[127]['massiveaction'] = false; $tab[127]['joinparams'] = $joinparams; $tab[128]['table'] = 'glpi_networkaliases'; $tab[128]['field'] = 'name'; $tab[128]['name'] = NetworkAlias::getTypeName(Session::getPluralNumber()); $tab[128]['forcegroupby'] = true; $tab[128]['massiveaction'] = false; $tab[128]['joinparams'] = array('jointype' => 'child', 'beforejoin' => array('table' => 'glpi_networknames', 'joinparams' => $joinparams)); }
$alias->check($_POST['id'], PURGE); $item = $alias->getItem(); $alias->delete($_POST, 1); Event::log($_POST["id"], "networkname", 5, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"])); if ($item) { Html::redirect($item->getLinkURL()); } else { Html::redirect($CFG_GLPI["root_doc"] . "/front/central.php"); } } else { if (isset($_POST["update"])) { $alias->check($_POST["id"], UPDATE); $alias->update($_POST); Event::log($_POST["id"], $alias->getType(), 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"])); Html::back(); } } } if (isset($_GET['_in_modal'])) { Html::popHeader(NetworkAlias::getTypeName(1), $_SERVER['PHP_SELF']); $alias->showForm($_GET["id"], $_GET); Html::popFooter(); } else { if (!isset($_GET["id"])) { $_GET["id"] = ""; } Session::checkRight("internet", UPDATE); Html::header(NetworkAlias::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], 'assets'); $alias->display($_GET); Html::footer(); }
$alias->delete($_POST); Event::log($_POST["id"], $alias->getType(), 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"])); if ($item) { Html::redirect($item->getLinkURL()); } else { Html::redirect($CFG_GLPI['root_doc'] . "/front/central.php"); } } else { if (isset($_POST["update"])) { $alias->check($_POST["id"], 'w'); $alias->update($_POST); Ajax::refreshPopupMainWindow(); Event::log($_POST["id"], $alias->getType(), 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"])); Html::back(); } } } if (isset($_GET['popup'])) { Html::popHeader(NetworkAlias::getTypeName(1), $_SERVER['PHP_SELF']); if (isset($_GET["rand"])) { $_SESSION["glpipopup"]["rand"] = $_GET["rand"]; } $alias->showForm($_GET["id"], $_GET); echo "<div class='center'><br><a href='javascript:window.close()'>" . __('Back') . "</a>"; echo "</div>"; Html::popFooter(); } else { Html::header(NetworkAlias::getTypeName(2), $_SERVER['PHP_SELF'], 'inventory'); $alias->showForm($_GET["id"], $_GET); Html::footer(); }
/** * @param $tab array the array to fill * @param $joinparams array * @param $itemtype **/ static function getSearchOptionsToAdd(array &$tab, array $joinparams, $itemtype) { $tab[20]['table'] = 'glpi_ipaddresses'; $tab[20]['field'] = 'name'; $tab[20]['name'] = __('IP'); $tab[20]['forcegroupby'] = true; $tab[20]['massiveaction'] = false; $tab[20]['joinparams'] = array('jointype' => 'itemtype_item', 'specific_itemtype' => 'NetworkName', 'beforejoin' => array('table' => 'glpi_networknames', 'joinparams' => $joinparams)); $tab[27]['table'] = 'glpi_networknames'; $tab[27]['field'] = 'name'; $tab[27]['name'] = self::getTypeName(2); $tab[27]['forcegroupby'] = true; $tab[27]['massiveaction'] = false; $tab[27]['joinparams'] = $joinparams; $tab[28]['table'] = 'glpi_networkaliases'; $tab[28]['field'] = 'name'; $tab[28]['name'] = NetworkAlias::getTypeName(2); $tab[28]['forcegroupby'] = true; $tab[28]['massiveaction'] = false; $tab[28]['joinparams'] = array('jointype' => 'child', 'beforejoin' => array('table' => 'glpi_networknames', 'joinparams' => $joinparams)); }