本文整理匯總了PHP中Item_Devices::getConcernedItems方法的典型用法代碼示例。如果您正苦於以下問題:PHP Item_Devices::getConcernedItems方法的具體用法?PHP Item_Devices::getConcernedItems怎麽用?PHP Item_Devices::getConcernedItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Item_Devices
的用法示例。
在下文中一共展示了Item_Devices::getConcernedItems方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getItem
/**
* Return the instance fields of itemtype identified by id
*
* @param $itemtype string itemtype (class) of object
* @param $id integer identifier of object
* @param $params array with theses options :
* - 'expand_dropdowns': Show dropdown's names instead of id. default: false. Optionnal
* - 'get_hateoas': Show relation of current item in a links attribute. default: true. Optionnal
* - 'get_sha1': Get a sha1 signature instead of the full answer. default: false. Optionnal
* - 'with_components': Only for [Computer, NetworkEquipment, Peripheral, Phone, Printer], Optionnal.
* - 'with_disks': Only for Computer, retrieve the associated filesystems. Optionnal.
* - 'with_softwares': Only for Computer, retrieve the associated softwares installations. Optionnal.
* - 'with_connections': Only for Computer, retrieve the associated direct connections (like peripherals and printers) .Optionnal.
* - 'with_networkports':Retrieve all network connections and advanced network informations. Optionnal.
* - 'with_infocoms': Retrieve financial and administrative informations. Optionnal.
* - 'with_contracts': Retrieve associated contracts. Optionnal.
* - 'with_documents': Retrieve associated external documents. Optionnal.
* - 'with_tickets': Retrieve associated itil tickets. Optionnal.
* - 'with_problems': Retrieve associated itil problems. Optionnal.
* - 'with_changes': Retrieve associated itil changes. Optionnal.
* - 'with_notes': Retrieve Notes (if exists, not all itemtypes have notes). Optionnal.
* - 'with_logs': Retrieve historical. Optionnal.
*
* @return array fields of found object
**/
protected function getItem($itemtype, $id, $params = array())
{
global $CFG_GLPI, $DB;
$this->initEndpoint();
// default params
$default = array('expand_dropdowns' => false, 'get_hateoas' => true, 'get_sha1' => false, 'with_components' => false, 'with_disks' => false, 'with_softwares' => false, 'with_connections' => false, 'with_networkports' => false, 'with_infocoms' => false, 'with_contracts' => false, 'with_documents' => false, 'with_tickets' => false, 'with_problems' => false, 'with_changes' => false, 'with_notes' => false, 'with_logs' => false);
$params = array_merge($default, $params);
$item = new $itemtype();
if (!$item->getFromDB($id)) {
return $this->messageNotfoundError();
}
if (!$item->can($id, READ)) {
return $this->messageRightError();
}
$fields = $item->fields;
// avoid disclosure of critical fields
$item::unsetUndisclosedFields($fields);
// retrieve devices
if (isset($params['with_devices']) && $params['with_devices'] && in_array($itemtype, Item_Devices::getConcernedItems())) {
$all_devices = array();
foreach (Item_Devices::getItemAffinities($item->getType()) as $device_type) {
$found_devices = getAllDatasFromTable($device_type::getTable(), "`items_id` = '" . $item->getID() . "'\n AND `itemtype` = '" . $item->getType() . "'\n AND `is_deleted` = '0'", true);
foreach ($found_devices as $devices_id => &$device) {
unset($device['items_id']);
unset($device['itemtype']);
unset($device['is_deleted']);
}
if (!empty($found_devices)) {
$all_devices[$device_type] = $found_devices;
}
}
$fields['_devices'] = $all_devices;
}
// retrieve computer disks
if (isset($params['with_disks']) && $params['with_disks'] && $itemtype == "Computer") {
// build query to retrive filesystems
$query = "SELECT `glpi_filesystems`.`name` AS fsname,\n `glpi_computerdisks`.*\n FROM `glpi_computerdisks`\n LEFT JOIN `glpi_filesystems`\n ON (`glpi_computerdisks`.`filesystems_id` = `glpi_filesystems`.`id`)\n WHERE `computers_id` = '{$id}'\n AND `is_deleted` = '0'";
$fields['_disks'] = array();
if ($result = $DB->query($query)) {
while ($data = $DB->fetch_assoc($result)) {
unset($data['computers_id']);
unset($data['is_deleted']);
$fields['_disks'][] = array('name' => $data);
}
}
}
// retrieve computer softwares
if (isset($params['with_softwares']) && $params['with_softwares'] && $itemtype == "Computer") {
$fields['_softwares'] = array();
if (!Software::canView()) {
$fields['_softwares'] = self::arrayRightError();
} else {
$query = "SELECT `glpi_softwares`.`softwarecategories_id`,\n `glpi_softwares`.`id` AS softwares_id,\n `glpi_softwareversions`.`id` AS softwareversions_id,\n `glpi_computers_softwareversions`.`is_dynamic`,\n `glpi_softwareversions`.`states_id`,\n `glpi_softwares`.`is_valid`\n FROM `glpi_computers_softwareversions`\n LEFT JOIN `glpi_softwareversions`\n ON (`glpi_computers_softwareversions`.`softwareversions_id`\n = `glpi_softwareversions`.`id`)\n LEFT JOIN `glpi_softwares`\n ON (`glpi_softwareversions`.`softwares_id` = `glpi_softwares`.`id`)\n WHERE `glpi_computers_softwareversions`.`computers_id` = '{$id}'\n AND `glpi_computers_softwareversions`.`is_deleted` = '0'\n ORDER BY `glpi_softwares`.`name`, `glpi_softwareversions`.`name`";
if ($result = $DB->query($query)) {
while ($data = $DB->fetch_assoc($result)) {
$fields['_softwares'][] = $data;
}
}
}
}
// retrieve item connections
if (isset($params['with_connections']) && $params['with_connections'] && $itemtype == "Computer") {
$fields['_connections'] = array();
foreach ($CFG_GLPI["directconnect_types"] as $connect_type) {
$connect_item = new $connect_type();
if ($connect_item->canView()) {
$query = "SELECT `glpi_computers_items`.`id` AS assoc_id,\n `glpi_computers_items`.`computers_id` AS assoc_computers_id,\n `glpi_computers_items`.`itemtype` AS assoc_itemtype,\n `glpi_computers_items`.`items_id` AS assoc_items_id,\n `glpi_computers_items`.`is_dynamic` AS assoc_is_dynamic,\n " . getTableForItemType($connect_type) . ".*\n FROM `glpi_computers_items`\n LEFT JOIN `" . getTableForItemType($connect_type) . "`\n ON (`" . getTableForItemType($connect_type) . "`.`id`\n = `glpi_computers_items`.`items_id`)\n WHERE `computers_id` = '{$id}'\n AND `itemtype` = '" . $connect_type . "'\n AND `glpi_computers_items`.`is_deleted` = '0'";
if ($result = $DB->query($query)) {
while ($data = $DB->fetch_assoc($result)) {
$fields['_connections'][$connect_type][] = $data;
}
}
}
}
}
//.........這裏部分代碼省略.........
示例2: transferItem
/**
* transfer an item to another item (may be the same) in the new entity
*
* @param $itemtype item type to transfer
* @param $ID ID of the item to transfer
* @param $newID new ID of the ite
*
* Transfer item to a new Item if $ID==$newID : only update entities_id field :
* $ID!=$new ID -> copy datas (like template system)
* @return nothing (diplays)
**/
function transferItem($itemtype, $ID, $newID)
{
global $CFG_GLPI, $DB;
if (!($item = getItemForItemtype($itemtype))) {
return;
}
// Is already transfer ?
if (!isset($this->already_transfer[$itemtype][$ID])) {
// Check computer exists ?
if ($item->getFromDB($newID)) {
// Network connection ? keep connected / keep_disconnected / delete
if (in_array($itemtype, array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer'))) {
$this->transferNetworkLink($itemtype, $ID, $newID);
}
// Device : keep / delete : network case : delete if net connection delete in import case
if (in_array($itemtype, Item_Devices::getConcernedItems())) {
$this->transferDevices($itemtype, $ID, $newID);
}
// Reservation : keep / delete
if (in_array($itemtype, $CFG_GLPI["reservation_types"])) {
$this->transferReservations($itemtype, $ID, $newID);
}
// History : keep / delete
$this->transferHistory($itemtype, $ID, $newID);
// Ticket : delete / keep and clean ref / keep and move
$this->transferTickets($itemtype, $ID, $newID);
// Infocoms : keep / delete
if (InfoCom::canApplyOn($itemtype)) {
$this->transferInfocoms($itemtype, $ID, $newID);
}
if ($itemtype == 'Software') {
$this->transferSoftwareLicensesAndVersions($ID);
}
// Connected item is transfered
if (in_array($itemtype, $CFG_GLPI["directconnect_types"])) {
$this->manageConnectionComputer($itemtype, $ID);
}
// Computer Direct Connect : delete link if it is the initial transfer item (no recursion)
if ($this->inittype == $itemtype && in_array($itemtype, array('Monitor', 'Phone', 'Peripheral', 'Printer'))) {
$this->deleteDirectConnection($itemtype, $ID);
}
// Contract : keep / delete + clean unused / keep unused
if (in_array($itemtype, $CFG_GLPI["contract_types"])) {
$this->transferContracts($itemtype, $ID, $newID);
}
// Contact / Supplier : keep / delete + clean unused / keep unused
if ($itemtype == 'Supplier') {
$this->transferSupplierContacts($ID, $newID);
}
// Document : keep / delete + clean unused / keep unused
if (Document::canApplyOn($itemtype)) {
$this->transferDocuments($itemtype, $ID, $newID);
}
// Transfer compatible printers
if ($itemtype == 'CartridgeItem') {
$this->transferCompatiblePrinters($ID, $newID);
}
// Cartridges and cartridges items linked to printer
if ($itemtype == 'Printer') {
$this->transferPrinterCartridges($ID, $newID);
}
// Transfer Item
$input = array('id' => $newID, 'entities_id' => $this->to);
// Manage Location dropdown
if (isset($item->fields['locations_id'])) {
$input['locations_id'] = $this->transferDropdownLocation($item->fields['locations_id']);
}
if (in_array($itemtype, array('Ticket', 'Problem', 'Change'))) {
$input2 = $this->transferHelpdeskAdditionalInformations($item->fields);
$input = array_merge($input, $input2);
$this->transferTaskCategory($itemtype, $ID, $newID);
$this->transferLinkedSuppliers($itemtype, $ID, $newID);
}
$item->update($input);
$this->addToAlreadyTransfer($itemtype, $ID, $newID);
// Do it after item transfer for entity checks
if ($itemtype == 'Computer') {
// Monitor Direct Connect : keep / delete + clean unused / keep unused
$this->transferDirectConnection($itemtype, $ID, 'Monitor');
// Peripheral Direct Connect : keep / delete + clean unused / keep unused
$this->transferDirectConnection($itemtype, $ID, 'Peripheral');
// Phone Direct Connect : keep / delete + clean unused / keep unused
$this->transferDirectConnection($itemtype, $ID, 'Phone');
// Printer Direct Connect : keep / delete + clean unused / keep unused
$this->transferDirectConnection($itemtype, $ID, 'Printer');
// License / Software : keep / delete + clean unused / keep unused
$this->transferComputerSoftwares($ID);
// Computer Disks : delete them or not ?
$this->transferComputerDisks($ID);
//.........這裏部分代碼省略.........
示例3: showFormButtons
/**
* Display a 2 columns Footer for Form buttons
* Close the form is user can edit
*
* @param $options array of possible options:
* - withtemplate : 1 for newtemplate, 2 for newobject from template
* - colspan for each column (default 2)
* - candel : set to false to hide "delete" button
* - canedit : set to false to hide all buttons
* - addbuttons : array of buttons to add
**/
function showFormButtons($options = array())
{
global $CFG_GLPI;
// for single object like config
if (isset($this->fields['id'])) {
$ID = $this->fields['id'];
} else {
$ID = 1;
}
$params['colspan'] = 2;
$params['withtemplate'] = '';
$params['candel'] = true;
$params['canedit'] = true;
$params['addbuttons'] = array();
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
if (!$params['canedit'] || !$this->canEdit($ID)) {
echo "</table></div>";
// Form Header always open form
if (!$params['canedit']) {
Html::closeForm();
}
return false;
}
echo "<tr class='tab_bg_2'>";
if ($params['withtemplate'] || $this->isNewID($ID)) {
echo "<td class='center' colspan='" . $params['colspan'] * 2 . "'>";
if ($ID <= 0 || $params['withtemplate'] == 2) {
echo Html::submit(_x('button', 'Add'), array('name' => 'add'));
} else {
//TRANS : means update / actualize
echo Html::submit(_x('button', 'Save'), array('name' => 'update'));
}
} else {
if ($params['candel'] && !$this->can($ID, DELETE) && !$this->can($ID, PURGE)) {
$params['candel'] = false;
}
if ($params['canedit'] && $this->can($ID, UPDATE)) {
echo "<td class='center' colspan='" . $params['colspan'] * 2 . "'>\n";
echo Html::submit(_x('button', 'Save'), array('name' => 'update'));
}
if ($params['candel']) {
if ($params['canedit'] && $this->can($ID, UPDATE)) {
echo "</td></tr><tr class='tab_bg_2'>\n";
}
if ($this->isDeleted()) {
if ($this->can($ID, DELETE)) {
echo "<td class='right' colspan='" . $params['colspan'] * 2 . "' >\n";
echo Html::submit(_x('button', 'Restore'), array('name' => 'restore'));
}
if ($this->can($ID, PURGE)) {
echo "<span class='very_small_space'>";
if (in_array($this->getType(), Item_Devices::getConcernedItems())) {
Html::showToolTip(__('Check to keep the devices while deleting this item'));
echo " ";
echo "<input type='checkbox' name='keep_devices' value='1'";
if (!empty($_SESSION['glpikeep_devices_when_purging_item'])) {
echo " checked";
}
echo "> ";
}
echo Html::submit(_x('button', 'Delete permanently'), array('name' => 'purge'));
echo "</span>";
}
} else {
echo "<td class='right' colspan='" . $params['colspan'] * 2 . "' >\n";
// If maybe dynamic : do not take into account is_deleted field
if (!$this->maybeDeleted() || $this->useDeletedToLockIfDynamic()) {
if ($this->can($ID, PURGE)) {
echo Html::submit(_x('button', 'Delete permanently'), array('name' => 'purge', 'confirm' => __('Confirm the final deletion?')));
}
} else {
if (!$this->isDeleted() && $this->can($ID, DELETE)) {
echo Html::submit(_x('button', 'Put in dustbin'), array('name' => 'delete'));
}
}
}
}
if ($this->isField('date_mod')) {
echo "<input type='hidden' name='_read_date_mod' value='" . $this->getField('date_mod') . "'>";
}
}
if (!$this->isNewID($ID)) {
echo "<input type='hidden' name='id' value='{$ID}'>";
}
echo "</td>";
//.........這裏部分代碼省略.........
示例4: getAllMassiveActions
/**
* Get the standard massive actions
*
* @param $item the item for which we want the massive actions
* @param $is_deleted massive action for deleted items ? (default 0)
* @param $checkitem link item to check right (default NULL)
*
* @return an array of massive actions or false if $item is not valid
**/
static function getAllMassiveActions($item, $is_deleted = 0, CommonDBTM $checkitem = NULL)
{
global $CFG_GLPI, $PLUGIN_HOOKS;
// TODO: when maybe* will be static, when can completely switch to $itemtype !
if (is_string($item)) {
$itemtype = $item;
if (!($item = getItemForItemtype($itemtype))) {
return false;
}
} else {
if ($item instanceof CommonDBTM) {
$itemtype = $item->getType();
} else {
return false;
}
}
if (!is_null($checkitem)) {
$canupdate = $checkitem->canUpdate();
$candelete = $checkitem->canDelete();
$canpurge = $checkitem->canPurge();
} else {
$canupdate = $itemtype::canUpdate();
$candelete = $itemtype::canDelete();
$canpurge = $itemtype::canPurge();
}
$actions = array();
$self_pref = __CLASS__ . self::CLASS_ACTION_SEPARATOR;
if ($is_deleted) {
if ($canpurge) {
if (in_array($itemtype, Item_Devices::getConcernedItems())) {
$actions[$self_pref . 'purge_item_but_devices'] = _x('button', 'Delete permanently but keep devices');
$actions[$self_pref . 'purge'] = _x('button', 'Delete permanently and remove devices');
} else {
$actions[$self_pref . 'purge'] = _x('button', 'Delete permanently');
}
$actions[$self_pref . 'restore'] = _x('button', 'Restore');
}
} else {
if ($_SESSION['glpiactiveprofile']['interface'] == 'central' && ($canupdate || InfoCom::canApplyOn($itemtype) && Infocom::canUpdate())) {
//TRANS: select action 'update' (before doing it)
$actions[$self_pref . 'update'] = _x('button', 'Update');
}
Infocom::getMassiveActionsForItemtype($actions, $itemtype, $is_deleted, $checkitem);
CommonDBConnexity::getMassiveActionsForItemtype($actions, $itemtype, $is_deleted, $checkitem);
// do not take into account is_deleted if items may be dynamic
if ($item->maybeDeleted() && !$item->useDeletedToLockIfDynamic()) {
if ($candelete) {
$actions[$self_pref . 'delete'] = _x('button', 'Put in dustbin');
}
} else {
if ($canpurge) {
$actions[$self_pref . 'purge'] = _x('button', 'Delete permanently');
if ($item instanceof CommonDropdown) {
$actions[$self_pref . 'purge_but_item_linked'] = _x('button', 'Delete permanently even if linked items');
}
}
}
Document::getMassiveActionsForItemtype($actions, $itemtype, $is_deleted, $checkitem);
Contract::getMassiveActionsForItemtype($actions, $itemtype, $is_deleted, $checkitem);
// Specific actions
$actions += $item->getSpecificMassiveActions($checkitem);
// Plugin Specific actions
if (isset($PLUGIN_HOOKS['use_massive_action'])) {
foreach ($PLUGIN_HOOKS['use_massive_action'] as $plugin => $val) {
$plug_actions = Plugin::doOneHook($plugin, 'MassiveActions', $itemtype);
if (count($plug_actions)) {
$actions += $plug_actions;
}
}
}
}
Lock::getMassiveActionsForItemtype($actions, $itemtype, $is_deleted, $checkitem);
// Manage forbidden actions : try complete action name or MassiveAction:action_name
$forbidden_actions = $item->getForbiddenStandardMassiveAction();
if (is_array($forbidden_actions) && count($forbidden_actions)) {
foreach ($forbidden_actions as $actiontodel) {
if (isset($actions[$actiontodel])) {
unset($actions[$actiontodel]);
} else {
// Not found search adding MassiveAction prefix
$actiontodel = $self_pref . $actiontodel;
if (isset($actions[$actiontodel])) {
unset($actions[$actiontodel]);
}
}
}
}
return $actions;
}
示例5: getItem
/**
* Return the instance fields of itemtype identified by id
*
* @since version 9.1
*
* @param string $itemtype itemtype (class) of object
* @param integer $id identifier of object
* @param array $params array with theses options :
* - 'expand_dropdowns' : show dropdown's names instead of id. default: false. Optionnal
* - 'get_hateoas' : show relation of current item in a links attribute. default: true. Optionnal
* - 'with_components' : Only for [Computer, NetworkEquipment, Peripheral, Phone, Printer], Optionnal.
* - 'with_disks' : Only for Computer, retrieve the associated filesystems. Optionnal.
* - 'with_softwares' : Only for Computer, retrieve the associated softwares installations. Optionnal.
* - 'with_connections' : Only for Computer, retrieve the associated direct connections (like peripherals and printers) .Optionnal.
* - 'with_networkports' :Retrieve all network connections and advanced network informations. Optionnal.
* - 'with_infocoms' : Retrieve financial and administrative informations. Optionnal.
* - 'with_contracts' : Retrieve associated contracts. Optionnal.
* - 'with_documents' : Retrieve associated external documents. Optionnal.
* - 'with_tickets' : Retrieve associated itil tickets. Optionnal.
* - 'with_problems' : Retrieve associated itil problems. Optionnal.
* - 'with_changes' : Retrieve associated itil changes. Optionnal.
* - 'with_notes' : Retrieve Notes (if exists, not all itemtypes have notes). Optionnal.
* - 'with_logs' : Retrieve historical. Optionnal.
*
* @return array fields of found object
*/
protected function getItem($itemtype, $id, $params = array())
{
global $CFG_GLPI, $DB;
$this->initEndpoint();
// default params
$default = array('expand_dropdowns' => false, 'get_hateoas' => true, 'with_components' => false, 'with_disks' => false, 'with_softwares' => false, 'with_connections' => false, 'with_networkports' => false, 'with_infocoms' => false, 'with_contracts' => false, 'with_documents' => false, 'with_tickets' => false, 'with_problems' => false, 'with_changes' => false, 'with_notes' => false, 'with_logs' => false);
$params = array_merge($default, $params);
$item = new $itemtype();
if (!$item->getFromDB($id)) {
return $this->messageNotfoundError();
}
if (!$item->can($id, READ)) {
return $this->messageRightError();
}
$fields = $item->fields;
// retrieve devices
if (isset($params['with_devices']) && $params['with_devices'] && in_array($itemtype, Item_Devices::getConcernedItems())) {
$all_devices = array();
foreach (Item_Devices::getItemAffinities($item->getType()) as $device_type) {
$found_devices = getAllDatasFromTable($device_type::getTable(), "`items_id` = '" . $item->getID() . "'\n AND `itemtype` = '" . $item->getType() . "'\n AND `is_deleted` = '0'", true);
foreach ($found_devices as $devices_id => &$device) {
unset($device['items_id']);
unset($device['itemtype']);
unset($device['is_deleted']);
}
if (!empty($found_devices)) {
$all_devices[$device_type] = $found_devices;
}
}
$fields['_devices'] = $all_devices;
}
// retrieve computer disks
if (isset($params['with_disks']) && $params['with_disks'] && $itemtype == "Computer") {
// build query to retrive filesystems
$query = "SELECT `glpi_filesystems`.`name` AS fsname,\n `glpi_computerdisks`.*\n FROM `glpi_computerdisks`\n LEFT JOIN `glpi_filesystems`\n ON (`glpi_computerdisks`.`filesystems_id` = `glpi_filesystems`.`id`)\n WHERE `computers_id` = '{$id}'\n AND `is_deleted` = '0'";
if ($result = $DB->query($query)) {
while ($data = $DB->fetch_assoc($result)) {
unset($data['computers_id']);
unset($data['is_deleted']);
$fields['_disks'][] = array('name' => $data);
}
}
}
// retrieve computer softwares
if (isset($params['with_softwares']) && $params['with_softwares'] && $itemtype == "Computer") {
$fields['_softwares'] = array();
if (!Software::canView()) {
$fields['_softwares'] = self::arrayRightError();
} else {
$query = "SELECT `glpi_softwares`.`softwarecategories_id`,\n `glpi_softwares`.`id` AS softwares_id,\n `glpi_softwareversions`.`id` AS softwareversions_id,\n `glpi_computers_softwareversions`.`is_dynamic`,\n `glpi_softwareversions`.`states_id`,\n `glpi_softwares`.`is_valid`\n FROM `glpi_computers_softwareversions`\n LEFT JOIN `glpi_softwareversions`\n ON (`glpi_computers_softwareversions`.`softwareversions_id`\n = `glpi_softwareversions`.`id`)\n LEFT JOIN `glpi_softwares`\n ON (`glpi_softwareversions`.`softwares_id` = `glpi_softwares`.`id`)\n WHERE `glpi_computers_softwareversions`.`computers_id` = '{$id}'\n AND `glpi_computers_softwareversions`.`is_deleted` = '0'\n ORDER BY `glpi_softwares`.`name`, `glpi_softwareversions`.`name`";
if ($result = $DB->query($query)) {
while ($data = $DB->fetch_assoc($result)) {
$fields['_softwares'][] = $data;
}
}
}
}
// retrieve item connections
if (isset($params['with_connections']) && $params['with_connections'] && $itemtype == "Computer") {
$fields['_connections'] = array();
foreach ($CFG_GLPI["directconnect_types"] as $connect_type) {
$connect_item = new $connect_type();
if ($connect_item->canView()) {
$query = "SELECT `glpi_computers_items`.`id` AS assoc_id,\n `glpi_computers_items`.`computers_id` AS assoc_computers_id,\n `glpi_computers_items`.`itemtype` AS assoc_itemtype,\n `glpi_computers_items`.`items_id` AS assoc_items_id,\n `glpi_computers_items`.`is_dynamic` AS assoc_is_dynamic,\n " . getTableForItemType($connect_type) . ".*\n FROM `glpi_computers_items`\n LEFT JOIN `" . getTableForItemType($connect_type) . "`\n ON (`" . getTableForItemType($connect_type) . "`.`id`\n = `glpi_computers_items`.`items_id`)\n WHERE `computers_id` = '{$id}'\n AND `itemtype` = '" . $connect_type . "'\n AND `glpi_computers_items`.`is_deleted` = '0'";
if ($result = $DB->query($query)) {
while ($data = $DB->fetch_assoc($result)) {
$fields['_connections'][$connect_type][] = $data;
}
}
}
}
}
// retrieve item networkports
if (isset($params['with_networkports']) && $params['with_networkports']) {
//.........這裏部分代碼省略.........