--- /dev/null
+{foreach from=$selectOptions key=key item=selectOption}
+ <label><input type="checkbox" name="values[{$option->optionName}][]" value="{$key}" {if $key|in_array:$value} checked="checked"{/if} {if $disableOptions[$key]|isset || $enableOptions[$key]|isset}class="jsEnablesOptions" data-disable-options="[ {@$disableOptions[$key]}]" data-enable-options="[ {@$enableOptions[$key]}]"{/if} /> {lang}{@$selectOption}{/lang}</label>
+{/foreach}
--- /dev/null
+<label><input type="checkbox" id="search_{$option->optionName}" name="searchOptions[{$option->optionName}]"{if $searchOption} checked="checked"{/if} /> {lang}wcf.user.option.searchRadioButtonOption{/lang}</label>
+{foreach from=$selectOptions key=key item=selectOption}
+ <label><input type="checkbox" name="values[{$option->optionName}][]" value="{$key}" {if $key|in_array:$value} checked="checked"{/if}{if !$searchOption} disabled="disabled"{/if} /> {lang}{@$selectOption}{/lang}</label>
+{/foreach}
+
+<script data-relocate="true">
+ //<![CDATA[
+ $(function() {
+ $('#search_{$option->optionName}').change(function(event) {
+ if ($(event.currentTarget).prop('checked')) {
+ $('input[name="values[{$option->optionName}][]"]').enable();
+ }
+ else {
+ $('input[name="values[{$option->optionName}][]"]').disable();
+ }
+ });
+ });
+ //]]>
+</script>
--- /dev/null
+<?php
+namespace wcf\system\option;
+
+/**
+ * Option type implementation for checkboxes.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.option
+ * @category Community Framework
+ */
+class CheckboxesOptionType extends MultiSelectOptionType {
+ /**
+ * @see \wcf\wcf\system\option\MultiSelectOptionType::$formElementTemplate
+ */
+ protected $formElementTemplate = 'checkboxesOptionType';
+
+ /**
+ * @see \wcf\wcf\system\option\MultiSelectOptionType::$formElementTemplate
+ */
+ protected $searchableFormElementTemplate = 'checkboxesSearchableOptionType';
+}
* @category Community Framework
*/
class MultiSelectOptionType extends SelectOptionType {
+ /**
+ * name of the form element template
+ * @var string
+ */
+ protected $formElementTemplate = 'multiSelectOptionType';
+
+ /**
+ * name of the searchable form element template
+ * @var string
+ */
+ protected $searchableFormElementTemplate = 'multiSelectSearchableOptionType';
+
/**
* @see \wcf\system\option\IOptionType::getFormElement()
*/
'selectOptions' => $this->getSelectOptions($option),
'value' => (!is_array($value) ? explode("\n", $value) : $value)
));
- return WCF::getTPL()->fetch('multiSelectOptionType');
+ return WCF::getTPL()->fetch($this->formElementTemplate);
}
/**
'selectOptions' => $this->getSelectOptions($option),
'value' => (!is_array($value) ? explode("\n", $value) : $value)
));
- return WCF::getTPL()->fetch('multiSelectSearchableOptionType');
+ return WCF::getTPL()->fetch($this->searchableFormElementTemplate);
}
/**