modLabel.class.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2008 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 label Module labels
  20. * \brief Module pour gerer les formats d'impression des etiquettes
  21. * \file htdocs/core/modules/modLabel.class.php
  22. * \ingroup other
  23. * \brief Description and activation file for the module Labels
  24. */
  25. include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
  26. /**
  27. * Class to describe and enable module Label
  28. */
  29. class modLabel extends DolibarrModules
  30. {
  31. /**
  32. * Constructor. Define names, constants, directories, boxes, permissions
  33. *
  34. * @param DoliDB $db Database handler
  35. */
  36. public function __construct($db)
  37. {
  38. $this->db = $db;
  39. $this->numero = 60;
  40. $this->family = "technic";
  41. $this->module_position = '75';
  42. // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
  43. $this->name = preg_replace('/^mod/i', '', get_class($this));
  44. $this->description = "Management of stickers";
  45. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  46. $this->version = 'development';
  47. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  48. $this->picto = 'generic';
  49. // Data directories to create when module is enabled
  50. $this->dirs = array("/label/temp");
  51. // Dependencies
  52. $this->hidden = false; // A condition to hide module
  53. $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
  54. $this->requiredby = array(); // List of module ids to disable if this one is disabled
  55. $this->conflictwith = array(); // List of module class names as string this module is in conflict with
  56. $this->phpmin = array(5, 6); // Minimum version of PHP required by module
  57. // Config pages
  58. // $this->config_page_url = array("label.php");
  59. // Constants
  60. $this->const = array();
  61. // Boxes
  62. $this->boxes = array();
  63. // Permissions
  64. $this->rights = array();
  65. $this->rights_class = 'label';
  66. $this->rights[1][0] = 601; // id de la permission
  67. $this->rights[1][1] = 'Read stickers';
  68. $this->rights[1][3] = 1; // La permission est-elle une permission par defaut
  69. $this->rights[1][4] = 'lire';
  70. $this->rights[2][0] = 602; // id de la permission
  71. $this->rights[2][1] = 'Create/modify stickers';
  72. $this->rights[2][3] = 0; // La permission est-elle une permission par defaut
  73. $this->rights[2][4] = 'creer';
  74. $this->rights[4][0] = 609; // id de la permission
  75. $this->rights[4][1] = 'Delete stickers';
  76. $this->rights[4][3] = 0; // La permission est-elle une permission par defaut
  77. $this->rights[4][4] = 'supprimer';
  78. }
  79. /**
  80. * Function called when module is enabled.
  81. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  82. * It also creates data directories
  83. *
  84. * @param string $options Options when enabling module ('', 'noboxes')
  85. * @return int 1 if OK, 0 if KO
  86. */
  87. public function init($options = '')
  88. {
  89. // Permissions
  90. $this->remove($options);
  91. $sql = array();
  92. return $this->_init($sql, $options);
  93. }
  94. }