Completed
Branch develop (aca1c1)
by
unknown
24:57
created

modModuleBuilder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 74
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 66 1
1
<?php
2
/* Copyright (C) 2017   Laurent Destailleur  <[email protected]>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
 */
17
18
/**
19
 * 	\defgroup   modulebuilder   Module ModuleBuilder
20
 *  \brief      Add a log into a block chain for some actions.
21
 *  \file       htdocs/core/modules/modBlockedLog.class.php
22
 *  \ingroup    blockedlog
23
 *  \brief      Description and activation file for module ModuleBuilder
24
 */
25
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
26
27
/**
28
 *	Class to describe a ModuleBuilder module
29
 */
30
class modModuleBuilder extends DolibarrModules
31
{
32
    /**
33
	 *   Constructor. Define names, constants, directories, boxes, permissions
34
	 *
35
	 *   @param      DoliDB		$db      Database handler
36
     */
37
    function __construct($db)
38
    {
39
    	global $langs,$conf;
40
41
        $this->db = $db;
42
        $this->numero = 3300;
43
44
		// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
45
		// It is used to group modules in module setup page
46
        $this->family = "technic";
47
        // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
48
        $this->name = preg_replace('/^mod/i','',get_class($this));
49
        $this->description = "A tool to help developers to build their own module.";
50
        $this->version = 'development';                        // 'development', 'experimental' or 'dolibarr' or version
51
        // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
52
        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
53
        // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
54
        $this->special = 1;
55
        // Name of image file used for this module.
56
        $this->picto='technic';
57
58
        // Data directories to create when module is enabled
59
        $this->dirs = array();
60
61
        // Config pages
62
        //-------------
63
        $this->config_page_url = array();
64
65
        // Dependancies
66
        //-------------
67
	    $this->hidden = false;	// A condition to disable module
68
	    $this->depends = array();		// List of modules id that must be enabled if this module is enabled
69
        $this->requiredby = array();	// List of modules id to disable if this one is disabled
70
	    $this->conflictwith = array();	// List of modules id this module is in conflict with
71
        $this->langfiles = array();
72
73
        // Constants
74
        //-----------
75
76
77
        // New pages on tabs
78
        // -----------------
79
        $this->tabs = array();
80
81
        // Boxes
82
        //------
83
        $this->boxes = array();
84
85
        // Main menu entries
86
        //------------------
87
        $this->menu = array();
88
        
89
        $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools',
0 ignored issues
show
Bug introduced by
The variable $r does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
90
            'type'=>'left',
91
            'titre'=>'ModuleBuilder',
92
            'mainmenu'=>'home',
93
            'leftmenu'=>'admintools_modulebuilder',
94
            'url'=>'/modulebuilder/index.php?mainmenu=home&amp;leftmenu=admintools_modulebuilder',
95
            'langs'=>'modulebuilder',
96
            'position'=>100,
97
            'perms'=>'1',
98
            'enabled'=>'$conf->modulebuilder->enabled && preg_match(\'/^admintools/\',$leftmenu) && ($user->admin || $conf->global->MODULEBUILDER_FOREVERYONE)',
99
            'target'=>'_modulebuilder',
100
            'user'=>0);
101
        
102
    }
103
}
104