static function showYesNo($name, $value = 0, $restrict_to = -1, $params = array())
{
if (!array_key_exists('use_checkbox', $params)) {
// TODO: switch to true when Html::showCheckbox() is validated
$params['use_checkbox'] = false;
}
if ($params['use_checkbox']) {
if (!empty($params['rand'])) {
$rand = $params['rand'];
} else {
$rand = mt_rand();
}
$options = array('name' => $name, 'id' => Html::cleanId("dropdown_" . $name . $rand));
switch ($restrict_to) {
case 0:
$options['checked'] = false;
$options['readonly'] = true;
break;
case 1:
$options['checked'] = true;
$options['readonly'] = true;
break;
default:
$options['checked'] = $value ? 1 : 0;
$options['readonly'] = false;
break;
}
Html::showCheckbox($options);
return $rand;
}
if ($restrict_to != 0) {
$options[0] = __('No');
}
if ($restrict_to != 1) {
$options[1] = __('Yes');
}
$params['value'] = $value;
$params['width'] = "65px";
return self::showFromArray($name, $options, $params);
}