dolibarr  16.0.5
modPrinting.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2014 Frederic France <frederic.france@free.fr>
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 
28 include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
29 
30 
31 
36 {
42  public function __construct($db)
43  {
44  $this->db = $db;
45  $this->numero = 64000;
46  // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
47  // It is used to group modules in module setup page
48  $this->family = "interface";
49  $this->module_position = '52';
50  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
51  $this->name = preg_replace('/^mod/i', '', get_class($this));
52  // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
53  $this->description = "Enable Direct Printing System.";
54  $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version
55  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
56  // Name of image file used for this module.
57  // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
58  // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
59  $this->picto = 'printer';
60 
61  // Data directories to create when module is enabled.
62  $this->dirs = array();
63 
64  // Config pages
65  $this->config_page_url = array("printing.php@printing");
66 
67  // Dependencies
68  $this->hidden = false; // A condition to hide module
69  $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
70  $this->requiredby = array(); // List of module ids to disable if this one is disabled
71  $this->conflictwith = array(); // List of module class names as string this module is in conflict with
72  $this->phpmin = array(5, 6); // Minimum version of PHP required by module
73  $this->need_dolibarr_version = array(3, 7, -2); // Minimum version of Dolibarr required by module
74  $this->conflictwith = array();
75  $this->langfiles = array("printing");
76 
77  // Constants
78  $this->const = array();
79 
80  // Boxes
81  $this->boxes = array();
82 
83  // Permissions
84  $this->rights = array();
85  $this->rights_class = 'printing';
86 
87  $r = 0;
88  // $this->rights[$r][0] Id permission (unique tous modules confondus)
89  // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission)
90  // $this->rights[$r][2] Non utilise
91  // $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut
92  // $this->rights[$r][4] Niveau 1 pour nommer permission dans code
93  // $this->rights[$r][5] Niveau 2 pour nommer permission dans code
94 
95  $r++;
96  $this->rights[$r][0] = 64001;
97  $this->rights[$r][1] = 'DirectPrint';
98  $this->rights[$r][2] = 'r';
99  $this->rights[$r][3] = 0;
100  $this->rights[$r][4] = 'read';
101 
102  // Main menu entries
103  $this->menus = array(); // List of menus to add
104  $r = 0;
105 
106  // This is to declare the Top Menu entry:
107  $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu
108  'type'=>'left', // This is a Top menu entry
109  'titre'=>'MenuDirectPrinting',
110  'url'=>'/printing/index.php?mainmenu=home&leftmenu=admintools',
111  'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
112  'position'=>300,
113  'enabled'=>'$conf->printing->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)',
114  'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules
115  'target'=>'',
116  'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
117 
118  $r++;
119  }
120 }
db
$conf db
API class for accounts.
Definition: inc.php:41
description
print *****$script_file(".$version.") pid cd cd cd description as description
Definition: email_expire_services_to_customers.php:83
name
$conf db name
Definition: repair.php:122
modPrinting
Class to describe and activate module Direct Printing.
Definition: modPrinting.class.php:35
modPrinting\__construct
__construct($db)
Constructor.
Definition: modPrinting.class.php:42
DolibarrModules
Class DolibarrModules.
Definition: DolibarrModules.class.php:37