index.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /* Copyright (C) 2014-2018 Frederic France <frederic.france@netlogic.fr>
  3. * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/printing/index.php
  20. * \ingroup printing
  21. * \brief Printing
  22. */
  23. // Load Dolibarr environment
  24. require '../main.inc.php';
  25. include_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
  26. // Load translation files required by the page
  27. $langs->load("printing");
  28. if (!$user->admin) {
  29. accessforbidden();
  30. }
  31. /*
  32. * Actions
  33. */
  34. // None
  35. /*
  36. * View
  37. */
  38. llxHeader("", $langs->trans("Printing"));
  39. print_barre_liste($langs->trans("Printing"), 0, $_SERVER["PHP_SELF"], '', '', '', '<a class="button" href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Refresh").'</a>', 0, 0, 'title_setup.png');
  40. print $langs->trans("DirectPrintingJobsDesc").'<br><br>';
  41. // List Jobs from printing modules
  42. $object = new PrintingDriver($db);
  43. $result = $object->listDrivers($db, 10);
  44. foreach ($result as $driver) {
  45. require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
  46. $classname = 'printing_'.$driver;
  47. $langs->load($driver);
  48. $printer = new $classname($db);
  49. $keyforprinteractive = $printer->active;
  50. if ($keyforprinteractive && getDolGlobalString($keyforprinteractive)) {
  51. //$printer->listJobs('commande');
  52. $result = $printer->listJobs();
  53. print $printer->resprint;
  54. if ($result > 0) {
  55. setEventMessages($printer->error, $printer->errors, 'errors');
  56. }
  57. }
  58. }
  59. // End of page
  60. llxFooter();
  61. $db->close();