dolibarr  17.0.4
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  *
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 
28 
32 class modECM extends DolibarrModules
33 {
34 
40  public function __construct($db)
41  {
42  $this->db = $db;
43 
44  // Id for module (must be unique).
45  // Use here a free id.
46  $this->numero = 2500;
47 
48  // Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
49  // It is used to sort modules in module setup page
50  $this->family = "ecm";
51  $this->module_position = '10';
52  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53  $this->name = preg_replace('/^mod/i', '', get_class($this));
54  // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
55  $this->description = "Electronic Content Management";
56  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57  $this->version = 'dolibarr';
58  // Key used in llx_const table to save module status enabled/disabled (XXX is id value)
59  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60  // Name of png file (without png) used for this module
61  $this->picto = 'folder-open';
62 
63  // Data directories to create when module is enabled
64  $this->dirs = array("/ecm/temp");
65 
66  // Config pages. Put here list of php page names stored in admmin directory used to setup module
67  $this->config_page_url = array('ecm.php');
68 
69  // Dependencies
70  $this->depends = array(); // List of modules id that must be enabled if this module is enabled
71  $this->requiredby = array(); // List of modules id to disable if this one is disabled
72 
73  // Constants
74  $this->const = array(); // List of parameters
75  $r = 0;
76 
77  $this->const[$r][0] = "ECM_AUTO_TREE_ENABLED";
78  $this->const[$r][1] = "chaine";
79  $this->const[$r][2] = "1";
80  $this->const[$r][3] = 'Auto tree is enabled by default';
81  $this->const[$r][4] = 0;
82 
83  // Boxes
84  $this->boxes = array(); // List of boxes
85  $r = 0;
86 
87  // Add here list of php file(s) stored in core/boxes that contains class to show a box.
88  // Example:
89  //$this->boxes[$r][1] = "myboxa.php";
90  //$r++;
91  //$this->boxes[$r][1] = "myboxb.php";
92  //$r++;
93 
94  // Permissions
95  $this->rights_class = 'ecm'; // Permission key
96  $this->rights = array(); // Permission array used by this module
97 
98  $r++;
99  $this->rights[$r][0] = 2501;
100  $this->rights[$r][1] = 'Read or download documents';
101  $this->rights[$r][2] = 'r';
102  $this->rights[$r][3] = 0;
103  $this->rights[$r][4] = 'read';
104 
105  $r++;
106  $this->rights[$r][0] = 2503;
107  $this->rights[$r][1] = 'Upload a document';
108  $this->rights[$r][2] = 'w';
109  $this->rights[$r][3] = 0;
110  $this->rights[$r][4] = 'upload';
111 
112  $r++;
113  $this->rights[$r][0] = 2515;
114  $this->rights[$r][1] = 'Administer directories of documents';
115  $this->rights[$r][2] = 'w';
116  $this->rights[$r][3] = 0;
117  $this->rights[$r][4] = 'setup';
118 
119 
120  // Menus
121  //------
122  $this->menus = array(); // List of menus to add
123  $r = 0;
124 
125  // Top menu
126  $this->menu[$r] = array(
127  'fk_menu'=>0,
128  'type'=>'top',
129  'titre'=>'MenuECM',
130  'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
131  'mainmenu'=>'ecm',
132  'url'=>'/ecm/index.php',
133  'langs'=>'ecm',
134  'position'=>82,
135  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup',
136  'enabled'=>'$conf->ecm->enabled',
137  'target'=>'',
138  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
139  );
140  $r++;
141 
142  // Left menu linked to top menu
143  $this->menu[$r] = array(
144  'fk_menu'=>'fk_mainmenu=ecm',
145  'type'=>'left',
146  'titre'=>'ECMArea',
147  'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
148  'mainmenu'=>'ecm',
149  'leftmenu'=>'ecm',
150  'url'=>'/ecm/index.php?mainmenu=ecm&leftmenu=ecm',
151  'langs'=>'ecm',
152  'position'=>101,
153  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
154  'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
155  'target'=>'',
156  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
157  );
158  $r++;
159 
160  $this->menu[$r] = array(
161  'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
162  'type'=>'left',
163  'titre'=>'ECMSectionsManual',
164  'mainmenu'=>'ecm',
165  'leftmenu'=>'ecm_manual',
166  'url'=>'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
167  'langs'=>'ecm',
168  'position'=>102,
169  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
170  'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
171  'target'=>'',
172  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
173  );
174  $r++;
175 
176  $this->menu[$r] = array(
177  'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
178  'type'=>'left',
179  'titre'=>'ECMSectionsAuto',
180  'mainmenu'=>'ecm',
181  'url'=>'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
182  'langs'=>'ecm',
183  'position'=>103,
184  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
185  'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && getDolGlobalInt("ECM_AUTO_TREE_ENABLED")',
186  'target'=>'',
187  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
188  );
189  $r++;
190 
191  $this->menu[$r] = array(
192  'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
193  'type'=>'left',
194  'titre'=>'ECMSectionsMedias',
195  'mainmenu'=>'ecm',
196  'url'=>'/ecm/index_medias.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
197  'langs'=>'ecm',
198  'position'=>104,
199  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
200  'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && getDolGlobalInt("MAIN_FEATURES_LEVEL") == 2',
201  'target'=>'',
202  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
203  );
204  $r++;
205  }
206 }
Class DolibarrModules.
Description and activation class for module ECM.
__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:122
$conf db
API class for accounts.
Definition: inc.php:41