2009-07-29 20:41:39 +02:00
|
|
|
<?php
|
|
|
|
|
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
2024-09-23 00:37:30 +02:00
|
|
|
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
2009-07-29 20:41:39 +02:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2009-07-29 20:41:39 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
* or see https://www.gnu.org/
|
2009-07-29 20:41:39 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2011-10-24 12:59:44 +02:00
|
|
|
* \file htdocs/core/lib/emailing.lib.php
|
2009-07-29 20:41:39 +02:00
|
|
|
* \brief Library file with function for emailing module
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2012-02-04 10:48:47 +01:00
|
|
|
* Prepare array with list of tabs
|
2009-07-29 20:41:39 +02:00
|
|
|
*
|
2015-02-10 11:38:13 +01:00
|
|
|
* @param Mailing $object Object related to tabs
|
2024-09-23 00:37:30 +02:00
|
|
|
* @return array<array{0:string,1:string,2:string}> Array of tabs to show
|
2009-07-29 20:41:39 +02:00
|
|
|
*/
|
2015-02-10 11:38:13 +01:00
|
|
|
function emailing_prepare_head(Mailing $object)
|
2009-07-29 20:41:39 +02:00
|
|
|
{
|
2012-06-14 20:08:46 +02:00
|
|
|
global $user, $langs, $conf;
|
2009-07-29 20:41:39 +02:00
|
|
|
|
|
|
|
|
$h = 0;
|
|
|
|
|
$head = array();
|
|
|
|
|
|
2014-09-18 21:18:25 +02:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/card.php?id=".$object->id;
|
2009-07-29 20:41:39 +02:00
|
|
|
$head[$h][1] = $langs->trans("MailCard");
|
|
|
|
|
$head[$h][2] = 'card';
|
|
|
|
|
$h++;
|
2016-04-01 10:52:19 +02:00
|
|
|
|
2023-11-27 11:39:32 +01:00
|
|
|
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mailing', 'mailing_advance', 'recipient'))) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("MailRecipients");
|
2021-02-23 22:03:23 +01:00
|
|
|
if ($object->nbemail > 0) {
|
|
|
|
|
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$object->nbemail.'</span>';
|
|
|
|
|
}
|
2020-10-31 14:32:18 +01:00
|
|
|
$head[$h][2] = 'targets';
|
|
|
|
|
$h++;
|
2012-06-14 20:08:46 +02:00
|
|
|
}
|
2018-07-26 19:05:34 +02:00
|
|
|
|
2023-11-27 11:39:32 +01:00
|
|
|
if (getDolGlobalString('EMAILING_USE_ADVANCED_SELECTOR')) {
|
2016-12-10 11:49:35 +01:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
|
|
|
|
$head[$h][2] = 'advtargets';
|
|
|
|
|
$h++;
|
|
|
|
|
}
|
2016-12-09 19:06:59 +01:00
|
|
|
|
2012-02-04 10:48:47 +01:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
|
2009-07-29 20:41:39 +02:00
|
|
|
$head[$h][1] = $langs->trans("Info");
|
|
|
|
|
$head[$h][2] = 'info';
|
|
|
|
|
$h++;
|
2016-04-01 10:52:19 +02:00
|
|
|
|
2023-10-26 13:40:44 +02:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/note.php?id=".$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("Note");
|
|
|
|
|
$head[$h][2] = 'note';
|
|
|
|
|
$h++;
|
|
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing');
|
2009-07-29 20:41:39 +02:00
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing', 'remove');
|
2013-02-14 16:25:43 +01:00
|
|
|
|
2009-07-29 20:41:39 +02:00
|
|
|
return $head;
|
|
|
|
|
}
|