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