Generates a check box for a model attribute.
@param CModel $model the data model.
@param string $attribute the attribute.
@param array $htmlOptions additional HTML attributes.
@return string the generated check box.
960595
public static function activeCheckBox($model, $attribute, $htmlOptions = array())
    {
        $label = TbArray::popValue('label', $htmlOptions, false);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
        $input = parent::activeCheckBox($model, $attribute, $htmlOptions);
        if (TbArray::popValue('useContainer', $htmlOptions, false)) {
            return self::tag(
                'div',
                array('class' => 'checkbox'),
                self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions)
            );
        } else {
            return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
        }
    }
981524
public static function checkbox(
        $name,
        $value,
        array $checkedValues = [],
        array $htmlOptions = []
    ) {
        $check = self::input('checkbox', $name, $value);
        if (in_array($value, $checkedValues)) {
            $check .= ' checked="checked"';
        }
        $check .= self::htmlOptions($htmlOptions) .'>';
        return $check;
    }
518555
public static function fromModel(Model $model, $attribute)
    {
        $valueAttribute = $attribute . '_confirmed';
        $levelAttribute = $attribute . '_confirm_level';
        $dateAttribute = $attribute . '_confirm_date';

        $modelValue = $model->$attribute;
        $value = isset($model->$valueAttribute) ? $model->$valueAttribute : null;
        $level = isset($model->$levelAttribute) ? $model->$levelAttribute : null;
        $date = isset($model->$dateAttribute) ? $model->$dateAttribute : null;

        $options = [
            'id' => $model->id,
            'type' => $attribute,
            'contact' => $model,
        ];

        if (isset($date)) {
            $options['date'] = $date;
        }

        // TODO: get rid of this crutch. Move into VerificationValueNormalizer or so
        if (in_array($attribute, ['voice_phone', 'fax_phone'], true) && !empty($value)) {
            $value = preg_replace('/[^0-9]/', '', $value);
            $modelValue = preg_replace('/[^0-9]/', '', $modelValue);
        }

        if (isset($level)) {
            $options['level'] = $level;
        } elseif (isset($value) && $value === $modelValue) {
            $options['level'] = static::LEVEL_CONFIRMED;
        } else {
            $options['level'] = static::LEVEL_UNCONFIRMED;
        }

        return new static($options);
    }
632857
public function generateActiveField($attribute)
    {
        $tableSchema = $this->getTableSchema();
        if ($tableSchema === false || !isset($tableSchema->columns[$attribute])) {
            if (preg_match('/^(password|pass|passwd|passcode)$/i', $attribute)) {
                return "\$form->field(\$model, '$attribute')->passwordInput()";
            }

            return "\$form->field(\$model, '$attribute')";
        }
        $column = $tableSchema->columns[$attribute];
        if ($column->phpType === 'boolean') {
            return "\$form->field(\$model, '$attribute')->checkbox()";
        }

        if ($column->type === 'text') {
            return "\$form->field(\$model, '$attribute')->textarea(['rows' => 6])";
        }

        if (preg_match('/^(password|pass|passwd|passcode)$/i', $column->name)) {
            $input = 'passwordInput';
        } else {
            $input = 'textInput';
        }

        if (is_array($column->enumValues) && count($column->enumValues) > 0) {
            $dropDownOptions = [];
            foreach ($column->enumValues as $enumValue) {
                $dropDownOptions[$enumValue] = Inflector::humanize($enumValue);
            }
            return "\$form->field(\$model, '$attribute')->dropDownList("
                . preg_replace("/\n\s*/", ' ', VarDumper::export($dropDownOptions)).", ['prompt' => ''])";
        }

        if ($column->phpType !== 'string' || $column->size === null) {
            return "\$form->field(\$model, '$attribute')->$input()";
        }

        return "\$form->field(\$model, '$attribute')->$input(['maxlength' => true])";
    }
535049
public function radioButtonListInlineRow($model, $attribute, $data = array(), $htmlOptions = array())
	{
		return $this->inputRow(CiiInput::TYPE_RADIOLIST_INLINE, $model, $attribute, $data, $htmlOptions);
	}
357166
public static function dateFormat($model, $attribute, $options = [], $pickerOptions = [])
    {
        $pickerOptions = array_merge([
            'language' => Yii::$app->language == 'en' ? 'en-US' : Yii::$app->language,
            'model' => $model,
            'attribute' => $attribute,
            'options' => ['class' => 'form-control'],
        ], $pickerOptions);
        return array_merge([
            'attribute' => $attribute,
            'format' => 'date',
            'filter' => DatePicker::widget($pickerOptions)
        ], $options);
    }
104707
public function renderNodeControll($model)
    {
        $disabled = false;
        if ($this->isAllowNodeSelectCallback && is_callable($this->isAllowNodeSelectCallback)) {
            $function = $this->isAllowNodeSelectCallback;
            if (!$function($model)) {
                $disabled = "disabled";
            }
        }

        if ($this->multiple) {
            $controllElement = Html::checkbox($this->id . '-checkbox', false, [
                'value' => $model->id,
                'class' => 'sx-checkbox',
                'disabled' => $disabled,
                'style' => 'float: left; margin-left: 5px; margin-right: 5px;',
            ]);
        } else {
            $controllElement = Html::radio($this->id . '-radio', false, [
                'value' => $model->id,
                'class' => 'sx-radio',
                'disabled' => $disabled,
                'style' => 'float: left; margin-left: 5px; margin-right: 5px;',
            ]);
        }

        return $controllElement;
    }
717398
public function generateSelectElement(array $options = array(), array $attributes = array(), $selectedValue = "", $templateToBeRendered = 'html_element_template')
    {
        $_options_html = "";

        foreach($options as $_option => $_val)
        {
            $_attributes = array("value" => $_val);

            if($_val == $selectedValue) {
                $_attributes['selected'] = "true";
            }

            $_options_html .= $this->generateElement(
                'option',
                $_attributes,
                $_val
            );
        }

        return $this->generateElement('select', $attributes, $_options_html, true, $templateToBeRendered);
    }
229011
protected function passesOptionalCheck($attribute)
    {
        if (! $this->hasRule($attribute, ['Sometimes'])) {
            return true;
        }

        $data = ValidationData::initializeAndGatherData($attribute, $this->data);

        return array_key_exists($attribute, $data)
            || array_key_exists($attribute, $this->data);
    }
362245
public static function activeTextArea($model, $attribute, $htmlOptions = array())
    {
        $htmlOptions = self::normalizeInputOptions($htmlOptions);
        return parent::activeTextArea($model, $attribute, $htmlOptions);
    }
414880
public String buildSelectView(String htmlAttributes) {

        SelectOptions optionBean = CmsStartViewPreference.getViewSelectOptions(getCms(), getParamTabWpView());
        return buildSelect(htmlAttributes, optionBean);
    }
802492
protected function createHtmlTagAttribute(array $attribute)
    {
        $attributeModel = new Shopgate_Model_Redirect_HtmlTagAttribute();
        $attributeModel->setName($attribute['name']);
        $attributeModel->setValue($attribute['value']);
        $attributeModel->setVariables($this->templateParser->getVariables($attribute['value']));

        if (!empty($attribute['deeplink_suffix'])) {
            $attributeModel->setDeeplinkSuffix($this->createDeeplinkSuffixes($attribute['deeplink_suffix']));
        }

        return $attributeModel;
    }
1154807
public function renderField(Model $model, $attribute, array $settings = [])
    {
        $fieldOptions = ArrayHelper::getValue($settings, 'fieldOptions', []);
        $field = $this->field($model, $attribute, $fieldOptions);

        if (($label = ArrayHelper::getValue($settings, 'label')) !== null) {
            $field->label($label, ArrayHelper::getValue($settings, 'labelOptions', []));
        }
        if (($hint = ArrayHelper::getValue($settings, 'hint')) !== null) {
            $field->hint($hint, ArrayHelper::getValue($settings, 'hintOptions', []));
        }

        $type = ArrayHelper::getValue($settings, 'type', static::INPUT_TEXT);
        $this->prepareField($field, $type, $settings);

        return $field;
    }
365898
protected static function createCheckBoxAndRadioButtonLabel($label, $input, $htmlOptions)
    {
        list ($hidden, $input) = self::normalizeCheckBoxAndRadio($input);
        return $hidden . ($label !== false
            ? self::tag('label', $htmlOptions, $input . ' ' . $label)
            : $input);
    }
1052676
protected function getClientOptions($model, $attribute)
    {
        $label = $model->getAttributeLabel($attribute);

        $options = [];
        if ($this->message !== null) {
            $options['message'] = Yii::$app->getI18n()->format($this->message, [
                'attribute' => $label,
            ], Yii::$app->language);
        }

        $options['skipOnEmpty'] = $this->skipOnEmpty;

        if (!$this->skipOnEmpty) {
            $options['uploadRequired'] = Yii::$app->getI18n()->format($this->uploadRequired, [
                'attribute' => $label,
            ], Yii::$app->language);
        }

        if ($this->mimeTypes !== null) {
            $options['mimeTypes'] = $this->mimeTypes;
            $options['wrongMimeType'] = Yii::$app->getI18n()->format($this->wrongMimeType, [
                'attribute' => $label,
                'mimeTypes' => implode(', ', $this->mimeTypes),
            ], Yii::$app->language);
        }

        if ($this->extensions !== null) {
            $options['extensions'] = $this->extensions;
            $options['wrongExtension'] = Yii::$app->getI18n()->format($this->wrongExtension, [
                'attribute' => $label,
                'extensions' => implode(', ', $this->extensions),
            ], Yii::$app->language);
        }

        if ($this->minSize !== null) {
            $options['minSize'] = $this->minSize;
            $options['tooSmall'] = Yii::$app->getI18n()->format($this->tooSmall, [
                'attribute' => $label,
                'limit' => $this->minSize,
                'formattedLimit' => Yii::$app->formatter->asShortSize($this->minSize),
            ], Yii::$app->language);
        }

        if ($this->maxSize !== null) {
            $options['maxSize'] = $this->maxSize;
            $options['tooBig'] = Yii::$app->getI18n()->format($this->tooBig, [
                'attribute' => $label,
                'limit' => $this->getSizeLimit(),
                'formattedLimit' => Yii::$app->formatter->asShortSize($this->getSizeLimit()),
            ], Yii::$app->language);
        }

        if ($this->maxFiles !== null) {
            $options['maxFiles'] = $this->maxFiles;
            $options['tooMany'] = Yii::$app->getI18n()->format($this->tooMany, [
                'attribute' => $label,
                'limit' => $this->maxFiles,
            ], Yii::$app->language);
        }

        return $options;
    }
582375
public function redactorRow($model, $attribute, $htmlOptions = array())
	{
		return $this->inputRow(CiiInput::TYPE_REDACTOR, $model, $attribute, null, $htmlOptions);
	}
1365203
public function validateAttribute($model, $attribute)
    {
        $this->_model = $model;
        $this->_attributeName = $attribute;
        $result = $this->validateValue($model->$attribute);
        if (!empty($result)) {
            $this->addError($model, $attribute, $result[0], $result[1]);
        }
    }