modNotification.class.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. * Class to describe and enable 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. // 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 = "interface";
  43. // Module position in the family on 2 digits ('01', '10', '20', ...)
  44. $this->module_position = '01';
  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. $this->description = "EMail notifications (push) on business Dolibarr events";
  48. $this->descriptionlong = 'Module600Long';
  49. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  50. $this->version = 'dolibarr';
  51. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  52. $this->picto='email';
  53. // Data directories to create when module is enabled.
  54. $this->dirs = array();
  55. // Dependencies
  56. $this->hidden = false; // A condition to hide module
  57. $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
  58. $this->requiredby = array(); // List of module ids to disable if this one is disabled
  59. $this->conflictwith = array(); // List of module class names as string this module is in conflict with
  60. $this->phpmin = array(5,4); // Minimum version of PHP required by module
  61. $this->langfiles = array("mails");
  62. // Config pages
  63. $this->config_page_url = array("notification.php");
  64. // Constants
  65. $this->const = array();
  66. // Boxes
  67. $this->boxes = array();
  68. // Permissions
  69. $this->rights = array();
  70. $this->rights_class = 'notification';
  71. }
  72. /**
  73. * Function called when module is enabled.
  74. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  75. * It also creates data directories
  76. *
  77. * @param string $options Options when enabling module ('', 'noboxes')
  78. * @return int 1 if OK, 0 if KO
  79. */
  80. function init($options='')
  81. {
  82. // Permissions
  83. $this->remove($options);
  84. $sql = array();
  85. return $this->_init($sql,$options);
  86. }
  87. }