本文整理汇总了PHP中Printer::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::getType方法的具体用法?PHP Printer::getType怎么用?PHP Printer::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Printer
的用法示例。
在下文中一共展示了Printer::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
/**
* Function to import discovered device
*
* @param $items_id id of the device to import
*
* @return nothing
*
**/
function import($items_id, $Import = 0, $NoImport = 0)
{
global $DB;
$NetworkPort = new NetworkPort();
$a_NetworkPorts = $NetworkPort->find("`items_id` = '" . $items_id . "'\n AND `itemtype` = 'PluginFusioninventoryUnmanaged'");
$this->getFromDB($items_id);
$this->fields = Toolbox::addslashes_deep($this->fields);
$data = array();
switch ($this->fields['item_type']) {
case 'Printer':
$Printer = new Printer();
$data["entities_id"] = $this->fields["entities_id"];
if (!empty($this->fields["name"])) {
$data["name"] = $this->fields["name"];
}
$data["locations_id"] = $this->fields["locations_id"];
$data["serial"] = $this->fields["serial"];
$data["otherserial"] = $this->fields["otherserial"];
$data["contact"] = $this->fields["contact"];
$data["domain"] = $this->fields["domain"];
$data["comment"] = $this->fields["comment"];
$data["is_dynamic"] = 1;
$printer_id = $Printer->add($data);
foreach ($a_NetworkPorts as $data_Port) {
$data_Port['items_id'] = $printer_id;
$data_Port['itemtype'] = $Printer->getType();
$NetworkPort->update($data_Port);
}
// Import SNMP
$pfPrinter = new PluginFusioninventoryPrinter();
$_SESSION['glpi_plugins_fusinvsnmp_table'] = "glpi_plugin_fusioninventory_printers";
$query = "SELECT *\n FROM `glpi_plugin_fusioninventory_printers`\n WHERE `printers_id`='" . $printer_id . "' ";
$result = $DB->query($query);
$data = array();
if ($DB->numrows($result) > 0) {
$data = $DB->fetch_assoc($result);
}
$data['sysdescr'] = $this->fields['sysdescr'];
$data['plugin_fusioninventory_configsecurities_id'] = $this->fields['plugin_fusioninventory_configsecurities_id'];
if ($DB->numrows($result) == 0) {
$data['printers_id'] = $printer_id;
$pfPrinter->add($data);
} else {
$pfPrinter->update($data);
}
$this->deleteFromDB($items_id, 1);
$Import++;
break;
case 'NetworkEquipment':
$NetworkEquipment = new NetworkEquipment();
$data["entities_id"] = $this->fields["entities_id"];
if (!empty($this->fields["name"])) {
$data["name"] = $this->fields["name"];
}
$data["locations_id"] = $this->fields["locations_id"];
$data["serial"] = $this->fields["serial"];
$data["otherserial"] = $this->fields["otherserial"];
$data["contact"] = $this->fields["contact"];
$data["domain"] = $this->fields["domain"];
$data["comment"] = $this->fields["comment"];
$data["is_dynamic"] = 1;
// $data_Port = current($a_NetworkPorts);
// $data["ip"] = $data_Port["ip"];
// $data["mac"] = $data_Port["mac"];
$NetworkEquipment_id = $NetworkEquipment->add($data);
foreach ($a_NetworkPorts as $data_Port) {
$data_Port['items_id'] = $NetworkEquipment_id;
$data_Port['itemtype'] = $NetworkEquipment->getType();
$NetworkPort->update($data_Port);
}
$pfNetworkEquipment = new PluginFusioninventoryNetworkEquipment();
$_SESSION['glpi_plugins_fusinvsnmp_table'] = "glpi_plugin_fusioninventory_networkequipments";
$query = "SELECT *\n FROM `glpi_plugin_fusioninventory_networkequipments`\n WHERE `networkequipments_id`='" . $NetworkEquipment_id . "' ";
$result = $DB->query($query);
$data = array();
if ($DB->numrows($result) > 0) {
$data = $DB->fetch_assoc($result);
}
$data['sysdescr'] = $this->fields['sysdescr'];
$data['plugin_fusioninventory_configsecurities_id'] = $this->fields['plugin_fusioninventory_configsecurities_id'];
if ($DB->numrows($result) == 0) {
$data['networkequipments_id'] = $NetworkEquipment_id;
$pfNetworkEquipment->add($data);
} else {
$pfNetworkEquipment->update($data);
}
$this->deleteFromDB($items_id, 1);
$Import++;
break;
case 'Peripheral':
$Peripheral = new Peripheral();
$data["entities_id"] = $this->fields["entities_id"];
//.........这里部分代码省略.........
示例2: purgePrinter
/**
* if Printer purged
*
* @param $print Printer object
**/
static function purgePrinter(Printer $print)
{
$snmp = new self();
$snmp->deleteByCriteria(array('items_id' => $print->getField("id"), 'itemtype' => $print->getType()));
$ipdiscover = new PluginOcsinventoryngIpdiscoverOcslink();
$ipdiscover->deleteByCriteria(array('items_id' => $print->getField("id"), 'itemtype' => $print->getType()));
}