29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
36$hookmanager->initHooks(array(
'mailingindex'));
39$langs->loadLangs(array(
'commercial',
'orders',
'mails'));
51$help_url =
'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
52$title = $langs->trans(
'MailingArea');
59print
'<div class="fichecenter">';
61print
'<div class="twocolumns">';
63print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
66$titlesearch = $langs->trans(
"SearchAMailing");
68 $titlesearch .=
' | '.$langs->trans(
"smsing");
72print
'<form method="post" action="'.DOL_URL_ROOT.
'/comm/mailing/list.php">';
73print
'<input type="hidden" name="token" value="'.newToken().
'">';
74print
'<div class="div-table-responsive-no-min">';
75print
'<table class="noborder nohover centpercent">';
76print
'<tr class="liste_titre"><td colspan="3">'.$titlesearch.
'</td></tr>';
77print
'<tr class="oddeven"><td class="nowrap">';
78print $langs->trans(
"Ref").
':</td><td><input type="text" class="flat inputsearch" name="sref"></td>';
79print
'<td rowspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
80print
'<tr class="oddeven"><td class="nowrap">';
81print $langs->trans(
"Other").
':</td><td><input type="text" class="flat inputsearch" name="sall"></td>';
83print
"</table></div></form><br>\n";
89print
'<table class="noborder centpercent">';
90print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"TargetsStatistics").
'</td></tr>';
92$dir = DOL_DOCUMENT_ROOT.
"/core/modules/mailings";
93$handle = opendir($dir);
95if (is_resource($handle)) {
96 while (($file = readdir($handle)) !==
false) {
97 if (substr($file, 0, 1) !=
'.' && substr($file, 0, 3) !=
'CVS') {
98 if (preg_match(
"/(.*)\.(.*)\.(.*)/i", $file, $reg)) {
99 $modulename = $reg[1];
100 if ($modulename ==
'example') {
105 $file = $dir.
"/".$modulename.
".modules.php";
106 $classname =
"mailing_".$modulename;
108 $mailmodule =
new $classname($db);
109 '@phan-var-force MailingTargets $mailmodule';
112 foreach ($mailmodule->require_module as $key) {
113 if (!isModEnabled($key) || (!$user->admin && !empty($mailmodule->require_admin))) {
122 foreach ($mailmodule->getSqlArrayForStats() as $sql) {
123 print
'<tr class="oddeven">';
125 $result = $db->query($sql);
127 $num = $db->num_rows($result);
131 $obj = $db->fetch_object($result);
132 print
'<td>'.img_object(
'', $mailmodule->picto).
' '.
dol_escape_htmltag($obj->label).
'</td>';
133 print
'<td class="right">'.$obj->nb.
'</td>';
154print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
162$sql =
"SELECT m.rowid, m.titre as title, m.nbemail, m.statut as status, m.date_creat, m.messtype";
163$sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing as m";
164$sql .=
" WHERE m.entity = ".$conf->entity;
165$sql .=
" ORDER BY m.date_creat DESC";
166$sql .=
" LIMIT ".$limit;
167$result = $db->query($sql);
169 print
'<div class="div-table-responsive-no-min">';
170 print
'<table class="noborder centpercent">';
171 print
'<tr class="liste_titre">';
172 print
'<td colspan="2">'.$langs->trans(
"LastMailings", $limit).
'</td>';
174 print
'<td class="center">'.$langs->trans(
"Type").
'</td>';
176 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
177 print
'<td class="center">';
178 print $langs->trans(
"NbOfEMails");
180 print
' | '.$langs->trans(
"Phone");
183 print
'<td class="right"><a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php">'.$langs->trans(
"AllEMailings").
'</a></td>';
186 $num = $db->num_rows($result);
191 $obj = $db->fetch_object($result);
192 $mailstatic =
new Mailing($db);
193 $mailstatic->id = $obj->rowid;
194 $mailstatic->ref = $obj->rowid;
195 $mailstatic->messtype = $obj->messtype;
197 print
'<tr class="oddeven">';
198 print
'<td class="nowrap">'.$mailstatic->getNomUrl(1).
'</td>';
199 print
'<td class="tdoverflowmax100">'.dol_escape_htmltag($obj->title).
'</td>';
201 print
'<td class="center">'.dol_escape_htmltag($obj->messtype).
'</td>';
203 print
'<td class="center">'.dol_print_date($db->jdate($obj->date_creat),
'day').
'</td>';
204 print
'<td class="center">'.($obj->nbemail ? (int) $obj->nbemail :
"0").
'</td>';
205 print
'<td class="right">'.$mailstatic->LibStatut($obj->status, 5).
'</td>';
210 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
212 print
"</table></div><br>";
219print
'</div></div></div>';
222$parameters = array(
'user' => $user);
223$reshook = $hookmanager->executeHooks(
'dashboardEmailings', $parameters, $object);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage emailings module.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.