Merge pull request #9885 from frederic34/patch-15

code comment html form class
This commit is contained in:
Laurent Destailleur 2018-10-30 12:27:19 +01:00 committed by GitHub
commit bddd658ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3283,17 +3283,17 @@ class Form
if ($empty && empty($arraytypes['code'])) continue; if ($empty && empty($arraytypes['code'])) continue;
if ($format == 0) print '<option value="'.$id.'"'; if ($format == 0) print '<option value="'.$id.'"';
if ($format == 1) print '<option value="'.$arraytypes['code'].'"'; elseif ($format == 1) print '<option value="'.$arraytypes['code'].'"';
if ($format == 2) print '<option value="'.$arraytypes['code'].'"'; elseif ($format == 2) print '<option value="'.$arraytypes['code'].'"';
if ($format == 3) print '<option value="'.$id.'"'; elseif ($format == 3) print '<option value="'.$id.'"';
// Si selected est text, on compare avec code, sinon avec id // Si selected est text, on compare avec code, sinon avec id
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) print ' selected'; if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) print ' selected';
elseif ($selected == $id) print ' selected'; elseif ($selected == $id) print ' selected';
print '>'; print '>';
if ($format == 0) $value=($maxlength?dol_trunc($arraytypes['label'],$maxlength):$arraytypes['label']); if ($format == 0) $value=($maxlength?dol_trunc($arraytypes['label'],$maxlength):$arraytypes['label']);
if ($format == 1) $value=$arraytypes['code']; elseif ($format == 1) $value=$arraytypes['code'];
if ($format == 2) $value=($maxlength?dol_trunc($arraytypes['label'],$maxlength):$arraytypes['label']); elseif ($format == 2) $value=($maxlength?dol_trunc($arraytypes['label'],$maxlength):$arraytypes['label']);
if ($format == 3) $value=$arraytypes['code']; elseif ($format == 3) $value=$arraytypes['code'];
print $value?$value:'&nbsp;'; print $value?$value:'&nbsp;';
print '</option>'; print '</option>';
} }
@ -3806,18 +3806,18 @@ class Form
{ {
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n"; $more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
} }
else if ($input['type'] == 'password') elseif ($input['type'] == 'password')
{ {
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n"; $more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
} }
else if ($input['type'] == 'select') elseif ($input['type'] == 'select')
{ {
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'; $more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>';
if (! empty($input['label'])) $more.=$input['label'].'</td><td class="tdtop" align="left">'; if (! empty($input['label'])) $more.=$input['label'].'</td><td class="tdtop" align="left">';
$more.=$this->selectarray($input['name'],$input['values'],$input['default'],1,0,0,$moreattr,0,0,0,'',$morecss); $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1,0,0,$moreattr,0,0,0,'',$morecss);
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
} }
else if ($input['type'] == 'checkbox') elseif ($input['type'] == 'checkbox')
{ {
$more.='<tr>'; $more.='<tr>';
$more.='<td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].' </td><td align="left">'; $more.='<td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].' </td><td align="left">';
@ -3828,7 +3828,7 @@ class Form
$more.=' /></td>'; $more.=' /></td>';
$more.='</tr>'."\n"; $more.='</tr>'."\n";
} }
else if ($input['type'] == 'radio') elseif ($input['type'] == 'radio')
{ {
$i=0; $i=0;
foreach($input['values'] as $selkey => $selval) foreach($input['values'] as $selkey => $selval)
@ -3844,7 +3844,7 @@ class Form
$i++; $i++;
} }
} }
else if ($input['type'] == 'date') elseif ($input['type'] == 'date')
{ {
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td>'; $more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td>';
$more.='<td align="left">'; $more.='<td align="left">';
@ -3856,7 +3856,7 @@ class Form
$formquestion[] = array('name'=>$input['name'].'hour'); $formquestion[] = array('name'=>$input['name'].'hour');
$formquestion[] = array('name'=>$input['name'].'min'); $formquestion[] = array('name'=>$input['name'].'min');
} }
else if ($input['type'] == 'other') elseif ($input['type'] == 'other')
{ {
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'; $more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>';
if (! empty($input['label'])) $more.=$input['label'].'</td><td align="left">'; if (! empty($input['label'])) $more.=$input['label'].'</td><td align="left">';
@ -3864,7 +3864,7 @@ class Form
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
} }
else if ($input['type'] == 'onecolumn') elseif ($input['type'] == 'onecolumn')
{ {
$more.='<tr><td colspan="2" align="left">'; $more.='<tr><td colspan="2" align="left">';
$more.=$input['value']; $more.=$input['value'];
@ -4589,6 +4589,7 @@ class Form
* *
* @param string $selected preselected currency code * @param string $selected preselected currency code
* @param string $htmlname name of HTML select list * @param string $htmlname name of HTML select list
* @deprecated
* @return void * @return void
*/ */
function select_currency($selected='',$htmlname='currency_id') function select_currency($selected='',$htmlname='currency_id')
@ -4976,7 +4977,7 @@ class Form
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field.
* @param datetime $adddateof Add a link "Date of invoice" using the following date. * @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @return string|null Nothing or string if nooutput is 1 * @return string|void Nothing or string if nooutput is 1
* @deprecated * @deprecated
* @see form_date, select_month, select_year, select_dayofweek * @see form_date, select_month, select_year, select_dayofweek
*/ */
@ -5374,7 +5375,7 @@ class Form
* if 'textselect' input hour is in text and input min is a combo * if 'textselect' input hour is in text and input min is a combo
* @param integer $minunderhours If 1, show minutes selection under the hours * @param integer $minunderhours If 1, show minutes selection under the hours
* @param int $nooutput Do not output html string but return it * @param int $nooutput Do not output html string but return it
* @return string|null * @return string|void
*/ */
function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0)
{ {