modCollab.class.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \defgroup collab Module collab
  19. * \brief Collab module descriptor.
  20. * \file htdocs/core/modules/modCollab.class.php
  21. * \ingroup collab
  22. * \brief Description and activation file for the module Collab
  23. */
  24. include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
  25. /**
  26. * Class to describe Websites module
  27. */
  28. class modCollab 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. global $langs, $conf;
  38. $this->db = $db;
  39. $this->numero = 30000;
  40. // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
  41. // It is used to group modules in module setup page
  42. $this->family = "portal";
  43. $this->module_position = '51';
  44. // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
  45. $this->name = preg_replace('/^mod/i', '', get_class($this));
  46. $this->description = "Enable the public collaboration features, like shared pad, shared online sheets, etc...";
  47. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  48. $this->version = 'development';
  49. // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
  50. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  51. // Name of image file used for this module.
  52. $this->picto = 'collab';
  53. // Data directories to create when module is enabled
  54. $this->dirs = array("/collab/temp");
  55. // Config pages
  56. //-------------
  57. $this->config_page_url = array(/*'collab.php'*/);
  58. // Dependancies
  59. //-------------
  60. $this->hidden = !empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module
  61. $this->depends = array(); // List of modules id that must be enabled if this module is enabled
  62. $this->requiredby = array(); // List of modules id to disable if this one is disabled
  63. $this->conflictwith = array(); // List of modules id this module is in conflict with
  64. $this->langfiles = array("collab");
  65. // Constants
  66. //-----------
  67. $this->const = array();
  68. // New pages on tabs
  69. // -----------------
  70. $this->tabs = array();
  71. // Boxes
  72. //------
  73. $this->boxes = array();
  74. // Permissions
  75. $this->rights = array(); // Permission array used by this module
  76. $this->rights_class = 'collab';
  77. $r = 0;
  78. /*$this->rights[$r][0] = 30001;
  79. $this->rights[$r][1] = 'Read website content';
  80. $this->rights[$r][3] = 0;
  81. $this->rights[$r][4] = 'read';
  82. $r++;
  83. $this->rights[$r][0] = 30002;
  84. $this->rights[$r][1] = 'Create/modify website content';
  85. $this->rights[$r][3] = 0;
  86. $this->rights[$r][4] = 'write';
  87. $r++;
  88. $this->rights[$r][0] = 30003;
  89. $this->rights[$r][1] = 'Delete website content';
  90. $this->rights[$r][3] = 0;
  91. $this->rights[$r][4] = 'delete';
  92. $r++;*/
  93. // Main menu entries
  94. $r = 0;
  95. $this->menu[$r] = array(
  96. 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
  97. 'type'=>'top', // This is a Left menu entry
  98. 'titre'=>'Collab',
  99. 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em092"'),
  100. 'mainmenu'=>'collab',
  101. 'url'=>'/collab/index.php',
  102. 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
  103. 'position'=>100,
  104. 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
  105. 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
  106. 'target'=>'',
  107. 'user'=>2 // 0=Menu for internal users, 1=external users, 2=both
  108. );
  109. $r++;
  110. }
  111. }