modNotification.class.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005-2007 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. /**
  19. * \defgroup notification Module email notification
  20. * \brief Module pour gerer les notifications (par mail ou autre)
  21. * \file htdocs/core/modules/modNotification.class.php
  22. * \ingroup notification
  23. * \brief Fichier de description et activation du module Notification
  24. */
  25. include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
  26. /**
  27. * Classe de description et activation du module Mailing
  28. */
  29. class modNotification extends DolibarrModules
  30. {
  31. /**
  32. * Constructor. Define names, constants, directories, boxes, permissions
  33. *
  34. * @param DoliDB $db Database handler
  35. */
  36. function __construct($db)
  37. {
  38. $this->db = $db;
  39. $this->numero = 600;
  40. $this->family = "technic";
  41. // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
  42. $this->name = preg_replace('/^mod/i','',get_class($this));
  43. $this->description = "Gestion des notifications (par mail) sur evenement Dolibarr";
  44. $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
  45. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  46. $this->special = 1;
  47. $this->picto='email';
  48. // Data directories to create when module is enabled.
  49. $this->dirs = array();
  50. // Dependances
  51. $this->depends = array();
  52. $this->requiredby = array();
  53. $this->langfiles = array("mails");
  54. // Config pages
  55. $this->config_page_url = array("notification.php");
  56. // Constantes
  57. $this->const = array();
  58. // Boites
  59. $this->boxes = array();
  60. // Permissions
  61. $this->rights = array();
  62. $this->rights_class = 'notification';
  63. }
  64. /**
  65. * Function called when module is enabled.
  66. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  67. * It also creates data directories
  68. *
  69. * @param string $options Options when enabling module ('', 'noboxes')
  70. * @return int 1 if OK, 0 if KO
  71. */
  72. function init($options='')
  73. {
  74. // Permissions
  75. $this->remove($options);
  76. $sql = array();
  77. return $this->_init($sql,$options);
  78. }
  79. /**
  80. * Function called when module is disabled.
  81. * Remove from database constants, boxes and permissions from Dolibarr database.
  82. * Data directories are not deleted
  83. *
  84. * @param string $options Options when enabling module ('', 'noboxes')
  85. * @return int 1 if OK, 0 if KO
  86. */
  87. function remove($options='')
  88. {
  89. $sql = array();
  90. return $this->_remove($sql,$options);
  91. }
  92. }