Merge pull request #15732 from frederic34/patch-14

fix phpcs
This commit is contained in:
Laurent Destailleur 2020-12-11 14:36:04 +01:00 committed by GitHub
commit 2353ade957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5930,24 +5930,29 @@ class Form
*
* @param string $prefix Prefix
* @param string $selected Selected duration type
* @param array|null $ecludetypes Array of duration types to exclude. Example array('y', 'm')
* @param array $excludetypes Array of duration types to exclude. Example array('y', 'm')
* @return string HTML select string
*/
public function selectTypeDuration($prefix, $selected = 'i', $excludtypes = null)
public function selectTypeDuration($prefix, $selected = 'i', $excludetypes = array())
{
global $langs;
$TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes'));
$TDurationTypes = array(
'y'=>$langs->trans('Years'),
'm'=>$langs->trans('Month'),
'w'=>$langs->trans('Weeks'),
'd'=>$langs->trans('Days'),
'h'=>$langs->trans('Hours'),
'i'=>$langs->trans('Minutes')
);
// Removed undesired duration types
if (is_array($excludtypes)) {
foreach($excludtypes as $value) {
unset($TDurationTypes[$value]);
}
foreach ($excludetypes as $value) {
unset($TDurationTypes[$value]);
}
$retstring = '<select class="flat" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
foreach ($TDurationTypes as $key=>$typeduration) {
foreach ($TDurationTypes as $key => $typeduration) {
$retstring .= '<option value="'.$key.'"';
if ($key == $selected) {
$retstring .= " selected";