本文整理汇总了PHP中CommonDevice类的典型用法代码示例。如果您正苦于以下问题:PHP CommonDevice类的具体用法?PHP CommonDevice怎么用?PHP CommonDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommonDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTMLTableCellForItem
/**
* @since version 0.84
*
* @see CommonDevice::getHTMLTableCellForItem()
**/
function getHTMLTableCellForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
{
$column = parent::getHTMLTableCellForItem($row, $item, $father, $options);
if ($column == $father) {
return $father;
}
switch ($item->getType()) {
case 'Computer':
Manufacturer::getHTMLTableCellsForItem($row, $this, NULL, $options);
}
}
示例2: getHTMLTableCellForItem
/**
* @since version 0.84
*
* @see CommonDevice::getHTMLTableCellForItem()
**/
function getHTMLTableCellForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
{
$column = parent::getHTMLTableCellForItem($row, $item, $father, $options);
if ($column == $father) {
return $father;
}
switch ($item->getType()) {
case 'Computer':
Manufacturer::getHTMLTableCellsForItem($row, $this, NULL, $options);
if ($this->fields["type"]) {
$row->addCell($row->getHeaderByName('devicesoundcard_type'), $this->fields["type"], $father);
}
}
}
示例3: getHTMLTableCellForItem
/**
* @since version 0.84
*
* @see CommonDevice::getHTMLTableCellForItem()
**/
function getHTMLTableCellForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
{
$column = parent::getHTMLTableCellForItem($row, $item, $father, $options);
if ($column == $father) {
return $father;
}
switch ($item->getType()) {
case 'Computer':
Manufacturer::getHTMLTableCellsForItem($row, $this, NULL, $options);
if ($this->fields["assettag"]) {
$row->addCell($row->getHeaderByName('devicebiosdata_tag'), Dropdown::getYesNo($this->fields["assettag"]), $father);
}
if ($this->fields["date"]) {
$row->addCell($row->getHeaderByName('devicebiosdata_date'), $this->fields["date"], $father);
}
}
}
示例4: getAdditionalFields
/**
* @see CommonDevice::getAdditionalFields()
* @since version 0.85
*/
function getAdditionalFields()
{
return array_merge(parent::getAdditionalFields(), array(array('name' => 'none', 'label' => RegisteredID::getTypeName(Session::getPluralNumber()) . RegisteredID::showAddChildButtonForItemForm($this, '_registeredID', NULL, false), 'type' => 'registeredIDChooser')));
}
示例5: 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'];
}
示例6: 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');
示例7: getHTMLTableCellForItem
/**
* @since version 0.84
*
* @see CommonDevice::getHTMLTableCellForItem()
**/
function getHTMLTableCellForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
{
$column = parent::getHTMLTableCellForItem($row, $item, $father, $options);
if ($column == $father) {
return $father;
}
switch ($item->getType()) {
case 'Computer':
Manufacturer::getHTMLTableCellsForItem($row, $this, NULL, $options);
if ($this->fields["is_writer"]) {
$row->addCell($row->getHeaderByName('devicedrive_writer'), Dropdown::getYesNo($this->fields["is_writer"]), $father);
}
if ($this->fields["speed"]) {
$row->addCell($row->getHeaderByName('devicedrive_speed'), $this->fields["speed"], $father);
}
InterfaceType::getHTMLTableCellsForItem($row, $this, NULL, $options);
}
}
示例8: getHTMLTableCellForItem
/**
* @since version 0.84
*
* @see CommonDevice::getHTMLTableCellForItem()
**/
function getHTMLTableCellForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
{
$column = parent::getHTMLTableCellForItem($row, $item, $father, $options);
if ($column == $father) {
return $father;
}
switch ($item->getType()) {
case 'Computer':
Manufacturer::getHTMLTableCellsForItem($row, $this, NULL, $options);
InterfaceType::getHTMLTableCellsForItem($row, $this, NULL, $options);
if (!empty($this->fields["chipset"])) {
$row->addCell($row->getHeaderByName('devicegraphiccard_chipset'), $this->fields["chipset"], $father);
}
break;
}
}
示例9: 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());
}
示例10: getHTMLTableCellForItem
/**
* @since version 0.84
*
* @see CommonDevice::getHTMLTableCellForItem()
**/
function getHTMLTableCellForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
{
$column = parent::getHTMLTableCellForItem($row, $item, $father, $options);
if ($column == $father) {
return $father;
}
switch ($item->getType()) {
case 'Computer':
Manufacturer::getHTMLTableCellsForItem($row, $this, NULL, $options);
if ($this->fields["devicememorytypes_id"]) {
$row->addCell($row->getHeaderByName('devicememory_type'), Dropdown::getDropdownName("glpi_devicememorytypes", $this->fields["devicememorytypes_id"]), $father);
}
if (!empty($this->fields["frequence"])) {
$row->addCell($row->getHeaderByName('devicememory_frequency'), $this->fields["frequence"], $father);
}
break;
}
}
示例11: getSearchOptions
function getSearchOptions()
{
global $LANG;
$tab = parent::getSearchOptions();
$tab[12]['table'] = 'glpi_devicecasetypes';
$tab[12]['field'] = 'name';
$tab[12]['name'] = $LANG['device_case'][0];
return $tab;
}
示例12: getSearchOptions
function getSearchOptions()
{
global $LANG;
$tab = parent::getSearchOptions();
$tab[11]['table'] = $this->getTable();
$tab[11]['field'] = 'chipset';
$tab[11]['name'] = $LANG['device_moboard'][0];
$tab[11]['datatype'] = 'text';
return $tab;
}
示例13: getSearchOptions
function getSearchOptions()
{
global $LANG;
$tab = parent::getSearchOptions();
$tab[12]['table'] = $this->getTable();
$tab[12]['field'] = 'type';
$tab[12]['name'] = $LANG['common'][17];
$tab[12]['datatype'] = 'text';
return $tab;
}
示例14: getSearchOptions
function getSearchOptions()
{
global $LANG;
$tab = parent::getSearchOptions();
$tab[12]['table'] = $this->getTable();
$tab[12]['field'] = 'specif_default';
$tab[12]['name'] = $LANG['devices'][6] . " " . $LANG['devices'][24];
$tab[12]['datatype'] = 'text';
$tab[14]['table'] = 'glpi_interfacetypes';
$tab[14]['field'] = 'name';
$tab[14]['name'] = $LANG['common'][65];
return $tab;
}
示例15: getSearchOptions
function getSearchOptions()
{
global $LANG;
$tab = parent::getSearchOptions();
$tab[12]['table'] = $this->getTable();
$tab[12]['field'] = 'is_raid';
$tab[12]['name'] = $LANG['device_control'][0];
$tab[12]['datatype'] = 'bool';
$tab[14]['table'] = 'glpi_interfacetypes';
$tab[14]['field'] = 'name';
$tab[14]['name'] = $LANG['common'][65];
return $tab;
}