Complete work on usin dol_banner

This commit is contained in:
Laurent Destailleur 2016-11-11 01:55:53 +01:00
parent ab269bd7a6
commit e4c4ced5a3
5 changed files with 65 additions and 31 deletions

View File

@ -790,15 +790,22 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
/* print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback);
print '</td></tr>';
*/
// Description
print '<tr><td>'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
print $form->editfieldval("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string');
print '</td></tr>';
@ -813,10 +820,12 @@ else
print '</td></tr>';
// Status
/*
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')';
print'</td></tr>';
*/
// Nb of distinct emails
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
@ -988,7 +997,7 @@ else
}
$htmltext = '<i>'.$langs->trans("CommonSubstitutions").':<br>';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
foreach($object->substitutionarray as $key => $val)
{
$htmltext.=$key.' = '.$langs->trans($val).'<br>';
@ -996,7 +1005,7 @@ else
$htmltext.='</i>';
// Print mail content
print load_fiche_titre($form->textwithpicto($langs->trans("EMail"), $htmltext), '','title_generic');
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic');
dol_fiche_head('');
@ -1054,17 +1063,26 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback);
print '</td></tr>';
*/
// Topic
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
// From
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
// To
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1).'</td></tr>';
@ -1108,7 +1126,7 @@ else
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
$htmltext = '<i>'.$langs->trans("CommonSubstitutions").':<br>';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
foreach($object->substitutionarray as $key => $val)
{
$htmltext.=$key.' = '.$langs->trans($val).'<br>';
@ -1116,7 +1134,7 @@ else
$htmltext.='</i>';
// Print mail content
print load_fiche_titre($form->textwithpicto($langs->trans("EMail"), $htmltext), '','title_generic');
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic');
dol_fiche_head();

View File

@ -178,17 +178,24 @@ if ($object->fetch($id) >= 0)
dol_fiche_head($head, 'targets', $langs->trans("Mailing"), 0, 'email');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback);
print '</td></tr>';
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
*/
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
@ -197,10 +204,10 @@ if ($object->fetch($id) >= 0)
print '</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
/* print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')';
print '</td></tr>';
*/
// Nb of distinct emails
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");

View File

@ -33,7 +33,8 @@ class Mailing extends CommonObject
{
public $element='mailing';
public $table_element='mailing';
public $picto='email';
var $titre;
var $sujet;
var $body;

View File

@ -43,24 +43,33 @@ llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:M
$form = new Form($db);
$mil = new Mailing($db);
$object = new Mailing($db);
if ($mil->fetch($_REQUEST["id"]) >= 0)
if ($object->fetch($_REQUEST["id"]) >= 0)
{
$head = emailing_prepare_head($mil);
$head = emailing_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Mailing"), 0, 'email');
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
print '<table width="100%"><tr><td>';
$mil->user_creation=$mil->user_creat;
$mil->date_creation=$mil->date_creat;
$mil->user_validation=$mil->user_valid;
$mil->date_validation=$mil->date_valid;
dol_print_object_info($mil);
print '</td></tr></table>';
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="underbanner clearboth"></div><br>';
//print '<table width="100%"><tr><td>';
$object->user_creation=$object->user_creat;
$object->date_creation=$object->date_creat;
$object->user_validation=$object->user_valid;
$object->date_validation=$object->date_valid;
dol_print_object_info($object, 0);
//print '</td></tr></table>';
print '</div>';
dol_fiche_end();
}
llxFooter();

View File

@ -50,7 +50,6 @@ NbOfEMails=Nb of EMails
TotalNbOfDistinctRecipients=Number of distinct recipients
NoTargetYet=No recipients defined yet (Go on tab 'Recipients')
RemoveRecipient=Remove recipient
CommonSubstitutions=Common substitutions
YouCanAddYourOwnPredefindedListHere=To create your email selector module, see htdocs/core/modules/mailings/README.
EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions variables are replaced by generic values
MailingAddFile=Attach this file