dolibarr/htdocs/core/lib/emailing.lib.php

76 lines
2.5 KiB
PHP
Raw Permalink Normal View History

2009-07-29 20:41:39 +02:00
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
* 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
*
* @param Mailing $object Object related to tabs
* @return array<array{0:string,1:string,2:string}> Array of tabs to show
2009-07-29 20:41:39 +02: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();
$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'))) {
$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>';
}
$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++;
}
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
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/note.php?id=".$object->id;
$head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing');
2009-07-29 20:41:39 +02:00
complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing', 'remove');
2009-07-29 20:41:39 +02:00
return $head;
}