dolibarr 24.0.0-beta
modECM.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
30include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
31
32
37{
43 public function __construct($db)
44 {
45 $this->db = $db;
46
47 // Id for module (must be unique).
48 // Use here a free id.
49 $this->numero = 2500;
50
51 // Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
52 // It is used to sort modules in module setup page
53 $this->family = "ecm";
54 $this->module_position = '10';
55 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
56 $this->name = preg_replace('/^mod/i', '', get_class($this));
57 // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
58 $this->description = "Electronic Content Management";
59 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
60 $this->version = 'dolibarr';
61 // Key used in llx_const table to save module status enabled/disabled (XXX is id value)
62 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
63 // Name of png file (without png) used for this module
64 $this->picto = 'folder-open';
65
66 // Data directories to create when module is enabled
67 $this->dirs = array("/ecm/temp");
68
69 // Config pages. Put here list of php page names stored in admmin directory used to setup module
70 $this->config_page_url = array('ecm.php');
71
72 // Dependencies
73 $this->depends = array(); // List of modules id that must be enabled if this module is enabled
74 $this->requiredby = array(); // List of modules id to disable if this one is disabled
75
76 // Constants
77 $this->const = array(); // List of parameters
78 $r = 0;
79
80 // Boxes
81 $this->boxes = array(); // List of boxes
82 $r = 0;
83
84 // Add here list of php file(s) stored in core/boxes that contains class to show a box.
85 // Example:
86 //$this->boxes[$r][1] = "myboxa.php";
87 //$r++;
88 //$this->boxes[$r][1] = "myboxb.php";
89 //$r++;
90
91 // Permissions
92 $this->rights_class = 'ecm'; // Permission key
93 $this->rights = array(); // Permission array used by this module
94
95 $r++;
96 $this->rights[$r][0] = 2501;
97 $this->rights[$r][1] = 'Read or download documents';
98 $this->rights[$r][2] = 'r';
99 $this->rights[$r][3] = 0;
100 $this->rights[$r][4] = 'read';
101
102 $r++;
103 $this->rights[$r][0] = 2503;
104 $this->rights[$r][1] = 'Upload a document';
105 $this->rights[$r][2] = 'w';
106 $this->rights[$r][3] = 0;
107 $this->rights[$r][4] = 'upload';
108
109 $r++;
110 $this->rights[$r][0] = 2515;
111 $this->rights[$r][1] = 'Administer directories of documents';
112 $this->rights[$r][2] = 'w';
113 $this->rights[$r][3] = 0;
114 $this->rights[$r][4] = 'setup';
115
116
117 // Menus
118 //------
119 $this->menu = array(); // List of menus to add
120 $r = 0;
121
122 // Top menu
123 $this->menu[$r] = array(
124 'fk_menu' => 0,
125 'type' => 'top',
126 'titre' => 'MenuECM',
127 'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth"'),
128 'mainmenu' => 'ecm',
129 'url' => '/ecm/index.php',
130 'langs' => 'ecm',
131 'position' => 82,
132 'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload") || $user->hasRight("ecm", "setup")',
133 'enabled' => 'isModEnabled("ecm")',
134 'target' => '',
135 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
136 );
137 $r++;
138
139 // Left menu linked to top menu
140 $this->menu[$r] = array(
141 'fk_menu' => 'fk_mainmenu=ecm',
142 'type' => 'left',
143 'titre' => 'ECMArea',
144 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
145 'mainmenu' => 'ecm',
146 'leftmenu' => 'ecm',
147 'url' => '/ecm/index.php?mainmenu=ecm&leftmenu=ecm',
148 'langs' => 'ecm',
149 'position' => 101,
150 'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
151 'enabled' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
152 'target' => '',
153 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
154 );
155 $r++;
156
157 $this->menu[$r] = array(
158 'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm',
159 'type' => 'left',
160 'titre' => 'ECMSectionsManual',
161 'mainmenu' => 'ecm',
162 'leftmenu' => 'ecm_manual',
163 'url' => '/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
164 'langs' => 'ecm',
165 'position' => 102,
166 'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
167 'enabled' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
168 'target' => '',
169 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
170 );
171 $r++;
172
173 $this->menu[$r] = array(
174 'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm',
175 'type' => 'left',
176 'titre' => 'ECMSectionsAuto',
177 'mainmenu' => 'ecm',
178 'url' => '/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
179 'langs' => 'ecm',
180 'position' => 103,
181 'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
182 'enabled' => '($user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")) && !getDolGlobalInt("ECM_AUTO_TREE_HIDEN")',
183 'target' => '',
184 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
185 );
186 $r++;
187
188 $this->menu[$r] = array(
189 'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm',
190 'type' => 'left',
191 'titre' => 'ECMSectionsMedias',
192 'mainmenu' => 'ecm',
193 'url' => '/ecm/index_medias.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
194 'langs' => 'ecm',
195 'position' => 104,
196 'perms' => '$user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")',
197 'enabled' => '($user->hasRight("ecm", "read") || $user->hasRight("ecm", "upload")) && getDolGlobalInt("MAIN_FEATURES_LEVEL") == 2',
198 'target' => '',
199 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
200 );
201 $r++;
202 }
203}
Class DolibarrModules.
Description and activation class for module ECM.
__construct($db)
Constructor.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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:133