30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
45$hookmanager->initHooks(array(
'mailingindex'));
48$langs->loadLangs(array(
'commercial',
'orders',
'mails'));
60$help_url =
'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
61$title = $langs->trans(
'MailingArea');
68print
'<div class="fichecenter">';
70print
'<div class="twocolumns">';
72print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
75$titlesearch = $langs->trans(
"SearchAMailing");
77 $titlesearch .=
' | '.$langs->trans(
"smsing");
81print
'<form method="post" action="'.DOL_URL_ROOT.
'/comm/mailing/list.php">';
82print
'<input type="hidden" name="token" value="'.newToken().
'">';
83print
'<div class="div-table-responsive-no-min">';
84print
'<table class="noborder nohover centpercent">';
85print
'<tr class="liste_titre"><td colspan="3">'.$titlesearch.
'</td></tr>';
86print
'<tr class="oddeven"><td class="nowrap">';
87print $langs->trans(
"Ref").
':</td><td><input type="text" class="flat inputsearch" name="sref"></td>';
88print
'<td rowspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
89print
'<tr class="oddeven"><td class="nowrap">';
90print $langs->trans(
"Other").
':</td><td><input type="text" class="flat inputsearch" name="sall"></td>';
92print
"</table></div></form><br>\n";
98print
'<table class="noborder centpercent">';
99print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"TargetsStatistics").
'</td></tr>';
101$dir = DOL_DOCUMENT_ROOT.
"/core/modules/mailings";
102$handle = opendir($dir);
104if (is_resource($handle)) {
105 while (($file = readdir($handle)) !==
false) {
106 if (substr($file, 0, 1) !=
'.' && substr($file, 0, 3) !=
'CVS') {
107 if (preg_match(
"/(.*)\.(.*)\.(.*)/i", $file, $reg)) {
108 $modulename = $reg[1];
109 if ($modulename ==
'example') {
114 $file = $dir.
"/".$modulename.
".modules.php";
115 $classname =
"mailing_".$modulename;
117 $mailmodule =
new $classname($db);
118 '@phan-var-force MailingTargets $mailmodule';
121 foreach ($mailmodule->require_module as $key) {
122 if (!isModEnabled($key) || (!$user->admin && !empty($mailmodule->require_admin))) {
131 foreach ($mailmodule->getSqlArrayForStats() as $sql) {
132 print
'<tr class="oddeven">';
134 $result = $db->query($sql);
136 $num = $db->num_rows($result);
140 $obj = $db->fetch_object($result);
141 print
'<td>'.img_object(
'', $mailmodule->picto).
' '.
dol_escape_htmltag($obj->label).
'</td>';
142 print
'<td class="right">'.$obj->nb.
'</td>';
163print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
171$sql =
"SELECT m.rowid, m.titre as title, m.nbemail, m.statut as status, m.date_creat, m.messtype";
172$sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing as m";
173$sql .=
" WHERE m.entity = ".$conf->entity;
174$sql .=
" ORDER BY m.date_creat DESC";
175$sql .=
" LIMIT ".$limit;
176$result = $db->query($sql);
178 print
'<div class="div-table-responsive-no-min">';
179 print
'<table class="noborder centpercent">';
180 print
'<tr class="liste_titre">';
181 print
'<td colspan="2">'.$langs->trans(
"LastMailings", $limit).
'</td>';
183 print
'<td class="center">'.$langs->trans(
"Type").
'</td>';
185 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
186 print
'<td class="center">';
187 print $langs->trans(
"NbOfEMails");
189 print
' | '.$langs->trans(
"Phone");
192 print
'<td class="right"><a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php">'.$langs->trans(
"AllEMailings").
'</a></td>';
195 $num = $db->num_rows($result);
200 $obj = $db->fetch_object($result);
201 $mailstatic =
new Mailing($db);
202 $mailstatic->id = $obj->rowid;
203 $mailstatic->ref = $obj->rowid;
204 $mailstatic->messtype = $obj->messtype;
206 print
'<tr class="oddeven">';
207 print
'<td class="nowrap">'.$mailstatic->getNomUrl(1).
'</td>';
208 print
'<td class="tdoverflowmax100">'.dol_escape_htmltag($obj->title).
'</td>';
210 print
'<td class="center">'.dol_escape_htmltag($obj->messtype).
'</td>';
212 print
'<td class="center">'.dol_print_date($db->jdate($obj->date_creat),
'day').
'</td>';
213 print
'<td class="center">'.($obj->nbemail ? (int) $obj->nbemail :
"0").
'</td>';
214 print
'<td class="right">'.$mailstatic->LibStatut($obj->status, 5).
'</td>';
219 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
221 print
"</table></div><br>";
228print
'</div></div></div>';
231$parameters = array(
'user' => $user);
232$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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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.