'',
'afterElement' => '',
'beforeLabel' => '',
'afterLabel' => '',
);
function HTML_QuickForm_multi_checkbox($elementName = null, $elementLabel = null, $options = null, $attributes = null)
{
return HTML_QuickForm_select::HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes);
}
function setDisabledValues($values)
{
$this->_disabledValues = $values;
}
function setSeparator($separator)
{
$this->_separator = $separator;
}
function setMultiSeparators($multiSeparators)
{
$this->_multiSeparators = $multiSeparators;
}
function setMultiSeparatorsCallback(array $callback)
{
if (is_callable($callback)) {
$this->_multiSeparatorCallback = $callback;
} else {
throw new Exception('Invalid callback');
}
}
function getMultiple()
{
return true;
}
function toHtml()
{
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
$tabs = $this->_getTabs();
$strHtml = '';
if ($this->getComment() != '') {
$strHtml .= $tabs . '\n";
}
$myName = $this->getName();
$this->setName($myName . '[]');
$strHtml .= $tabs . "\n";
foreach ($this->_options as $option) {
$option['attr'] = array_merge($option['attr'], $this->_attributes);
$labelAttribs = array();
$itemId = $myName . '-' . $option['attr']['value'];
$labelAttribs['for'] = $itemId;
if (is_array($this->_values) && in_array((string)$option['attr']['value'], $this->_values)) {
$this->_updateAttrArray(
$option['attr'],
array(
'checked' => 'checked',
)
);
}
$this->_updateAttrArray(
$option['attr'],
array(
'id' => $itemId,
'name' => $myName . '[]'
)
);
if (in_array((string)$option['attr']['value'], $this->_disabledValues)) {
$labelAttribs['class'] = 'disabled';
$this->_updateAttrArray($option['attr'], array('disabled' => 'disabled'));
}
$strHtml .= $tabs
. $this->_getMultiSeparator('beforeElement', $option['attr'], $labelAttribs)
. '_getAttrString($option['attr']) . '/>'
. $this->_getMultiSeparator('afterElement', $option['attr'], $labelAttribs)
. $this->_getMultiSeparator('beforeLabel', $option['attr'], $labelAttribs)
. '' . $this->_separator
. $this->_getMultiSeparator('afterLabel', $option['attr'], $labelAttribs)
. "\n";
}
return $strHtml . $tabs;
}
}
protected function _getMultiSeparator($name, array $inputAttribs, array $labelAttribs)
{
$html = $this->_multiSeparators[$name];
if (null !== $this->_multiSeparatorCallback) {
$html = call_user_func($this->_multiSeparatorCallback, $html, $name, $inputAttribs, $labelAttribs);
}
return $html;
}
}