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/**
20 *  \file       htdocs/printing/index.php
21 *  \ingroup    printing
22 *  \brief      Printing
23 */
24
25require '../main.inc.php';
26include_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
27
28// Load translation files required by the page
29$langs->load("printing");
30
31if (!$user->admin) {
32	accessforbidden();
33}
34
35
36/*
37 * Actions
38 */
39
40// None
41
42
43/*
44 * View
45 */
46
47llxHeader("", $langs->trans("Printing"));
48
49print_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');
50
51print $langs->trans("DirectPrintingJobsDesc").'<br><br>';
52
53// List Jobs from printing modules
54$object = new PrintingDriver($db);
55$result = $object->listDrivers($db, 10);
56foreach ($result as $driver) {
57	require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
58	$classname = 'printing_'.$driver;
59	$langs->load($driver);
60	$printer = new $classname($db);
61	$keyforprinteractive = $printer->active;
62	if ($keyforprinteractive && $conf->global->$keyforprinteractive) {
63		//$printer->listJobs('commande');
64		$result = $printer->listJobs();
65		print $printer->resprint;
66
67		if ($result > 0) {
68			setEventMessages($printer->error, $printer->errors, 'errors');
69		}
70	}
71}
72
73// End of page
74llxFooter();
75$db->close();
76