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


PHP Contract::getSearchOptionsToAdd方法代码示例

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


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

示例1: 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();
         }
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:search.class.php

示例2: 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;
//.........这里部分代码省略.........
开发者ID:jose-martins,项目名称:glpi,代码行数:101,代码来源:search.class.php

示例3: 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;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:61,代码来源:commoninjectionlib.class.php


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