modECM.class.php 6.6 KB

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