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


PHP Computer_Item类代码示例

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


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

示例1: testTypeName

 /**
  * @covers Computer::post_updateItem
  */
 public function testTypeName()
 {
     global $CFG_GLPI;
     $computer = getItemByTypeName('Computer', '_test_pc01');
     $savecomp = $computer->fields;
     $saveconf = $CFG_GLPI;
     $printer = getItemByTypeName('Printer', '_test_printer_all');
     // Create the link
     $link = new Computer_Item();
     $in = ['computers_id' => $computer->getField('id'), 'itemtype' => $printer->getType(), 'items_id' => $printer->getID()];
     $this->assertGreaterThan(0, $link->add($in));
     // Change the computer
     $CFG_GLPI['is_contact_autoupdate'] = 1;
     $CFG_GLPI['is_user_autoupdate'] = 1;
     $CFG_GLPI['is_group_autoupdate'] = 1;
     $CFG_GLPI['state_autoupdate_mode'] = -1;
     $CFG_GLPI['is_location_autoupdate'] = 1;
     $in = ['id' => $computer->getField('id'), 'contact' => $this->getUniqueString(), 'contact_num' => $this->getUniqueString(), 'users_id' => $this->getUniqueInteger(), 'groups_id' => $this->getUniqueInteger(), 'states_id' => $this->getUniqueInteger(), 'locations_id' => $this->getUniqueInteger()];
     $this->assertTrue($computer->update($in));
     $this->assertTrue($computer->getFromDB($computer->getID()));
     $this->assertTrue($printer->getFromDB($printer->getID()));
     foreach ($in as $k => $v) {
         // Check the computer new values
         $this->assertEquals($v, $computer->getField($k), $k);
         // Check the printer and test propagation occurs
         $this->assertEquals($v, $printer->getField($k), $k);
     }
     // Change the computer again
     $CFG_GLPI['is_contact_autoupdate'] = 0;
     $CFG_GLPI['is_user_autoupdate'] = 0;
     $CFG_GLPI['is_group_autoupdate'] = 0;
     $CFG_GLPI['state_autoupdate_mode'] = 0;
     $CFG_GLPI['is_location_autoupdate'] = 0;
     $in2 = ['id' => $computer->getField('id'), 'contact' => $this->getUniqueString(), 'contact_num' => $this->getUniqueString(), 'users_id' => $this->getUniqueInteger(), 'groups_id' => $this->getUniqueInteger(), 'states_id' => $this->getUniqueInteger(), 'locations_id' => $this->getUniqueInteger()];
     $this->assertTrue($computer->update($in2));
     $this->assertTrue($computer->getFromDB($computer->getID()));
     $this->assertTrue($printer->getFromDB($printer->getID()));
     foreach ($in2 as $k => $v) {
         // Check the computer new values
         $this->assertEquals($v, $computer->getField($k), $k);
         // Check the printer and test propagation DOES NOT occurs
         $this->assertEquals($in[$k], $printer->getField($k), $k);
     }
     // Restore state
     $computer->update($savecomp);
     // Restore configuration
     $CFG_GLPI = $saveconf;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:51,代码来源:ComputerTest.php

示例2: showNotesForm

            case 4:
                Infocom::showForItem($periph);
                Contract::showAssociated($periph);
                break;
            case 5:
                Document::showAssociated($periph);
                break;
            case 6:
                Ticket::showListForItem('Peripheral', $_POST["id"]);
                break;
            case 7:
                Link::showForItem('Peripheral', $_POST["id"]);
                break;
            case 10:
                showNotesForm($_POST['target'], 'Peripheral', $_POST["id"]);
                break;
            case 11:
                Reservation::showForItem('Peripheral', $_POST["id"]);
                break;
            case 12:
                Log::showForItem($periph);
                break;
            default:
                if (!Plugin::displayAction($periph, $_REQUEST['glpi_tab'])) {
                    Computer_Item::showForItem($periph);
                    NetworkPort::showForItem('Peripheral', $_POST["id"], $_POST["withtemplate"]);
                }
        }
    }
}
ajaxFooter();
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:peripheral.tabs.php

示例3: getSpecificMassiveActions

 /**
  * @see CommonDBTM::getSpecificMassiveActions()
  **/
 function getSpecificMassiveActions($checkitem = NULL)
 {
     $actions = parent::getSpecificMassiveActions($checkitem);
     if (static::canUpdate()) {
         Computer_Item::getMassiveActionsForItemtype($actions, __CLASS__, 0, $checkitem);
         MassiveAction::getAddTransferList($actions);
     }
     return $actions;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:12,代码来源:phone.class.php

示例4: showNotesForm

                break;
            case 4:
                Infocom::showForItem($monitor);
                Contract::showAssociated($monitor);
                break;
            case 5:
                Document::showAssociated($monitor, $_POST["withtemplate"]);
                break;
            case 6:
                Ticket::showListForItem('Monitor', $_POST["id"]);
                break;
            case 7:
                Link::showForItem('Monitor', $_POST["id"]);
                break;
            case 10:
                showNotesForm($_POST['target'], 'Monitor', $_POST["id"]);
                break;
            case 11:
                Reservation::showForItem('Monitor', $_POST["id"]);
                break;
            case 12:
                Log::showForItem($monitor);
                break;
            default:
                if (!Plugin::displayAction($monitor, $_REQUEST['glpi_tab'])) {
                    Computer_Item::showForItem($monitor);
                }
        }
    }
}
ajaxFooter();
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:monitor.tabs.php

示例5: uninstall

 static function uninstall($type, $model_id, $tab_ids, $location)
 {
     global $UNINSTALL_DIRECT_CONNECTIONS_TYPE;
     //Get the model
     $model = new PluginUninstallModel();
     $model->getConfig($model_id);
     //Then destroy all the connexions
     $transfer = new Transfer();
     $transfer->getFromDB($model->fields["transfers_id"]);
     echo "<div class='center'>";
     echo "<table class='tab_cadre_fixe'><tr><th>" . __('Uninstall', 'uninstall') . "</th></tr>";
     echo "<tr class='tab_bg_2'><td>";
     $count = 0;
     $tot = count($tab_ids[$type]);
     Html::createProgressBar(__('Please wait, uninstallation is running...', 'uninstall'));
     foreach ($tab_ids[$type] as $id => $value) {
         $count++;
         $item = new $type();
         $item->getFromDB($id);
         //First clean object and change location and status if needed
         $entity = $item->fields["entities_id"];
         $input = array();
         $input["id"] = $id;
         $input["entities_id"] = $entity;
         $fields = array();
         //Hook to perform actions before item is being uninstalled
         $item->fields['_uninstall_event'] = $model->getID();
         $item->fields['_action'] = 'uninstall';
         Plugin::doHook("plugin_uninstall_before", $item);
         //--------------------//
         //Direct connections //
         //------------------//
         if (in_array($type, $UNINSTALL_DIRECT_CONNECTIONS_TYPE)) {
             $conn = new Computer_Item();
             $conn->deleteByCriteria(array('computers_id' => $id), true);
         }
         //--------------------//
         //-- Common fields --//
         //------------------//
         //RAZ contact and contactnumber
         if ($item->isField('contact') && $model->fields["raz_contact"] == 1) {
             $fields["contact"] = '';
             if ($item->isField('contact_num')) {
                 $fields["contact_num"] = '';
             }
         }
         //RAZ user
         if ($model->fields["raz_user"] == 1 && $item->isField('users_id')) {
             $fields["users_id"] = 0;
         }
         //RAZ status
         if ($model->fields["states_id"] > 0 && $item->isField('states_id')) {
             $fields["states_id"] = $model->fields["states_id"];
         }
         //RAZ machine's name
         if ($item->isField('name') && $model->fields["raz_name"] == 1) {
             $fields["name"] = '';
         }
         if ($item->isField('locations_id')) {
             if ($location == '') {
                 $location = 0;
             }
             switch ($location) {
                 case -1:
                     break;
                 default:
                     $fields["locations_id"] = $location;
                     break;
             }
         }
         if ($item->isField('groups_id')) {
             $nbgroup = countElementsInTableForEntity("glpi_groups", $entity, "`id`='" . $item->fields['groups_id'] . "'");
             if ($model->fields["groups_id"] > -1 && $nbgroup == 1) {
                 // If a new group is defined and if the group is accessible in the object's entity
                 $fields["groups_id"] = $model->fields["groups_id"];
             }
         }
         //------------------------------//
         //-- Computer specific fields --//
         //------------------------------//
         if ($type == 'Computer') {
             //RAZ all OS related informations
             if ($model->fields["raz_os"] == 1) {
                 $fields["operatingsystems_id"] = 0;
                 $fields["operatingsystemversions_id"] = 0;
                 $fields["operatingsystemservicepacks_id"] = 0;
                 $fields["os_licenseid"] = '';
                 $fields["os_license_number"] = '';
                 $fields["autoupdatesystems_id"] = 0;
             }
             $plug = new Plugin();
             if ($plug->isActivated('ocsinventoryng')) {
                 if ($item->fields["is_dynamic"] && ($model->fields["remove_from_ocs"] || $model->fields["delete_ocs_link"])) {
                     $input["is_dynamic"] = 0;
                 }
             }
             if ($item->isField('domains_id') && $model->fields["raz_domain"]) {
                 $fields["domains_id"] = 0;
             }
             //RAZ network
//.........这里部分代码省略.........
开发者ID:pluginsGLPI,项目名称:uninstall,代码行数:101,代码来源:uninstall.class.php

示例6: sprintf

            $monitor->restore($_POST);
            Event::log($_POST["id"], "monitors", 4, "inventory", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            $monitor->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $monitor->check($_POST["id"], 'd');
                $monitor->delete($_POST, 1);
                Event::log($_POST["id"], "monitors", 4, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
                $monitor->redirectToList();
            } else {
                if (isset($_POST["update"])) {
                    $monitor->check($_POST["id"], 'w');
                    $monitor->update($_POST);
                    Event::log($_POST["id"], "monitors", 4, "inventory", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
                    Html::back();
                } else {
                    if (isset($_POST["unglobalize"])) {
                        $monitor->check($_POST["id"], 'w');
                        Computer_Item::unglobalizeItem($monitor);
                        Event::log($_POST["id"], "monitors", 4, "inventory", sprintf(__('%s sets unitary management'), $_SESSION["glpiname"]));
                        Html::redirect($CFG_GLPI["root_doc"] . "/front/monitor.form.php?id=" . $_POST["id"]);
                    } else {
                        Html::header(Monitor::getTypeName(2), $_SERVER['PHP_SELF'], "inventory", "monitor");
                        $monitor->showForm($_GET["id"], array('withtemplate' => $_GET["withtemplate"]));
                        Html::footer();
                    }
                }
            }
        }
    }
}
开发者ID:gaforeror,项目名称:glpi,代码行数:31,代码来源:monitor.form.php

示例7: replace


//.........这里部分代码省略.........
             if ($newitem->isField('contact_num') && ($overwrite || empty($data['contact_num']))) {
                 $data['contact_num'] = $olditem->getField('contact_num');
             }
             $newitem->update($data, false);
         }
         // Group
         if ($model->fields["replace_groups"] && in_array($type, $CFG_GLPI["linkgroup_types"])) {
             if ($newitem->isField('groups_id') && ($overwrite || empty($data['groups_id']))) {
                 $newitem->update(array('id' => $newitem_id, 'groups_id' => $olditem->getField('groups_id')), false);
             }
         }
         // Tickets
         if ($model->fields["replace_tickets"] && in_array($type, $CFG_GLPI["ticket_types"])) {
             $ticket_item = new Item_Ticket();
             foreach (self::getAssociatedTickets($type, $olditem_id) as $ticket) {
                 $ticket_item->update(array('id' => $ticket['id'], 'items_id' => $newitem_id), false);
             }
         }
         //Array netport_types renamed in networkport_types in GLPI 0.80
         if (isset($CFG_GLPI["netport_types"])) {
             $netport_types = $CFG_GLPI["netport_types"];
         } else {
             $netport_types = $CFG_GLPI["networkport_types"];
         }
         // NetPorts
         if ($model->fields["replace_netports"] && in_array($type, $netport_types)) {
             $netport_item = new NetworkPort();
             foreach (self::getAssociatedNetports($type, $olditem_id) as $netport) {
                 $netport_item->update(array('id' => $netport['id'], 'itemtype' => $type, 'items_id' => $newitem_id), false);
             }
         }
         // Directs connections
         if ($model->fields["replace_direct_connections"] && in_array($type, array('Computer'))) {
             $comp_item = new Computer_Item();
             foreach (self::getAssociatedItems($olditem) as $itemtype => $connections) {
                 foreach ($connections as $connection) {
                     $comp_item->update(array('id' => $connection['id'], 'computers_id' => $newitem_id, 'itemtype' => $itemtype), false);
                 }
             }
         }
         // Location
         if ($location != 0 && $olditem->isField('locations_id')) {
             $olditem->getFromDB($olditem_id);
             switch ($location) {
                 case -1:
                     break;
                 default:
                     $olditem->update(array('id' => $olditem_id, 'locations_id' => $location), false);
                     break;
             }
         }
         $plug = new Plugin();
         if ($plug->isActivated('ocsinventoryng')) {
             //Delete computer from OCS
             if ($model->fields["remove_from_ocs"] == 1) {
                 PluginUninstallUninstall::deleteComputerInOCSByGlpiID($olditem_id);
             }
             //Delete link in glpi_ocs_link
             if ($model->fields["delete_ocs_link"] || $model->fields["remove_from_ocs"]) {
                 PluginUninstallUninstall::deleteOcsLink($olditem_id);
             }
         }
         if ($plug->isActivated('fusioninventory')) {
             if ($model->fields['raz_fusioninventory']) {
                 PluginUninstallUninstall::deleteFusionInventoryLink(get_class($olditem), $olditem_id);
             }
开发者ID:pluginsGLPI,项目名称:uninstall,代码行数:67,代码来源:replace.class.php

示例8: manageConnectionComputer

 /**
  * Delete direct connection beetween an item and a computer when transfering the item
  *
  * @param $itemtype        itemtype to tranfer
  * @param $ID              ID of the item
  *
  * @since version 0.84.4
  **/
 function manageConnectionComputer($itemtype, $ID)
 {
     global $DB;
     // Get connections
     $query = "SELECT *\n                FROM `glpi_computers_items`\n                WHERE `computers_id` NOT IN " . $this->item_search['Computer'] . "\n                      AND `itemtype` = '" . $itemtype . "'\n                      AND `items_id` = {$ID}";
     if ($result = $DB->query($query)) {
         if ($DB->numrows($result) != 0) {
             // Foreach get item
             $conn = new Computer_Item();
             $comp = new Computer();
             while ($data = $DB->fetch_assoc($result)) {
                 $item_ID = $data['items_id'];
                 if ($comp->getFromDB($item_ID)) {
                     $conn->delete(array('id' => $data['id']));
                 } else {
                     // Unexisting item / Force disconnect
                     $conn->delete(array('id' => $data['id'], '_no_history' => true, '_no_auto_action' => true));
                 }
             }
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:transfer.class.php

示例9: post_addItem

 function post_addItem()
 {
     global $DB;
     // Manage add from template
     if (isset($this->input["_oldID"])) {
         // ADD Devices
         Item_devices::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Infocoms
         Infocom::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Contract
         Contract_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Documents
         Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Ports
         NetworkPort::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // Add connected devices
         Computer_Item::cloneComputer($this->input["_oldID"], $this->fields['id']);
     }
 }
开发者ID:btry,项目名称:genericobject,代码行数:19,代码来源:object.class.php

示例10: Computer_Item

GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
* @since version 0.84
*/
include '../inc/includes.php';
Session::checkCentralAccess();
$conn = new Computer_Item();
if (isset($_POST["disconnect"])) {
    $conn->check($_POST["id"], PURGE);
    $conn->delete($_POST, 1);
    Event::log($_POST["computers_id"], "computers", 5, "inventory", sprintf(__('%s disconnects an item'), $_SESSION["glpiname"]));
    Html::back();
    // Connect a computer to a printer/monitor/phone/peripheral
} else {
    if (isset($_POST["add"])) {
        if (isset($_POST["items_id"]) && $_POST["items_id"] > 0) {
            $conn->check(-1, CREATE, $_POST);
            if ($newID = $conn->add($_POST)) {
                Event::log($_POST["computers_id"], "computers", 5, "inventory", sprintf(__('%s connects an item'), $_SESSION["glpiname"]));
            }
        }
        Html::back();
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:computer_item.form.php

示例11: array

     echo "&nbsp;<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
     break;
 case "unlock_ocsng_monitor":
 case "unlock_ocsng_peripheral":
 case "unlock_ocsng_software":
 case "unlock_ocsng_printer":
 case "unlock_ocsng_disk":
 case "unlock_ocsng_ip":
     echo "<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
     break;
 case "install":
     Software::dropdownSoftwareToInstall("softwareversions_id", $_SESSION["glpiactive_entity"], 1);
     echo "&nbsp;<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][4] . "'>";
     break;
 case "connect":
     Computer_Item::dropdownConnect('Computer', $_POST["itemtype"], "connect_item");
     echo "&nbsp;<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
     break;
 case "connect_to_computer":
     Dropdown::showAllItems("connect_item", 0, 0, $_SESSION["glpiactive_entity"], array('Monitor', 'Peripheral', 'Phone', 'Printer'), true);
     echo "&nbsp;<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
     break;
 case "disconnect":
     echo "<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
     break;
 case "add_group":
     Dropdown::show('Group');
     echo "&nbsp;<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>";
     break;
 case "add_userprofile":
     Dropdown::show('Entity', array('entity' => $_SESSION['glpiactiveentities']));
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:dropdownMassiveAction.php

示例12: showNotesForm

            case 4:
                Infocom::showForItem($phone);
                Contract::showAssociated($phone);
                break;
            case 5:
                Document::showAssociated($phone);
                break;
            case 6:
                Ticket::showListForItem('Phone', $_POST["id"]);
                break;
            case 7:
                Link::showForItem('Phone', $_POST["id"]);
                break;
            case 10:
                showNotesForm($_POST['target'], 'Phone', $_POST["id"]);
                break;
            case 11:
                Reservation::showForItem('Phone', $_POST["id"]);
                break;
            case 12:
                Log::showForItem($phone);
                break;
            default:
                if (!Plugin::displayAction($phone, $_REQUEST['glpi_tab'])) {
                    Computer_Item::showForItem($phone);
                    NetworkPort::showForItem('Phone', $_POST["id"], 'Phone', $_POST["withtemplate"]);
                }
        }
    }
}
ajaxFooter();
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:phone.tabs.php

示例13: cleanDBonPurge

 function cleanDBonPurge()
 {
     global $DB;
     $query = "SELECT `id`\n                FROM `glpi_computers_items`\n                WHERE `itemtype` = '" . $this->getType() . "'\n                      AND `items_id` = '" . $this->fields['id'] . "'";
     if ($result = $DB->query($query)) {
         if ($DB->numrows($result) > 0) {
             $conn = new Computer_Item();
             while ($data = $DB->fetch_array($result)) {
                 $data['_no_auto_action'] = true;
                 $conn->delete($data);
             }
         }
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:14,代码来源:phone.class.php

示例14: updateComputer

 /**
  * Update computer data
  *
  * @global type $DB
  *
  * @param php array $a_computerinventory all data from the agent
  * @param integer $computers_id id of the computer
  * @param boolean $no_history set true if not want history
  *
  * @return nothing
  */
 function updateComputer($a_computerinventory, $computers_id, $no_history, $setdynamic = 0)
 {
     global $DB, $CFG_GLPI;
     $computer = new Computer();
     $pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
     $item_DeviceProcessor = new Item_DeviceProcessor();
     $deviceProcessor = new DeviceProcessor();
     $item_DeviceMemory = new Item_DeviceMemory();
     $deviceMemory = new DeviceMemory();
     $computerVirtualmachine = new ComputerVirtualMachine();
     $computerDisk = new ComputerDisk();
     $item_DeviceControl = new Item_DeviceControl();
     $item_DeviceHardDrive = new Item_DeviceHardDrive();
     $item_DeviceDrive = new Item_DeviceDrive();
     $item_DeviceGraphicCard = new Item_DeviceGraphicCard();
     $item_DeviceNetworkCard = new Item_DeviceNetworkCard();
     $item_DeviceSoundCard = new Item_DeviceSoundCard();
     $networkPort = new NetworkPort();
     $networkName = new NetworkName();
     $iPAddress = new IPAddress();
     $ipnetwork = new IPNetwork();
     $pfInventoryComputerAntivirus = new PluginFusioninventoryInventoryComputerAntivirus();
     $pfConfig = new PluginFusioninventoryConfig();
     $pfComputerLicenseInfo = new PluginFusioninventoryComputerLicenseInfo();
     $computer_Item = new Computer_Item();
     $monitor = new Monitor();
     $printer = new Printer();
     $peripheral = new Peripheral();
     //      $pfInventoryComputerStorage   = new PluginFusioninventoryInventoryComputerStorage();
     //      $pfInventoryComputerStorage_Storage =
     //             new PluginFusioninventoryInventoryComputerStorage_Storage();
     $computer->getFromDB($computers_id);
     $a_lockable = PluginFusioninventoryLock::getLockFields('glpi_computers', $computers_id);
     // * Computer
     $db_computer = array();
     $db_computer = $computer->fields;
     $computerName = $a_computerinventory['Computer']['name'];
     $a_ret = PluginFusioninventoryToolbox::checkLock($a_computerinventory['Computer'], $db_computer, $a_lockable);
     $a_computerinventory['Computer'] = $a_ret[0];
     $input = $a_computerinventory['Computer'];
     $input['id'] = $computers_id;
     $history = TRUE;
     if ($no_history) {
         $history = FALSE;
     }
     $input['_no_history'] = $no_history;
     PluginFusioninventoryInventoryComputerInventory::addDefaultStateIfNeeded($input);
     $computer->update($input, !$no_history);
     $this->computer = $computer;
     // * Computer fusion (ext)
     $db_computer = array();
     if ($no_history === FALSE) {
         $query = "SELECT * FROM `glpi_plugin_fusioninventory_inventorycomputercomputers`\n                WHERE `computers_id` = '{$computers_id}'\n                LIMIT 1";
         $result = $DB->query($query);
         while ($data = $DB->fetch_assoc($result)) {
             foreach ($data as $key => $value) {
                 $data[$key] = Toolbox::addslashes_deep($value);
             }
             $db_computer = $data;
         }
     }
     if (count($db_computer) == '0') {
         // Add
         $a_computerinventory['fusioninventorycomputer']['computers_id'] = $computers_id;
         $pfInventoryComputerComputer->add($a_computerinventory['fusioninventorycomputer'], array(), FALSE);
     } else {
         // Update
         if (!empty($db_computer['serialized_inventory'])) {
             $setdynamic = 0;
         }
         $idtmp = $db_computer['id'];
         unset($db_computer['id']);
         unset($db_computer['computers_id']);
         $a_ret = PluginFusioninventoryToolbox::checkLock($a_computerinventory['fusioninventorycomputer'], $db_computer);
         $a_computerinventory['fusioninventorycomputer'] = $a_ret[0];
         $db_computer = $a_ret[1];
         $input = $a_computerinventory['fusioninventorycomputer'];
         $input['id'] = $idtmp;
         $input['_no_history'] = $no_history;
         $pfInventoryComputerComputer->update($input, !$no_history);
     }
     // Put all link item dynamic (in case of update computer not yet inventoried with fusion)
     if ($setdynamic == 1) {
         $this->setDynamicLinkItems($computers_id);
     }
     // * Processors
     if ($pfConfig->getValue("component_processor") != 0) {
         $db_processors = array();
         if ($no_history === FALSE) {
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:inventorycomputerlib.class.php

示例15: cloneComputer

 /**
  * Duplicate connected items to computer from an item template to its clone
  *
  * @since version 0.84
  *
  * @param $oldid        ID of the item to clone
  * @param $newid        ID of the item cloned
  **/
 static function cloneComputer($oldid, $newid)
 {
     global $DB;
     $query = "SELECT *\n                 FROM `glpi_computers_items`\n                 WHERE `computers_id` = '" . $oldid . "';";
     $result = $DB->query($query);
     foreach ($DB->request($query) as $data) {
         $conn = new Computer_Item();
         $conn->add(array('computers_id' => $newid, 'itemtype' => $data["itemtype"], 'items_id' => $data["items_id"]));
     }
 }
开发者ID:stweil,项目名称:glpi,代码行数:18,代码来源:computer_item.class.php


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