Uniformize code

This commit is contained in:
Laurent Destailleur 2016-09-18 12:10:12 +02:00
parent 61d32b7fb6
commit 6093dfe333

View File

@ -85,10 +85,11 @@ class FormSms
/**
* Show the form to input an sms.
*
* @param string $width Width of form
* @param string $morecss Class on first column td
* @param int $showform Show form tags and submit button (recommanded is to use with value 0)
* @return void
*/
function show_form($width='180px')
function show_form($morecss='titlefield', $showform=1)
{
global $conf, $langs, $user, $form;
@ -119,13 +120,14 @@ function limitChars(textarea, limit, infodiv)
}
</script>';
print "<form method=\"POST\" name=\"smsform\" enctype=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
if ($showform) print "<form method=\"POST\" name=\"smsform\" enctype=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
foreach ($this->param as $key=>$value)
{
print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n";
}
print "<table class=\"border\" width=\"100%\">\n";
print "<table class=\"border centpercent\">\n";
// Substitution array
if ($this->withsubstit)
@ -145,8 +147,9 @@ function limitChars(textarea, limit, infodiv)
{
if ($this->withfromreadonly)
{
print '<tr><td class="'.$morecss.'">'.$langs->trans("SmsFrom");
print '<input type="hidden" name="fromsms" value="'.$this->fromsms.'">';
print "<tr><td width=\"".$width."\">".$langs->trans("SmsFrom")."</td><td>";
print "</td><td>";
if ($this->fromtype == 'user')
{
$langs->load("users");
@ -172,7 +175,7 @@ function limitChars(textarea, limit, infodiv)
}
else
{
print "<tr><td width=\"".$width."\">".$langs->trans("SmsFrom")."</td><td>";
print '<tr><td class="'.$morecss.'">'.$langs->trans("SmsFrom")."</td><td>";
//print '<input type="text" name="fromname" size="30" value="'.$this->fromsms.'">';
if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') // For backward compatibility @deprecated
{
@ -320,16 +323,21 @@ function limitChars(textarea, limit, infodiv)
print "</table>\n";
print '<div class="center">';
print '<input class="button" type="submit" name="sendmail" value="'.$langs->trans("SendSms").'">';
if ($this->withcancel)
if ($showform)
{
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<div class="center">';
print '<input class="button" type="submit" name="sendmail" value="'.dol_escape_htmltag($langs->trans("SendSms")).'">';
if ($this->withcancel)
{
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
}
print '</div>';
print "</form>\n";
}
print '</div>';
print "</form>\n";
print "<!-- End form SMS -->\n";
}