/** * @see FormElement::renderInput() * * @param array $params * @return string */ public function renderInput($params = null) { parent::renderInput($params); if ($this->options === null || empty($this->options)) { return ''; } $columnWidth = floor(100 / $this->columnsCount); $renderedString = '<ul class="ow_checkbox_group clearfix">'; $noValue = true; foreach ($this->options as $key => $value) { if ($this->value !== null && is_array($this->value) && in_array($key, $this->value)) { $this->addAttribute(FormElement::ATTR_CHECKED, 'checked'); $noValue = false; } $this->setId(UTIL_HtmlTag::generateAutoId('input')); $this->addAttribute('value', $key); $renderedString .= '<li style="width:' . $columnWidth . '%">' . UTIL_HtmlTag::generateTag('input', $this->attributes) . ' <label for="' . $this->getId() . '">' . $value . '</label></li>'; $this->removeAttribute(FormElement::ATTR_CHECKED); } $language = OW::getLanguage(); $attributes = $this->attributes; $attributes['id'] = $this->getName() . '_unimportant'; $attributes['name'] = $this->getName() . '_unimportant'; if ($noValue) { $attributes[FormElement::ATTR_CHECKED] = 'checked'; } $renderedString .= '<li class="matchmaking_unimportant_checkbox" style="display:block;border-top: 1px solid #bbb; margin-top: 12px;padding-top:6px; width:100%">' . UTIL_HtmlTag::generateTag('input', $attributes) . ' <label for="' . $this->getId() . '">' . $language->text('matchmaking', 'this_is_unimportant') . '</label></li>'; return $renderedString . '</ul>'; }
public static function getSettingList() { $language = OW::getLanguage(); $pluginManager = OW::getPluginManager(); return array('banners' => array('presentation' => self::PRESENTATION_CUSTOM, 'label' => $language->text('skadate', 'banners_label'), 'render' => function ($uniqName, $name, $value) { OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('skadate')->getStaticJsUrl() . 'mobile_experience.js'); OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';window.SKADATE_ME_SETTINGS({$params});', array('params' => array('iosActive' => OW::getPluginManager()->isPluginActive(SKADATE_CMP_MobileExperience::IOS), 'androidActive' => OW::getPluginManager()->isPluginActive(SKADATE_CMP_MobileExperience::ANDROID))))); $input = new CheckboxGroup('banners'); $input->setOptions(array(SKADATE_CMP_MobileExperience::IOS => OW::getLanguage()->text('skadate', 'ios_label'), SKADATE_CMP_MobileExperience::ANDROID => OW::getLanguage()->text('skadate', 'android_label'))); $input->setColumnCount(2); $input->setValue(!empty($value) ? array_keys($value) : null); return $input->renderInput(); }, 'value' => array(self::IOS => $pluginManager->isPluginActive(self::IOS), self::ANDROID => $pluginManager->isPluginActive(self::ANDROID))), 'show_first' => array('presentation' => self::PRESENTATION_CUSTOM, 'label' => $language->text('skadate', 'show_first_label'), 'render' => function ($uniqName, $name, $value) { $input = new RadioField('show_first[]'); $input->setOptions(array(SKADATE_CMP_MobileExperience::IOS => OW::getLanguage()->text('skadate', 'ios_label'), SKADATE_CMP_MobileExperience::ANDROID => OW::getLanguage()->text('skadate', 'android_label'))); $input->setValue($value); $input->setColumnCount(2); return $input->renderInput(); }, 'value' => $pluginManager->isPluginActive(self::IOS) ? self::IOS : self::ANDROID)); }