本文整理汇总了PHP中Infocom::getfromDBforDevice方法的典型用法代码示例。如果您正苦于以下问题:PHP Infocom::getfromDBforDevice方法的具体用法?PHP Infocom::getfromDBforDevice怎么用?PHP Infocom::getfromDBforDevice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Infocom
的用法示例。
在下文中一共展示了Infocom::getfromDBforDevice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generatePdf
function generatePdf($itemtype, $data, $saveas)
{
global $CFG_GLPI, $PDF, $DB;
$ID = $data["id"];
//name
if (!empty($data["name"])) {
$name_item = Toolbox::decodeFromUtf8($data["name"]);
} else {
$name_item = "";
}
//user
if (!empty($data["users_id"])) {
$user_item = Toolbox::decodeFromUtf8(Html::clean(getUserName($data["users_id"])));
} else {
if (!empty($data["groups_id"])) {
$user_item = Toolbox::decodeFromUtf8(Dropdown::getDropdownName("glpi_groups", $data["groups_id"]));
} else {
$user_item = "";
}
}
//fabricant
if (!empty($data["manufacturers_id"])) {
$fabricant_item = Toolbox::decodeFromUtf8(Dropdown::getDropdownName("glpi_manufacturers", $data["manufacturers_id"]));
} else {
$fabricant_item = "";
}
//serial
if (!empty($data["serial"])) {
$serial_item = Toolbox::decodeFromUtf8($data["serial"]);
} else {
$serial_item = "";
}
$class = $itemtype . "Type";
$item = new $class();
$typefield = getForeignKeyFieldForTable(getTableForItemType($itemtype . "Type"));
$item->getFromDB($data[$typefield]);
if (!empty($typefield) && !empty($item->fields["name"])) {
$type_item = Toolbox::decodeFromUtf8($item->fields["name"]);
} else {
$type_item = "";
}
//infocoms
$ic = new Infocom();
if ($ic->getfromDBforDevice($itemtype, $ID)) {
//immobilizationsheets_item
if (!empty($ic->fields["immo_number"])) {
$immobilizationsheets_item = Toolbox::decodeFromUtf8($ic->fields["immo_number"]);
} else {
$immobilizationsheets_item = "";
}
//buy_date
if (!empty($ic->fields["buy_date"])) {
$buy_date_item = Toolbox::decodeFromUtf8(Html::convdate($ic->fields["buy_date"]));
} else {
$buy_date_item = "";
}
//use_date
if (!empty($ic->fields["use_date"])) {
$use_date_item = Toolbox::decodeFromUtf8(Html::convdate($ic->fields["use_date"]));
} else {
$use_date_item = "";
}
//order_number
if (!empty($ic->fields["order_number"])) {
$order_number_item = Toolbox::decodeFromUtf8($ic->fields["order_number"]);
} else {
$order_number_item = "";
}
//value_item
if (!empty($ic->fields["value"])) {
$value_item = Toolbox::decodeFromUtf8(Html::clean(Html::formatNumber($ic->fields["value"])));
} else {
$value_item = "";
}
//sink_time
if (!empty($ic->fields["sink_time"])) {
$sink_time_item = Toolbox::decodeFromUtf8(sprintf(_n('%d year', '%d years', $ic->fields["sink_time"]), $ic->fields["sink_time"]));
} else {
$sink_time_item = "";
}
//sink_type
if (!empty($ic->fields["sink_type"])) {
$sink_type_item = Toolbox::decodeFromUtf8(Infocom::getAmortTypeName($ic->fields["sink_type"]));
} else {
$sink_type_item = "";
}
} else {
$immobilizationsheets_item = "";
$buy_date_item = "";
$use_date_item = "";
$order_number_item = "";
$value_item = "";
$sink_time_item = "";
$sink_type_item = "";
}
//composants
$devtypes = self::getDeviceTypes();
if ($itemtype == 'Computer') {
$device2 = new $devtypes[2]();
$query2 = "SELECT `deviceprocessors_id`\n FROM `" . getTableForItemType('items_' . $devtypes[2]) . "`\n WHERE `items_id` = '{$ID}'";
//.........这里部分代码省略.........
示例2: showImport
static function showImport($row_num, $item_num, $line, $output_type, $configID, $status, $imported)
{
global $DB, $CFG_GLPI;
$infocom = new Infocom();
$canedit = Session::haveRight(static::$rightname, UPDATE) && $infocom->canUpdate();
$config = new PluginManufacturersimportsConfig();
$config->getFromDB($configID);
$suppliername = $config->fields["name"];
$supplierUrl = $config->fields["supplier_url"];
$supplierId = $config->fields["suppliers_id"];
$supplierWarranty = $config->fields["warranty_duration"];
$supplierkey = $config->fields["supplier_key"];
$supplierclass = "PluginManufacturersimports" . $suppliername;
$supplier = new $supplierclass();
$row_num++;
if ($suppliername) {
$model = new PluginManufacturersimportsModel();
$otherSerial = $model->checkIfModelNeeds($line["itemtype"], $line["id"]);
echo Search::showNewLine($output_type, $row_num % 2);
$ic = new Infocom();
$output_check = "";
if ($canedit && $output_type == Search::HTML_OUTPUT) {
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
$output_check = $supplier->showCheckbox($line["id"], $sel, $otherSerial);
}
echo Search::showItem($output_type, $output_check, $item_num, $row_num);
$link = Toolbox::getItemTypeFormURL($line["itemtype"]);
$ID = "";
if ($_SESSION["glpiis_ids_visible"] || empty($line["name"])) {
$ID .= " (" . $line["id"] . ")";
}
$output_link = "<a href='" . $link . "?id=" . $line["id"] . "'>" . $line["name"] . $ID . "</a><br>" . $line["model_name"];
echo Search::showItem($output_type, $output_link, $item_num, $row_num);
if (Session::isMultiEntitiesMode()) {
echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_entities", $line['entities_id']), $item_num, $row_num);
}
$url = self::selectSupplier($suppliername, $line["serial"], $otherSerial, $supplierkey);
//serial
echo Search::showItem($output_type, $line["serial"], $item_num, $row_num);
//otherserial
echo $supplier->showItem($output_type, $otherSerial, $item_num, $row_num);
//display infocoms
$output_ic = "";
if ($ic->getfromDBforDevice($line["itemtype"], $line["id"])) {
$output_ic .= _n('Supplier', 'Suppliers', 1) . ":" . Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]) . "<br>";
$output_ic .= __('Date of purchase') . " : " . Html::convdate($ic->fields["buy_date"]) . "<br>";
$output_ic .= __('Start date of warranty') . ":" . Html::convdate($ic->fields["warranty_date"]) . "<br>";
if ($ic->fields["warranty_duration"] == -1) {
$output_ic .= __('Warranty duration') . ":" . __('Lifelong') . "<br>";
} else {
$output_ic .= __('Warranty duration') . ":" . $ic->fields["warranty_duration"] . " " . __('month') . "<br>";
}
$tmpdat = Infocom::getWarrantyExpir($ic->fields["warranty_date"], $ic->fields["warranty_duration"]);
$output_ic .= sprintf(__('Valid to %s'), $tmpdat);
} else {
$output_ic .= "";
}
echo Search::showItem($output_type, $output_ic, $item_num, $row_num);
if ($imported != self::IMPORTED) {
//display enterprise and warranty selection
echo "<td>";
if (Session::isMultiEntitiesMode() && $supplierId) {
$item = new Supplier();
$item->getFromDB($supplierId);
if ($item->fields["is_recursive"] || $item->fields["entities_id"] == $line['entities_id']) {
Dropdown::show('Supplier', array('name' => "to_suppliers_id" . $line["id"], 'value' => $supplierId, 'comments' => 0, 'entity' => $line['entities_id']));
} else {
echo "<span class='plugin_manufacturersimports_import_KO'>";
echo __('The choosen supplier is not recursive', 'manufacturersimports') . "</span>";
echo "<input type='hidden' name='to_suppliers_id" . $line["id"] . "' value='-1'>";
}
} else {
Dropdown::show('Supplier', array('name' => "to_suppliers_id" . $line["id"], 'value' => $supplierId, 'comments' => 0, 'entity' => $line['entities_id']));
}
echo "</td>";
$supplier->showWarrantyItem($line["id"], $supplierWarranty);
} else {
//display enterprise and warranty selection
echo "<td>" . Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]) . "</td>";
if ($ic->fields["warranty_duration"] == -1) {
echo "<td>" . __('Lifelong') . "</td>";
} else {
echo "<td>" . $ic->fields["warranty_duration"] . "</td>";
}
}
//supplier url
//url to supplier
$output_url = "<a href='" . $url . "' target='_blank'>" . __('Manufacturer information', 'manufacturersimports') . "</a>";
echo Search::showItem($output_type, $output_url, $item_num, $row_num);
//status
if ($imported != self::IMPORTED) {
if ($status != 2) {
$output_doc = __('Not yet imported', 'manufacturersimports');
} else {
$output_doc = "<span class='plugin_manufacturersimports_import_KO'>" . __('Problem during the importation', 'manufacturersimports');
if (!empty($data["date_import"])) {
$output_doc .= " (" . Html::convdate($data["date_import"]) . ")";
//.........这里部分代码省略.........