modECM.class.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?php
  2. /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2010 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 <http://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 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. 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. // Where to store the module in setup page (0=common,1=interface,2=other)
  54. $this->special = 0;
  55. // Name of png file (without png) used for this module
  56. $this->picto='dir';
  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. $this->const[$r][0] = "ECM_AUTO_TREE_ENABLED";
  68. $this->const[$r][1] = "chaine";
  69. $this->const[$r][2] = "1";
  70. $this->const[$r][3] = 'Auto tree is enabled by default';
  71. $this->const[$r][4] = 0;
  72. // Boxes
  73. $this->boxes = array(); // List of boxes
  74. $r=0;
  75. // Add here list of php file(s) stored in core/boxes that contains class to show a box.
  76. // Example:
  77. //$this->boxes[$r][1] = "myboxa.php";
  78. //$r++;
  79. //$this->boxes[$r][1] = "myboxb.php";
  80. //$r++;
  81. // Permissions
  82. $this->rights_class = 'ecm'; // Permission key
  83. $this->rights = array(); // Permission array used by this module
  84. $r++;
  85. $this->rights[$r][0] = 2501;
  86. $this->rights[$r][1] = 'Consulter/Télécharger les documents';
  87. $this->rights[$r][2] = 'r';
  88. $this->rights[$r][3] = 1;
  89. $this->rights[$r][4] = 'read';
  90. $r++;
  91. $this->rights[$r][0] = 2503;
  92. $this->rights[$r][1] = 'Soumettre ou supprimer des documents';
  93. $this->rights[$r][2] = 'w';
  94. $this->rights[$r][3] = 1;
  95. $this->rights[$r][4] = 'upload';
  96. $r++;
  97. $this->rights[$r][0] = 2515;
  98. $this->rights[$r][1] = 'Administrer les rubriques de documents';
  99. $this->rights[$r][2] = 'w';
  100. $this->rights[$r][3] = 1;
  101. $this->rights[$r][4] = 'setup';
  102. // Menus
  103. //------
  104. $this->menus = array(); // List of menus to add
  105. $r=0;
  106. // Top menu
  107. $this->menu[$r]=array('fk_menu'=>0,
  108. 'type'=>'top',
  109. 'titre'=>'MenuECM',
  110. 'mainmenu'=>'ecm',
  111. 'url'=>'/ecm/index.php',
  112. 'langs'=>'ecm',
  113. 'position'=>100,
  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. $r++;
  119. // Left menu linked to top menu
  120. $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=ecm',
  121. 'type'=>'left',
  122. 'titre'=>'ECMArea',
  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. $r++;
  133. $this->menu[$r]=array('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. $r++;
  146. $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm',
  147. 'type'=>'left',
  148. 'titre'=>'ECMSectionsAuto',
  149. 'mainmenu'=>'ecm',
  150. 'url'=>'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm',
  151. 'langs'=>'ecm',
  152. 'position'=>103,
  153. 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
  154. 'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && ! empty($conf->global->ECM_AUTO_TREE_ENABLED)',
  155. 'target'=>'',
  156. 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
  157. $r++;
  158. }
  159. }