dolibarr  18.0.6
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  // Boxes
78  $this->boxes = array(); // List of boxes
79  $r = 0;
80 
81  // Add here list of php file(s) stored in core/boxes that contains class to show a box.
82  // Example:
83  //$this->boxes[$r][1] = "myboxa.php";
84  //$r++;
85  //$this->boxes[$r][1] = "myboxb.php";
86  //$r++;
87 
88  // Permissions
89  $this->rights_class = 'ecm'; // Permission key
90  $this->rights = array(); // Permission array used by this module
91 
92  $r++;
93  $this->rights[$r][0] = 2501;
94  $this->rights[$r][1] = 'Read or download documents';
95  $this->rights[$r][2] = 'r';
96  $this->rights[$r][3] = 0;
97  $this->rights[$r][4] = 'read';
98 
99  $r++;
100  $this->rights[$r][0] = 2503;
101  $this->rights[$r][1] = 'Upload a document';
102  $this->rights[$r][2] = 'w';
103  $this->rights[$r][3] = 0;
104  $this->rights[$r][4] = 'upload';
105 
106  $r++;
107  $this->rights[$r][0] = 2515;
108  $this->rights[$r][1] = 'Administer directories of documents';
109  $this->rights[$r][2] = 'w';
110  $this->rights[$r][3] = 0;
111  $this->rights[$r][4] = 'setup';
112 
113 
114  // Menus
115  //------
116  $this->menu = array(); // List of menus to add
117  $r = 0;
118 
119  // Top menu
120  $this->menu[$r] = array(
121  'fk_menu'=>0,
122  'type'=>'top',
123  'titre'=>'MenuECM',
124  'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
125  'mainmenu'=>'ecm',
126  'url'=>'/ecm/index.php',
127  'langs'=>'ecm',
128  'position'=>82,
129  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup',
130  'enabled'=>'isModEnabled("ecm")',
131  'target'=>'',
132  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
133  );
134  $r++;
135 
136  // Left menu linked to top menu
137  $this->menu[$r] = array(
138  'fk_menu'=>'fk_mainmenu=ecm',
139  'type'=>'left',
140  'titre'=>'ECMArea',
141  'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
142  'mainmenu'=>'ecm',
143  'leftmenu'=>'ecm',
144  'url'=>'/ecm/index.php?mainmenu=ecm&leftmenu=ecm',
145  'langs'=>'ecm',
146  'position'=>101,
147  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
148  'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
149  'target'=>'',
150  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
151  );
152  $r++;
153 
154  $this->menu[$r] = array(
155  'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
156  'type'=>'left',
157  'titre'=>'ECMSectionsManual',
158  'mainmenu'=>'ecm',
159  'leftmenu'=>'ecm_manual',
160  'url'=>'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
161  'langs'=>'ecm',
162  'position'=>102,
163  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
164  'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
165  'target'=>'',
166  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
167  );
168  $r++;
169 
170  $this->menu[$r] = array(
171  'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
172  'type'=>'left',
173  'titre'=>'ECMSectionsAuto',
174  'mainmenu'=>'ecm',
175  'url'=>'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
176  'langs'=>'ecm',
177  'position'=>103,
178  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
179  'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && !getDolGlobalInt("ECM_AUTO_TREE_HIDEN")',
180  'target'=>'',
181  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
182  );
183  $r++;
184 
185  $this->menu[$r] = array(
186  'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
187  'type'=>'left',
188  'titre'=>'ECMSectionsMedias',
189  'mainmenu'=>'ecm',
190  'url'=>'/ecm/index_medias.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
191  'langs'=>'ecm',
192  'position'=>104,
193  'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
194  'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && getDolGlobalInt("MAIN_FEATURES_LEVEL") == 2',
195  'target'=>'',
196  'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
197  );
198  $r++;
199  }
200 }
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:123