28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
35$hookmanager->initHooks(array(
'mailingindex'));
38$langs->loadLangs(array(
'commercial',
'orders',
'mails'));
50$help_url =
'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
51$title = $langs->trans(
'MailingArea');
59print
'<div class="fichecenter"><div class="fichethirdleft">';
65 print
'<form method="post" action="'.DOL_URL_ROOT.
'/comm/mailing/list.php">';
66 print
'<input type="hidden" name="token" value="'.newToken().
'">';
67 print
'<div class="div-table-responsive-no-min">';
68 print
'<table class="noborder nohover centpercent">';
69 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"SearchAMailing").
'</td></tr>';
70 print
'<tr class="oddeven"><td class="nowrap">';
71 print $langs->trans(
"Ref").
':</td><td><input type="text" class="flat inputsearch" name="sref"></td>';
72 print
'<td rowspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
73 print
'<tr class="oddeven"><td class="nowrap">';
74 print $langs->trans(
"Other").
':</td><td><input type="text" class="flat inputsearch" name="sall"></td>';
76 print
"</table></div></form><br>\n";
81print
'<table class="noborder centpercent">';
82print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"TargetsStatistics").
'</td></tr>';
84$dir = DOL_DOCUMENT_ROOT.
"/core/modules/mailings";
85$handle = opendir($dir);
87if (is_resource($handle)) {
88 while (($file = readdir($handle)) !==
false) {
89 if (substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS') {
90 if (preg_match(
"/(.*)\.(.*)\.(.*)/i", $file, $reg)) {
91 $modulename = $reg[1];
92 if ($modulename ==
'example') {
97 $file = $dir.
"/".$modulename.
".modules.php";
98 $classname =
"mailing_".$modulename;
100 $mailmodule =
new $classname($db);
103 foreach ($mailmodule->require_module as $key) {
104 if (empty($conf->$key->enabled) || (!$user->admin && $mailmodule->require_admin)) {
113 foreach ($mailmodule->getSqlArrayForStats() as $sql) {
114 print
'<tr class="oddeven">';
116 $result = $db->query($sql);
118 $num = $db->num_rows($result);
123 $obj = $db->fetch_object($result);
124 print
'<td>'.img_object(
'', $mailmodule->picto).
' '.$obj->label.
'</td><td class="right">'.$obj->nb.
'<td>';
145print
'</div><div class="fichetwothirdright">';
152$sql =
"SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat";
153$sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing as m";
154$sql .=
" WHERE m.entity = ".$conf->entity;
155$sql .=
" ORDER BY m.date_creat DESC";
156$sql .=
" LIMIT ".$limit;
157$result = $db->query($sql);
159 print
'<div class="div-table-responsive-no-min">';
160 print
'<table class="noborder centpercent">';
161 print
'<tr class="liste_titre">';
162 print
'<td colspan="2">'.$langs->trans(
"LastMailings", $limit).
'</td>';
163 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
164 print
'<td class="center">'.$langs->trans(
"NbOfEMails").
'</td>';
165 print
'<td class="right"><a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php">'.$langs->trans(
"AllEMailings").
'</a></td></tr>';
167 $num = $db->num_rows($result);
172 $obj = $db->fetch_object($result);
173 $mailstatic =
new Mailing($db);
174 $mailstatic->id = $obj->rowid;
175 $mailstatic->ref = $obj->rowid;
177 print
'<tr class="oddeven">';
178 print
'<td class="nowrap">'.$mailstatic->getNomUrl(1).
'</td>';
179 print
'<td>'.(!empty($obj->title) ?
dol_trunc($obj->title, 38) :
'').
'</td>';
180 print
'<td class="center">'.dol_print_date($db->jdate($obj->date_creat),
'day').
'</td>';
181 print
'<td class="center">'.($obj->nbemail ? $obj->nbemail :
"0").
'</td>';
182 print
'<td class="right">'.$mailstatic->LibStatut($obj->statut, 5).
'</td>';
187 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
189 print
"</table></div><br>";
199$parameters = array(
'user' => $user);
200$reshook = $hookmanager->executeHooks(
'dashboardEmailings', $parameters, $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($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
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.