dolibarr 20.0.0
modules_printing.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (C) 2014-2023 Frederic France <frederic.france@netlogic.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
26require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
28
29
34{
38 public $db;
39
43 public $error = '';
44
48 public $name;
49
53 public $desc;
54
58 public $resprint;
59
65 public function __construct($db)
66 {
67 $this->db = $db;
68 }
69
77 public static function listDrivers($db, $maxfilenamelength = 0)
78 {
79 global $conf;
80
81 $type = 'printing';
82 $list = array();
83
84 $listoffiles = array();
85 if (!empty($conf->modules_parts['printing'])) {
86 $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']);
87 } else {
88 $dirmodels = array('/core/modules/printing/');
89 }
90 foreach ($dirmodels as $dir) {
91 $tmpfiles = dol_dir_list(dol_buildpath($dir, 0), 'all', 0, '\.modules.php', '', 'name', SORT_ASC, 0);
92 if (!empty($tmpfiles)) {
93 $listoffiles = array_merge($listoffiles, $tmpfiles);
94 }
95 }
96 foreach ($listoffiles as $record) {
97 $list[$record['fullname']] = str_replace('.modules.php', '', $record['name']);
98 }
99 return $list;
100 }
101
107 public function getDesc()
108 {
109 global $langs;
110 $langs->load("printing");
111 $transstring = "PrintingModuleDesc".$this->name;
112 if ($langs->trans($transstring) != $transstring) {
113 return $langs->trans($transstring);
114 } else {
115 return $this->desc;
116 }
117 }
118}
Parent class of emailing target selectors modules.
static listDrivers($db, $maxfilenamelength=0)
Return list of printing driver.
__construct($db)
Constructor.
getDesc()
Return description of Printing Module.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:63
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.