本文整理汇总了PHP中NetworkPort::getSearchOptionsToAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP NetworkPort::getSearchOptionsToAdd方法的具体用法?PHP NetworkPort::getSearchOptionsToAdd怎么用?PHP NetworkPort::getSearchOptionsToAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkPort
的用法示例。
在下文中一共展示了NetworkPort::getSearchOptionsToAdd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Get the SEARCH_OPTION array
*
* @param $itemtype
* @param $withplugins boolean get search options from plugins (true by default)
*
* @return the reference to array of search options for the given item type
**/
static function &getOptions($itemtype, $withplugins = true)
{
global $CFG_GLPI;
static $search = array();
$item = NULL;
if (!isset($search[$itemtype])) {
// standard type first
switch ($itemtype) {
case 'Internet':
$search[$itemtype]['common'] = __('Characteristics');
$search[$itemtype][1]['table'] = 'networkport_types';
$search[$itemtype][1]['field'] = 'name';
$search[$itemtype][1]['name'] = __('Name');
$search[$itemtype][1]['datatype'] = 'itemlink';
$search[$itemtype][1]['searchtype'] = 'contains';
$search[$itemtype][2]['table'] = 'networkport_types';
$search[$itemtype][2]['field'] = 'id';
$search[$itemtype][2]['name'] = __('ID');
$search[$itemtype][2]['searchtype'] = 'contains';
$search[$itemtype][31]['table'] = 'glpi_states';
$search[$itemtype][31]['field'] = 'completename';
$search[$itemtype][31]['name'] = __('Status');
$search[$itemtype] += NetworkPort::getSearchOptionsToAdd('networkport_types');
break;
case 'AllAssets':
$search[$itemtype]['common'] = __('Characteristics');
$search[$itemtype][1]['table'] = 'asset_types';
$search[$itemtype][1]['field'] = 'name';
$search[$itemtype][1]['name'] = __('Name');
$search[$itemtype][1]['datatype'] = 'itemlink';
$search[$itemtype][1]['searchtype'] = 'contains';
$search[$itemtype][2]['table'] = 'asset_types';
$search[$itemtype][2]['field'] = 'id';
$search[$itemtype][2]['name'] = __('ID');
$search[$itemtype][2]['searchtype'] = 'contains';
$search[$itemtype][31]['table'] = 'glpi_states';
$search[$itemtype][31]['field'] = 'completename';
$search[$itemtype][31]['name'] = __('Status');
$search[$itemtype] += Location::getSearchOptionsToAdd();
$search[$itemtype][5]['table'] = 'asset_types';
$search[$itemtype][5]['field'] = 'serial';
$search[$itemtype][5]['name'] = __('Serial number');
$search[$itemtype][6]['table'] = 'asset_types';
$search[$itemtype][6]['field'] = 'otherserial';
$search[$itemtype][6]['name'] = __('Inventory number');
$search[$itemtype][16]['table'] = 'asset_types';
$search[$itemtype][16]['field'] = 'comment';
$search[$itemtype][16]['name'] = __('Comments');
$search[$itemtype][16]['datatype'] = 'text';
$search[$itemtype][70]['table'] = 'glpi_users';
$search[$itemtype][70]['field'] = 'name';
$search[$itemtype][70]['name'] = __('User');
$search[$itemtype][7]['table'] = 'asset_types';
$search[$itemtype][7]['field'] = 'contact';
$search[$itemtype][7]['name'] = __('Alternate username');
$search[$itemtype][7]['datatype'] = 'string';
$search[$itemtype][8]['table'] = 'asset_types';
$search[$itemtype][8]['field'] = 'contact_num';
$search[$itemtype][8]['name'] = __('Alternate username number');
$search[$itemtype][8]['datatype'] = 'string';
$search[$itemtype][71]['table'] = 'glpi_groups';
$search[$itemtype][71]['field'] = 'completename';
$search[$itemtype][71]['name'] = __('Group');
$search[$itemtype][19]['table'] = 'asset_types';
$search[$itemtype][19]['field'] = 'date_mod';
$search[$itemtype][19]['name'] = __('Last update');
$search[$itemtype][19]['datatype'] = 'datetime';
$search[$itemtype][19]['massiveaction'] = false;
$search[$itemtype][23]['table'] = 'glpi_manufacturers';
$search[$itemtype][23]['field'] = 'name';
$search[$itemtype][23]['name'] = __('Manufacturer');
$search[$itemtype][24]['table'] = 'glpi_users';
$search[$itemtype][24]['field'] = 'name';
$search[$itemtype][24]['linkfield'] = 'users_id_tech';
$search[$itemtype][24]['name'] = __('Technician in charge of the hardware');
$search[$itemtype][80]['table'] = 'glpi_entities';
$search[$itemtype][80]['field'] = 'completename';
$search[$itemtype][80]['name'] = __('Entity');
break;
default:
if ($item = getItemForItemtype($itemtype)) {
$search[$itemtype] = $item->getSearchOptions();
}
break;
}
if (Session::getLoginUserID() && in_array($itemtype, $CFG_GLPI["ticket_types"])) {
$search[$itemtype]['tracking'] = __('Assistance');
$search[$itemtype][60]['table'] = 'glpi_tickets';
$search[$itemtype][60]['field'] = 'id';
$search[$itemtype][60]['datatype'] = 'count';
$search[$itemtype][60]['name'] = _x('quantity', 'Number of tickets');
$search[$itemtype][60]['forcegroupby'] = true;
//.........这里部分代码省略.........
示例2: array
/**
* Get the SEARCH_OPTION array
*
* @param $itemtype
* @param $withplugins boolean get search options from plugins
*
* @return the reference to array of search options for the given item type
**/
static function &getOptions($itemtype, $withplugins = true)
{
global $LANG, $CFG_GLPI;
static $search = array();
if (!isset($search[$itemtype])) {
// standard type first
if ($itemtype == 'States') {
$search[$itemtype]['common'] = $LANG['common'][32];
$search['States'][1]['table'] = 'state_types';
$search['States'][1]['field'] = 'name';
$search['States'][1]['name'] = $LANG['common'][16];
$search['States'][1]['datatype'] = 'itemlink';
$search['States'][1]['searchtype'] = 'contains';
$search['States'][2]['table'] = 'state_types';
$search['States'][2]['field'] = 'id';
$search['States'][2]['name'] = $LANG['common'][2];
$search['States'][2]['searchtype'] = 'contains';
$search['States'][31]['table'] = 'glpi_states';
$search['States'][31]['field'] = 'name';
$search['States'][31]['name'] = $LANG['state'][0];
$search['States'] += Location::getSearchOptionsToAdd();
$search['States'][5]['table'] = 'state_types';
$search['States'][5]['field'] = 'serial';
$search['States'][5]['name'] = $LANG['common'][19];
$search['States'][6]['table'] = 'state_types';
$search['States'][6]['field'] = 'otherserial';
$search['States'][6]['name'] = $LANG['common'][20];
$search['States'][16]['table'] = 'state_types';
$search['States'][16]['field'] = 'comment';
$search['States'][16]['name'] = $LANG['common'][25];
$search['States'][16]['datatype'] = 'text';
$search['States'][70]['table'] = 'glpi_users';
$search['States'][70]['field'] = 'name';
$search['States'][70]['name'] = $LANG['common'][34];
$search['States'][71]['table'] = 'glpi_groups';
$search['States'][71]['field'] = 'name';
$search['States'][71]['name'] = $LANG['common'][35];
$search['States'][19]['table'] = 'state_types';
$search['States'][19]['field'] = 'date_mod';
$search['States'][19]['name'] = $LANG['common'][26];
$search['States'][19]['datatype'] = 'datetime';
$search['States'][19]['massiveaction'] = false;
$search['States'][23]['table'] = 'glpi_manufacturers';
$search['States'][23]['field'] = 'name';
$search['States'][23]['name'] = $LANG['common'][5];
$search['States'][24]['table'] = 'glpi_users';
$search['States'][24]['field'] = 'name';
$search['States'][24]['name'] = $LANG['common'][10];
$search['States'][80]['table'] = 'glpi_entities';
$search['States'][80]['field'] = 'completename';
$search['States'][80]['name'] = $LANG['entity'][0];
} else {
if (class_exists($itemtype)) {
$item = new $itemtype();
$search[$itemtype] = $item->getSearchOptions();
}
}
if (getLoginUserID() && in_array($itemtype, $CFG_GLPI["ticket_types"])) {
$search[$itemtype]['tracking'] = $LANG['title'][24];
$search[$itemtype][60]['table'] = 'glpi_tickets';
$search[$itemtype][60]['linkfield'] = 'items_id';
$search[$itemtype][60]['field'] = 'count';
$search[$itemtype][60]['name'] = $LANG['stats'][13];
$search[$itemtype][60]['forcegroupby'] = true;
$search[$itemtype][60]['usehaving'] = true;
$search[$itemtype][60]['datatype'] = 'number';
$search[$itemtype][60]['massiveaction'] = false;
$search[$itemtype][60]['joinparams'] = array('jointype' => "itemtype_item", 'condition' => getEntitiesRestrictRequest('AND', 'NEWTABLE'));
}
if (in_array($itemtype, $CFG_GLPI["networkport_types"])) {
$search[$itemtype] += NetworkPort::getSearchOptionsToAdd($itemtype);
}
if (in_array($itemtype, $CFG_GLPI["contract_types"])) {
$search[$itemtype] += Contract::getSearchOptionsToAdd();
}
if (in_array($itemtype, $CFG_GLPI["infocom_types"])) {
$search[$itemtype] += Infocom::getSearchOptionsToAdd($itemtype);
}
if ($withplugins) {
// Search options added by plugins
$plugsearch = getPluginSearchOptions($itemtype);
if (count($plugsearch)) {
$search[$itemtype] += array('plugins' => $LANG['common'][29]);
$search[$itemtype] += $plugsearch;
}
}
// Complete linkfield if not define
if ($itemtype === 'States') {
$itemtable = 'states_types';
} else {
$itemtable = $item->getTable();
}
//.........这里部分代码省略.........
示例3: getSearchOptions
function getSearchOptions()
{
$tab = array();
$tab['common'] = __('Unmanaged device', 'fusioninventory');
$tab[1]['table'] = $this->getTable();
$tab[1]['field'] = 'name';
$tab[1]['linkfield'] = 'name';
$tab[1]['name'] = __('Name');
$tab[1]['datatype'] = 'itemlink';
$tab[1]['itemlink_type'] = $this->getType();
$tab[2]['table'] = $this->getTable();
$tab[2]['field'] = 'id';
$tab[2]['linkfield'] = '';
$tab[2]['name'] = __('ID');
$tab[3]['table'] = 'glpi_locations';
$tab[3]['field'] = 'name';
$tab[3]['linkfield'] = 'locations_id';
$tab[3]['name'] = __('Location');
$tab[3]['datatype'] = 'dropdown';
$tab[4]['table'] = $this->getTable();
$tab[4]['field'] = 'serial';
$tab[4]['linkfield'] = 'serial';
$tab[4]['name'] = __('Serial Number');
$tab[5]['table'] = $this->getTable();
$tab[5]['field'] = 'otherserial';
$tab[5]['linkfield'] = 'otherserial';
$tab[5]['name'] = __('Inventory number');
$tab[6]['table'] = $this->getTable();
$tab[6]['field'] = 'contact';
$tab[6]['linkfield'] = 'contact';
$tab[6]['name'] = __('Contact');
$tab[7]['table'] = $this->getTable();
$tab[7]['field'] = 'hub';
$tab[7]['linkfield'] = 'hub';
$tab[7]['name'] = __('Network hub', 'fusioninventory');
$tab[7]['datatype'] = 'bool';
$tab[8]['table'] = 'glpi_entities';
$tab[8]['field'] = 'completename';
$tab[8]['linkfield'] = 'entities_id';
$tab[8]['name'] = __('Entity');
$tab[9]['table'] = 'glpi_domains';
$tab[9]['field'] = 'name';
$tab[9]['linkfield'] = 'domain';
$tab[9]['name'] = __('Domain');
$tab[9]['datatype'] = 'dropdown';
$tab[10]['table'] = $this->getTable();
$tab[10]['field'] = 'comment';
$tab[10]['linkfield'] = 'comment';
$tab[10]['name'] = __('Comments');
$tab[10]['datatype'] = 'text';
$tab[13]['table'] = $this->getTable();
$tab[13]['field'] = 'item_type';
$tab[13]['linkfield'] = 'item_type';
$tab[13]['name'] = __('Type');
$tab[13]['datatype'] = 'dropdown';
$tab[14]['table'] = $this->getTable();
$tab[14]['field'] = 'date_mod';
$tab[14]['linkfield'] = '';
$tab[14]['name'] = __('Last update');
$tab[14]['datatype'] = 'datetime';
$tab[15]['table'] = $this->getTable();
$tab[15]['field'] = 'sysdescr';
$tab[15]['linkfield'] = '';
$tab[15]['name'] = __('Sysdescr', 'fusioninventory');
$tab[15]['datatype'] = 'text';
$tab[17]['table'] = 'glpi_plugin_fusioninventory_configsecurities';
$tab[17]['field'] = 'name';
$tab[17]['linkfield'] = 'plugin_fusioninventory_configsecurities_id';
$tab[17]['name'] = __('SNMP authentication', 'fusioninventory');
$tab[17]['datatype'] = 'dropdown';
$tab += NetworkPort::getSearchOptionsToAdd("PluginFusioninventoryUnmanaged");
return $tab;
}
示例4: getBlacklistedOptions
/**
* Add blacklisted fields for an itemtype
*
* @param $itemtype the itemtype
*
* @return the array of all blacklisted fields
*/
static function getBlacklistedOptions($itemtype)
{
global $CFG_GLPI;
//2 : id
// 19 : date_mod
// 80 : entity
$blacklist = array(2, 19, 80);
//add document fields
if (in_array($itemtype, $CFG_GLPI["document_types"])) {
$tabs = Document::getSearchOptionsToAdd();
$document_fields = array();
unset($tabs['document']);
foreach ($tabs as $k => $v) {
$document_fields[] = $k;
}
$blacklist = array_merge($blacklist, $document_fields);
}
//add infocoms fields
if (in_array($itemtype, $CFG_GLPI["infocom_types"])) {
$tabs = Infocom::getSearchOptionsToAdd($itemtype);
$infocom_fields = array();
unset($tabs['financial']);
foreach ($tabs as $k => $v) {
$infocom_fields[] = $k;
}
$blacklist = array_merge($blacklist, $infocom_fields);
}
//add contract fields
if (in_array($itemtype, $CFG_GLPI["contract_types"])) {
$tabs = Contract::getSearchOptionsToAdd();
$contract_fields = array();
unset($tabs['contract']);
foreach ($tabs as $k => $v) {
$contract_fields[] = $k;
}
$blacklist = array_merge($blacklist, $contract_fields);
}
//add networkport fields
if (in_array($itemtype, $CFG_GLPI["networkport_types"])) {
$tabs = NetworkPort::getSearchOptionsToAdd($itemtype);
$networkport_fields = array();
unset($tabs['network']);
foreach ($tabs as $k => $v) {
$networkport_fields[] = $k;
}
$blacklist = array_merge($blacklist, $networkport_fields);
}
//add ticket_types fields
if (in_array($itemtype, $CFG_GLPI["ticket_types"])) {
$ticket_fields = array(60, 140);
$blacklist = array_merge($blacklist, $ticket_fields);
}
return $blacklist;
}