30require
'../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42$hookmanager->initHooks(array(
'mailingindex'));
45$langs->loadLangs(array(
'commercial',
'orders',
'mails'));
57$help_url =
'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
58$title = $langs->trans(
'MailingArea');
65print
'<div class="fichecenter">';
67print
'<div class="twocolumns">';
69print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
72$titlesearch = $langs->trans(
"SearchAMailing");
74 $titlesearch .=
' | '.$langs->trans(
"smsing");
78print
'<form method="post" action="'.DOL_URL_ROOT.
'/comm/mailing/list.php">';
79print
'<input type="hidden" name="token" value="'.newToken().
'">';
80print
'<div class="div-table-responsive-no-min">';
81print
'<table class="noborder nohover centpercent">';
82print
'<tr class="liste_titre"><td colspan="3">'.$titlesearch.
'</td></tr>';
83print
'<tr class="oddeven nohover"><td class="nowrap">';
84print $langs->trans(
"Ref").
':</td><td><input type="text" class="flat inputsearch" name="sref"></td>';
85print
'<td rowspan="2"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td></tr>';
86print
'<tr class="oddeven nohover"><td class="nowrap">';
87print $langs->trans(
"Other").
':</td><td><input type="text" class="flat inputsearch" name="search_all"></td>';
89print
"</table></div></form><br>\n";
95print
'<table class="noborder centpercent">';
96print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"TargetsStatistics").
'</td></tr>';
98$dir = DOL_DOCUMENT_ROOT.
"/core/modules/mailings";
99$handle = opendir($dir);
101if (is_resource($handle)) {
102 while (($file = readdir($handle)) !==
false) {
103 if (substr($file, 0, 1) !=
'.' && substr($file, 0, 3) !=
'CVS') {
104 if (preg_match(
"/(.*)\.(.*)\.(.*)/i", $file, $reg)) {
105 $modulename = $reg[1];
106 if ($modulename ==
'example') {
111 $file = $dir.
"/".$modulename.
".modules.php";
112 $classname =
"mailing_".$modulename;
114 $mailmodule =
new $classname(
$db);
115 '@phan-var-force MailingTargets $mailmodule';
118 foreach ($mailmodule->require_module as $key) {
119 if (!
isModEnabled($key) || (!$user->admin && !empty($mailmodule->require_admin))) {
128 foreach ($mailmodule->getSqlArrayForStats() as $sql) {
129 print
'<tr class="oddeven">';
131 $result =
$db->query($sql);
133 $num =
$db->num_rows($result);
137 $obj =
$db->fetch_object($result);
138 print
'<td>'.img_object(
'', $mailmodule->picto).
' '.
dol_escape_htmltag($obj->label).
'</td>';
139 print
'<td class="right">'.$obj->nb.
'</td>';
160print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
168$sql =
"SELECT m.rowid, m.titre as title, m.nbemail, m.statut as status, m.date_creat, m.messtype";
169$sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing as m";
170$sql .=
" WHERE m.entity = ".((int)
$conf->entity);
171$sql .=
" ORDER BY m.date_creat DESC";
172$sql .=
$db->plimit($limit);
174$result =
$db->query($sql);
176 print
'<div class="div-table-responsive-no-min">';
177 print
'<table class="noborder centpercent">';
178 print
'<tr class="liste_titre">';
179 print
'<td colspan="2">'.$langs->trans(
"LastMailings", $limit).
'</td>';
181 print
'<td class="center">'.$langs->trans(
"Type").
'</td>';
183 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
184 print
'<td class="center">';
185 print $langs->trans(
"NbOfEMails");
187 print
' | '.$langs->trans(
"Phone");
190 print
'<td class="right"><a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php" title="'.$langs->trans(
"AllEMailings").
'"><span class="badge marginleftonlyshort">...</span></td>';
193 $num =
$db->num_rows($result);
198 $obj =
$db->fetch_object($result);
200 $mailstatic->id = $obj->rowid;
201 $mailstatic->ref = $obj->rowid;
202 $mailstatic->messtype = $obj->messtype;
204 print
'<tr class="oddeven">';
205 print
'<td class="nowrap">'.$mailstatic->getNomUrl(1).
'</td>';
206 print
'<td class="tdoverflowmax100">'.dol_escape_htmltag($obj->title).
'</td>';
208 print
'<td class="center">'.dol_escape_htmltag($obj->messtype).
'</td>';
210 print
'<td class="center">'.dol_print_date(
$db->jdate($obj->date_creat),
'day').
'</td>';
211 print
'<td class="center">'.($obj->nbemail ? (int) $obj->nbemail :
"0").
'</td>';
212 print
'<td class="right">'.$mailstatic->LibStatut($obj->status, 5).
'</td>';
217 print
'<tr><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
219 print
"</table></div><br>";
226print
'</div></div></div>';
229$parameters = array(
'user' => $user);
230$reshook = $hookmanager->executeHooks(
'dashboardEmailings', $parameters, $object);
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
isModEnabled($module)
Is Dolibarr module enabled.
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.