function plugin_headings_barcode($item, $withtemplate = 0) { global $CFG_GLPI; if (!$withtemplate) { echo "<div class='center'>"; switch (get_class($item)) { case 'Profile': $prof = new PluginBarcodeProfile(); $ID = $item->getField('id'); if (!$prof->GetfromDB($ID)) { $prof->createProfile($item); } $prof->showForm($ID, array('target' => $CFG_GLPI['root_doc'] . "/plugins/barcode/front/profile.php")); break; default: $barcode = new PluginBarcodeBarcode(); $barcode->showForm(get_class($item), $item->getField('id')); break; } echo "</div>"; } }
static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids) { global $CFG_GLPI; switch ($ma->getAction()) { case 'Generate': $pbQRcode = new PluginBarcodeQRcode(); $rand = mt_rand(); $number = 0; $codes = array(); if ($ma->POST['eliminate'] > 0) { for ($nb = 0; $nb < $ma->POST['eliminate']; $nb++) { $codes[] = ''; } } if ($ma->POST['type'] == 'QRcode') { foreach ($ids as $key) { $filename = $pbQRcode->generateQRcode($item->getType(), $key, $rand, $number, $ma->POST); if ($filename) { $codes[] = $filename; $number++; } } } else { foreach ($ids as $key) { $item->getFromDB($key); if ($item->isField('otherserial')) { $codes[] = $item->getField('otherserial'); } } } if (count($codes) > 0) { $params['codes'] = $codes; $params['type'] = $ma->POST['type']; $params['size'] = $ma->POST['size']; $params['border'] = $ma->POST['border']; $params['orientation'] = $ma->POST['orientation']; $barcode = new PluginBarcodeBarcode(); $file = $barcode->printPDF($params); $filePath = explode('/', $file); $filename = $filePath[count($filePath) - 1]; $msg = "<a href='" . $CFG_GLPI['root_doc'] . '/plugins/barcode/front/send.php?file=' . urlencode($filename) . "'>" . __('Generated file', 'barcode') . "</a>"; Session::addMessageAfterRedirect($msg); $pbQRcode->cleanQRcodefiles($rand, $number); } $ma->itemDone($item->getType(), 0, MassiveAction::ACTION_OK); return; } parent::processMassiveActionsForOneItemtype($ma, $item, $ids); }
@author David Durieux @co-author @copyright Copyright (c) 2009-2013 Barcode plugin Development team @license AGPL License 3.0 or (at your option) any later version http://www.gnu.org/licenses/agpl-3.0-standalone.html @link https://forge.indepnet.net/projects/barscode @since 2009 ------------------------------------------------------------------------ */ include '../../../inc/includes.php'; if (!isset($_POST["length"])) { $_POST["length"] = ""; } if (!isset($_POST["prefixe"])) { $_POST["prefixe"] = ""; } if (!isset($_POST["size"])) { $_POST["size"] = ""; } if (!isset($_POST["format"])) { $_POST["format"] = ""; } $barcode = new PluginBarcodeBarcode(); $file = $barcode->printPDF($_POST); $filePath = explode('/', $file); $filename = $filePath[count($filePath) - 1]; // TODO : recup GLPI_ROOT de la page d'origine via SESSION ? $msg = "<a href='" . $CFG_GLPI['root_doc'] . '/plugins/barcode/front/send.php?file=' . urlencode($filename) . "'>" . __('Generated file', 'barcode') . "</a>"; Session::addMessageAfterRedirect($msg); Html::back();
function showFormConfigType($p_type = NULL) { global $CFG_GLPI; $pbBarcode = new PluginBarcodeBarcode(); if (is_null($p_type)) { $type = $this->getConfig(); } else { $type = $p_type; } $config = $this->getConfigType($type); echo "<form name='form' method='post'\n action='" . $CFG_GLPI['root_doc'] . "/plugins/barcode/front/config_type.form.php'>"; echo "<input type='hidden' name='type' value='" . $type . "'>"; echo "<div align='center'>"; echo "<table class='tab_cadre' >"; echo "<tr><th colspan='4'>" . $type . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Page size', 'barcode') . "</td><td>"; $pbBarcode->showSizeSelect($config['size']); echo "</td>"; echo "<td>" . __('Orientation', 'barcode') . "</td><td>"; $pbBarcode->showOrientationSelect($config['orientation']); echo "</td>"; echo "</tr>"; echo "<tr><th colspan='4'>" . __('Margins', 'barcode') . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Top', 'barcode') . "</td><td>"; echo "<input type='text' size='20' name='marginTop' value='" . $config['marginTop'] . "'>"; echo "</td>"; echo "<td>" . __('Bottom', 'barcode') . "</td><td>"; echo "<input type='text' size='20' name='marginBottom' value='" . $config['marginBottom'] . "'>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Left', 'barcode') . "</td><td>"; echo "<input type='text' size='20' name='marginLeft' value='" . $config['marginLeft'] . "'>"; echo "</td>"; echo "<td>" . __('Right', 'barcode') . "</td><td>"; echo "<input type='text' size='20' name='marginRight' value='" . $config['marginRight'] . "'>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Inner horizontal', 'barcode') . "</td><td>"; echo "<input type='text' size='20' name='marginHorizontal' value='" . $config['marginHorizontal'] . "'>"; echo "</td>"; echo "<td>" . __('Inner vertical', 'barcode') . "</td><td>"; echo "<input type='text' size='20' name='marginVertical' value='" . $config['marginVertical'] . "'>"; echo "</td>"; echo "</tr>"; echo "<tr><th colspan='4'>" . __('Barcodes sizes', 'barcode') . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Maximum width', 'barcode') . "</td><td>"; echo "<input type='text' size='20' name='maxCodeWidth' value='" . $config['maxCodeWidth'] . "'>"; echo "</td>"; echo "<td>" . __('Maximum height', 'barcode') . "</td><td>"; echo "<input type='text' size='20' name='maxCodeHeight' value='" . $config['maxCodeHeight'] . "'>"; echo "</td>"; echo "</tr>"; echo "<tr><td class='tab_bg_1' colspan='4' align='center'><input type='submit' value='" . __('Save') . "' class='submit'></td></tr>"; echo "</table>"; echo "</div>"; Html::closeForm(); }
static function commonShowMassiveAction() { $pbBarcode = new PluginBarcodeBarcode(); $pbConfig = new PluginBarcodeConfig(); $config = $pbConfig->getConfigType(); echo '<table>'; echo '<tr>'; echo '<td>'; echo "<br/>" . __('Page size', 'barcode') . " : </td><td>"; $pbBarcode->showSizeSelect($config['size']); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo "<br/>" . __('Orientation', 'barcode') . " : </td><td>"; $pbBarcode->showOrientationSelect($config['orientation']); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo __('Not use first xx barcodes', 'barcode') . " : </td><td>"; Dropdown::showNumber("eliminate"); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo __('Display border', 'barcode') . " : </td><td>"; Dropdown::showYesNo("border", 1); echo '</td>'; echo '</tr>'; echo '</table>'; echo '</center>'; echo "<br/><input type='submit' value='" . __('Create', 'barcode') . "' class='submit'>"; }
function showFormMassiveAction() { echo '<input type="hidden" name="type" value="QRcode" />'; echo '<center>'; echo '<table>'; echo '<tr>'; echo '<td>'; echo __('Serial number') . " : </td><td>"; Dropdown::showYesNo("serialnumber", 1); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo __('Inventory number') . " : </td><td>"; Dropdown::showYesNo("inventorynumber", 1); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo __('ID') . " : </td><td>"; Dropdown::showYesNo("id", 1); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo __('UUID') . " : </td><td>"; Dropdown::showYesNo("uuid", 1); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo __('Name') . " : </td><td>"; Dropdown::showYesNo("name", 1); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo __('Web page of the device') . " : </td><td>"; Dropdown::showYesNo("url", 1); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo __('Date QRcode') . " (" . date('Y-m-d') . ") : </td><td>"; Dropdown::showYesNo("qrcodedate", 1); echo '</td>'; echo '</tr>'; echo '</table>'; echo '<br/>'; PluginBarcodeBarcode::commonShowMassiveAction(); }