modECM.class.php 6.6 KB

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