dolibarr  19.0.0-dev
modModuleBuilder.class.php
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourcefore.net>
3  * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
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 
26 include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
27 
32 {
38  public function __construct($db)
39  {
40  global $langs, $conf;
41 
42  $this->db = $db;
43  $this->numero = 3300;
44 
45  // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
46  // It is used to group modules in module setup page
47  $this->family = "technic";
48  $this->module_position = '90';
49  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50  $this->name = preg_replace('/^mod/i', '', get_class($this));
51  $this->description = "A RAD (Rapid Application Development - low-code and no-code) tool to help developers or advanced users to build their own module/application.";
52  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53  $this->version = 'dolibarr';
54  // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
55  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
56  // Name of image file used for this module.
57  $this->picto = 'bug';
58 
59  // Data directories to create when module is enabled
60  $this->dirs = array();
61 
62  // Config pages
63  //-------------
64  $this->config_page_url = array('setup.php@modulebuilder');
65 
66  // Dependencies
67  //-------------
68  $this->hidden = false; // A condition to disable module
69  $this->depends = array(); // List of modules id that must be enabled if this module is enabled
70  $this->requiredby = array(); // List of modules id to disable if this one is disabled
71  $this->conflictwith = array(); // List of modules id this module is in conflict with
72  $this->langfiles = array();
73 
74  // Constants
75  //-----------
76 
77 
78  // New pages on tabs
79  // -----------------
80  $this->tabs = array();
81 
82  // Boxes
83  //------
84  $this->boxes = array();
85 
86  // Permissions
87  //------------
88  $this->rights = array(); // Permission array used by this module
89  $this->rights_class = 'modulebuilder';
90 
91  $r = 0;
92 
93  $r++;
94  $this->rights[$r][0] = 3301;
95  $this->rights[$r][1] = 'Generate new modules';
96  $this->rights[$r][2] = 'a';
97  $this->rights[$r][3] = 0;
98  $this->rights[$r][4] = 'run';
99 
100 
101  // Main menu entries
102  //------------------
103  $this->menu = array();
104 
105  $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools',
106  'type'=>'left',
107  'titre'=>'ModuleBuilder',
108  'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
109  'mainmenu'=>'tools',
110  'leftmenu'=>'devtools_modulebuilder',
111  'url'=>'/modulebuilder/index.php?mainmenu=tools&amp;leftmenu=devtools',
112  'langs'=>'modulebuilder',
113  'position'=>100,
114  'perms'=>'$user->hasRight("modulebuilder", "run")',
115  //'enabled'=>'isModEnabled("modulebuilder") && preg_match(\'/^(devtools|all)/\',$leftmenu)',
116  'enabled'=>'isModEnabled("modulebuilder")',
117  'target'=>'_modulebuilder',
118  'user'=>0);
119  }
120 }
Class DolibarrModules.
Class to describe a ModuleBuilder module.
__construct($db)
Constructor.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:123