本文整理匯總了PHP中CommonDevice::getDeviceTypes方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonDevice::getDeviceTypes方法的具體用法?PHP CommonDevice::getDeviceTypes怎麽用?PHP CommonDevice::getDeviceTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonDevice
的用法示例。
在下文中一共展示了CommonDevice::getDeviceTypes方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDeviceTypes
/**
* Get all the kind of devices available inside the system.
* This method is equivalent to getItemAffinities('')
*
* @return array of the types of Item_Device* available
**/
static function getDeviceTypes()
{
global $CFG_GLPI;
// If the size of $CFG_GLPI['item_device_types'] and $CFG_GLPI['device_types'] then,
// there is new device_types and we must update item_device_types !
if (!isset($CFG_GLPI['item_device_types']) || count($CFG_GLPI['item_device_types']) != count($CFG_GLPI['device_types'])) {
$CFG_GLPI['item_device_types'] = array();
foreach (CommonDevice::getDeviceTypes() as $deviceType) {
$CFG_GLPI['item_device_types'][] = $deviceType::getItem_DeviceType();
}
}
return $CFG_GLPI['item_device_types'];
}
示例2: getItemtypesThatCanHave
/**
* Get all the types that can have a document
*
* @since version 0.85
*
* @return array of the itemtypes
**/
static function getItemtypesThatCanHave()
{
global $CFG_GLPI;
return array_merge($CFG_GLPI['document_types'], CommonDevice::getDeviceTypes(), Item_Devices::getDeviceTypes());
}
示例3: update084to085
//.........這裏部分代碼省略.........
$DB->queryOrDie($query, "0.85 fix tags usage for storestatus");
}
}
}
// Upgrade ticket bookmarks
$query = "SELECT *\n FROM `glpi_bookmarks`";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) > 0) {
while ($data = $DB->fetch_assoc($result)) {
$num = 0;
$num2 = 0;
$options = array();
parse_str($data["query"], $options);
if (isset($options['field'])) {
// update ticket statuses
if (($data['itemtype'] = 'Ticket') && $data['type'] == Bookmark::SEARCH) {
foreach ($options['field'] as $key => $val) {
if (($val == 55 || $val == 52) && isset($options['contains'][$key])) {
if (isset($status[$options['contains'][$key]])) {
$options['contains'][$key] = $status[$options['contains'][$key]];
}
}
}
}
}
$query2 = "UPDATE `glpi_bookmarks`\n SET `query` = '" . addslashes(Toolbox::append_params($options)) . "'\n WHERE `id` = '" . $data['id'] . "'";
$DB->queryOrDie($query2, "0.85 update bookmarks");
}
}
}
//////////////////////////////////////////////////
// Device update
$migration->displayMessage(sprintf(__('Data migration - %s'), 'Devices'));
foreach (array_merge(CommonDevice::getDeviceTypes(), Item_Devices::getDeviceTypes()) as $itemtype) {
$table = $itemtype::getTable();
if (!FieldExists($table, 'entities_id')) {
$migration->addField($table, 'entities_id', 'integer');
$migration->addKey($table, array('entities_id'), 'entities_id');
}
if (!FieldExists($table, 'is_recursive')) {
$migration->addField($table, 'is_recursive', 'bool', array('update' => '1', 'after' => 'entities_id'));
$migration->addKey($table, array('is_recursive'), 'is_recursive');
}
}
// Adding the Registered ID class that contains PCI IDs and USB IDs for vendors
// as well devices
if (!TableExists('glpi_registeredids')) {
$query = "CREATE TABLE `glpi_registeredids` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `name` varchar(255) DEFAULT NULL,\n `items_id` int(11) NOT NULL DEFAULT '0',\n `itemtype` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n `device_type` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT 'USB, PCI ...',\n PRIMARY KEY (`id`),\n KEY `name` (`name`),\n KEY `item` (`items_id`, `itemtype`),\n KEY `device_type` (`device_type`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$DB->queryOrDie($query, "0.85 add table glpi_registeredids");
}
// Complete the item_devices
foreach (array('glpi_items_devicecases', 'glpi_items_devicecontrols', 'glpi_items_devicedrives', 'glpi_items_devicegraphiccards', 'glpi_items_devicemotherboards', 'glpi_items_devicenetworkcards', 'glpi_items_devicepcis', 'glpi_items_devicepowersupplies', 'glpi_items_devicesoundcards') as $table) {
if (!FieldExists($table, 'serial')) {
$migration->addField($table, 'serial', 'string');
$migration->addKey($table, 'serial');
}
}
foreach (array('glpi_items_devicecontrols', 'glpi_items_devicedrives', 'glpi_items_devicegraphiccards', 'glpi_items_deviceharddrives', 'glpi_items_devicememories', 'glpi_items_devicenetworkcards', 'glpi_items_devicepcis', 'glpi_items_deviceprocessors', 'glpi_items_devicesoundcards') as $table) {
if (!FieldExists($table, 'busID')) {
$migration->addField($table, 'busID', 'string');
$migration->addKey($table, 'busID');
}
}
// Add key
foreach (array('glpi_items_devicecases', 'glpi_items_devicecontrols', 'glpi_items_devicedrives', 'glpi_items_devicegraphiccards', 'glpi_items_deviceharddrives', 'glpi_items_devicememories', 'glpi_items_devicemotherboards', 'glpi_items_devicenetworkcards', 'glpi_items_devicepcis', 'glpi_items_devicepowersupplies', 'glpi_items_deviceprocessors', 'glpi_items_devicesoundcards') as $table) {
$migration->dropKey($table, 'item');
示例4: getDeviceItemTypes
/**
* Get the Device list name the user is allowed to edit
*
* @return array (group of dropdown) of array (itemtype => localized name)
**/
static function getDeviceItemTypes()
{
global $CFG_GLPI;
static $optgroup = NULL;
if (!Session::haveRightsOr('device', array(CREATE, UPDATE, PURGE))) {
return array();
}
if (is_null($optgroup)) {
$devices = array();
foreach (CommonDevice::getDeviceTypes() as $device_type) {
$devices[$device_type] = $device_type::getTypeName(Session::getPluralNumber());
}
asort($devices);
$optgroup = array(_n('Component', 'Components', Session::getPluralNumber()) => $devices);
}
return $optgroup;
}