本文整理汇总了PHP中Printer::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::getLink方法的具体用法?PHP Printer::getLink怎么用?PHP Printer::getLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Printer
的用法示例。
在下文中一共展示了Printer::getLink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
/** form for Cartridge
*
* @since version 0.84
*
* @param $ID integer Id of the cartridge
* @param $options array of possible options:
* - parent Object : the printers where the cartridge is used
**/
function showForm($ID, $options = array())
{
global $DB, $CFG_GLPI;
if (isset($options['parent']) && !empty($options['parent'])) {
$printer = $options['parent'];
}
if (!$this->getFromDB($ID)) {
return false;
}
$printer = new Printer();
$printer->check($this->getField('printers_id'), UPDATE);
$cartitem = new CartridgeItem();
$cartitem->getFromDB($this->getField('cartridgeitems_id'));
$is_old = !empty($this->fields['date_out']);
$is_used = !empty($this->fields['date_use']);
$options['colspan'] = 2;
$options['candel'] = false;
// Do not permit delete here
$options['canedit'] = $is_used;
// Do not permit edit if cart is not used
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . _n('Printer', 'Printers', 1) . "</td><td>";
echo $printer->getLink();
echo "<input type='hidden' name='printers_id' value='" . $this->getField('printers_id') . "'>\n";
echo "<input type='hidden' name='cartridgeitems_id' value='" . $this->getField('cartridgeitems_id') . "'>\n";
echo "</td>\n";
echo "<td>" . _n('Cartridge model', 'Cartridge models', 1) . "</td>";
echo "<td>" . $cartitem->getLink() . "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Add date') . "</td>";
echo "<td>" . Html::convDate($this->fields["date_in"]) . "</td>";
echo "<td>" . __('Use date') . "</td><td>";
if ($is_used && !$is_old) {
Html::showDateField("date_use", array('value' => $this->fields["date_use"], 'maybeempty' => false, 'canedit' => true, 'min' => $this->fields["date_in"]));
} else {
echo Html::convDate($this->fields["date_use"]);
}
echo "</td></tr>\n";
if ($is_old) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('End date') . "</td><td>";
Html::showDateField("date_out", array('value' => $this->fields["date_out"], 'maybeempty' => false, 'canedit' => true, 'min' => $this->fields["date_use"]));
echo "</td>";
echo "<td>" . __('Printer counter') . "</td><td>";
echo "<input type='text' name='pages' value=\"" . $this->fields['pages'] . "\">";
echo "</td></tr>\n";
}
$this->showFormButtons($options);
return true;
}
示例2: showGraph
/**
* Show printer graph form
**/
function showGraph($id, $options = array())
{
global $DB, $CFG_GLPI;
$printer = new Printer();
$where = '';
$begin = '';
$end = '';
$timeUnit = 'day';
$graphField = 'pages_total';
$pagecounters = array();
$graphType = 'day';
if (isset($_SESSION['glpi_plugin_fusioninventory_graph_begin'])) {
$begin = $_SESSION['glpi_plugin_fusioninventory_graph_begin'];
}
if ($begin == 'NULL' or $begin == '') {
$begin = date("Y-m-01");
// first day of current month
}
if (isset($_SESSION['glpi_plugin_fusioninventory_graph_end'])) {
$end = $_SESSION['glpi_plugin_fusioninventory_graph_end'];
}
if (isset($_SESSION['glpi_plugin_fusioninventory_graph_type'])) {
$graphType = $_SESSION['glpi_plugin_fusioninventory_graph_type'];
}
if ($end == 'NULL' or $end == '') {
$end = date("Y-m-d");
// today
}
if (isset($_SESSION['glpi_plugin_fusioninventory_graph_timeUnit'])) {
$timeUnit = $_SESSION['glpi_plugin_fusioninventory_graph_timeUnit'];
}
if (!isset($_SESSION['glpi_plugin_fusioninventory_graph_printersComp'])) {
$_SESSION['glpi_plugin_fusioninventory_graph_printersComp'] = array();
}
if (isset($_SESSION['glpi_plugin_fusioninventory_graph_printerCompAdd'])) {
$printerCompAdd = $_SESSION['glpi_plugin_fusioninventory_graph_printerCompAdd'];
if (!key_exists($printerCompAdd, $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'])) {
$oPrinter = new Printer();
if ($oPrinter->getFromDB($printerCompAdd)) {
$_SESSION['glpi_plugin_fusioninventory_graph_printersComp'][$printerCompAdd] = $oPrinter->getField('name');
}
}
} elseif (isset($_SESSION['glpi_plugin_fusioninventory_graph_printerCompRemove'])) {
unset($_SESSION['glpi_plugin_fusioninventory_graph_printersComp'][$_SESSION['glpi_plugin_fusioninventory_graph_printerCompRemove']]);
}
$oPrinter = new Printer();
$printers = $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'];
$printersView = $printers;
// printers without the current printer
if (isset($printersView[$id])) {
unset($printersView[$id]);
} else {
if ($oPrinter->getFromDB($id)) {
$printers[$id] = $oPrinter->getField('name');
}
}
$printersList = '';
foreach ($printers as $printers_id => $printername) {
if ($printersList != '') {
$printersList .= '<br/>';
}
if ($printers_id == $id) {
$printersList .= $printername;
} else {
$oPrinter->getFromDB($printers_id);
$printersList .= $oPrinter->getLink(1);
}
}
$printersIds = "";
foreach (array_keys($printers) as $printerId) {
if ($printersIds != '') {
$printersIds .= ', ';
}
$printersIds .= $printerId;
}
$where = " WHERE `printers_id` IN(" . $printersIds . ")";
if ($begin != '' || $end != '') {
$where .= " AND " . getDateRequest("`date`", $begin, $end);
}
$group = '';
switch ($timeUnit) {
case 'day':
$group = "GROUP BY `printers_id`, `year`, `month`, `day`";
break;
case 'week':
$group = "GROUP BY `printers_id`, `year`, `month`, `week`";
break;
case 'month':
$group = "GROUP BY `printers_id`, `year`, `month`";
break;
case 'year':
$group = "GROUP BY `printers_id`, `year`";
break;
}
echo "<form method='post' name='snmp_form' id='snmp_form' action='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/printer_info.form.php'>";
echo "<table class='tab_cadre' cellpadding='5' width='950'>";
$mapping = new PluginFusioninventoryMapping();
//.........这里部分代码省略.........
示例3: while
echo "<th>" . __('Status') . "</th>";
echo "</tr>";
if ($result = $DB->query($query)) {
while ($data = $DB->fetch_array($result)) {
echo "<tr class='tab_bg_1'>";
echo "<td>";
if ($data['network_id'] > 0) {
$class = new NetworkEquipment();
$class->getFromDB($data['network_id']);
} else {
if ($data['printer_id'] > 0) {
$class = new Printer();
$class->getFromDB($data['printer_id']);
}
}
echo $class->getLink(1);
echo "</td>";
echo "<td>" . Html::convDateTime($data['last_fusioninventory_update']) . "</td>";
echo "<td>";
if ($data['network_id'] > 0) {
echo __('Networks');
} else {
if ($data['printer_id'] > 0) {
echo __('Printers');
}
}
echo "</td>";
echo "<td>" . $data['ip'] . "</td>";
echo "<td>" . $data['serial'] . "</td>";
echo "<td>" . $data['otherserial'] . "</td>";
if ($data['network_id'] > 0) {