html.formmailing.class.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /* Copyright (C) 2014 Florian Henry florian.henry@open-concept.pro
  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 <http://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/core/class/html.formmailing.class.php
  19. * \ingroup core
  20. * \brief File of predefined functions for HTML forms for mailing module
  21. */
  22. require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
  23. /**
  24. * Class to offer components to list and upload files
  25. */
  26. class FormMailing extends Form
  27. {
  28. /**
  29. * @var string[] Error codes (or messages)
  30. */
  31. public $errors = array();
  32. /**
  33. * Output a select with destinaries status
  34. *
  35. * @param string $selectedid The selected id
  36. * @param string $htmlname Name of controm
  37. * @param integer $show_empty Show empty option
  38. * @return string HTML select
  39. */
  40. public function selectDestinariesStatus($selectedid='', $htmlname='dest_status', $show_empty=0)
  41. {
  42. global $langs;
  43. $langs->load("mails");
  44. require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
  45. $mailing = new Mailing($this->db);
  46. $options = array();
  47. if ($show_empty) {
  48. $options[-2] = ''; // Note -1 is used for error
  49. }
  50. $options = $options + $mailing->statut_dest;
  51. return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1);
  52. }
  53. }