modECM.class.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. $this->const[$r][0] = "ECM_AUTO_TREE_ENABLED";
  66. $this->const[$r][1] = "chaine";
  67. $this->const[$r][2] = "1";
  68. $this->const[$r][3] = 'Auto tree is enabled by default';
  69. $this->const[$r][4] = 0;
  70. // Boxes
  71. $this->boxes = array(); // List of boxes
  72. $r = 0;
  73. // Add here list of php file(s) stored in core/boxes that contains class to show a box.
  74. // Example:
  75. //$this->boxes[$r][1] = "myboxa.php";
  76. //$r++;
  77. //$this->boxes[$r][1] = "myboxb.php";
  78. //$r++;
  79. // Permissions
  80. $this->rights_class = 'ecm'; // Permission key
  81. $this->rights = array(); // Permission array used by this module
  82. $r++;
  83. $this->rights[$r][0] = 2501;
  84. $this->rights[$r][1] = 'Read or download documents';
  85. $this->rights[$r][2] = 'r';
  86. $this->rights[$r][3] = 0;
  87. $this->rights[$r][4] = 'read';
  88. $r++;
  89. $this->rights[$r][0] = 2503;
  90. $this->rights[$r][1] = 'Upload a document';
  91. $this->rights[$r][2] = 'w';
  92. $this->rights[$r][3] = 0;
  93. $this->rights[$r][4] = 'upload';
  94. $r++;
  95. $this->rights[$r][0] = 2515;
  96. $this->rights[$r][1] = 'Administer directories of documents';
  97. $this->rights[$r][2] = 'w';
  98. $this->rights[$r][3] = 0;
  99. $this->rights[$r][4] = 'setup';
  100. // Menus
  101. //------
  102. $this->menus = array(); // List of menus to add
  103. $r = 0;
  104. // Top menu
  105. $this->menu[$r] = array(
  106. 'fk_menu'=>0,
  107. 'type'=>'top',
  108. 'titre'=>'MenuECM',
  109. 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
  110. 'mainmenu'=>'ecm',
  111. 'url'=>'/ecm/index.php',
  112. 'langs'=>'ecm',
  113. 'position'=>82,
  114. 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup',
  115. 'enabled'=>'$conf->ecm->enabled',
  116. 'target'=>'',
  117. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  118. );
  119. $r++;
  120. // Left menu linked to top menu
  121. $this->menu[$r] = array(
  122. 'fk_menu'=>'fk_mainmenu=ecm',
  123. 'type'=>'left',
  124. 'titre'=>'ECMArea',
  125. 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
  126. 'mainmenu'=>'ecm',
  127. 'leftmenu'=>'ecm',
  128. 'url'=>'/ecm/index.php?mainmenu=ecm&leftmenu=ecm',
  129. 'langs'=>'ecm',
  130. 'position'=>101,
  131. 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
  132. 'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
  133. 'target'=>'',
  134. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  135. );
  136. $r++;
  137. $this->menu[$r] = array(
  138. 'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
  139. 'type'=>'left',
  140. 'titre'=>'ECMSectionsManual',
  141. 'mainmenu'=>'ecm',
  142. 'leftmenu'=>'ecm_manual',
  143. 'url'=>'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
  144. 'langs'=>'ecm',
  145. 'position'=>102,
  146. 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
  147. 'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
  148. 'target'=>'',
  149. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  150. );
  151. $r++;
  152. $this->menu[$r] = array(
  153. 'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
  154. 'type'=>'left',
  155. 'titre'=>'ECMSectionsAuto',
  156. 'mainmenu'=>'ecm',
  157. 'url'=>'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
  158. 'langs'=>'ecm',
  159. 'position'=>103,
  160. 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
  161. 'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && ! empty($conf->global->ECM_AUTO_TREE_ENABLED)',
  162. 'target'=>'',
  163. 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
  164. );
  165. $r++;
  166. }
  167. }