生成checkbox
@param mixed $data
@param mixed $value
@param string $checked
@param string $extra
@return string
514904
public static function form_checkbox($data = '', $value = '', $checked = false, $extra = '')
    {
        $defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);

        if (is_array($data) && array_key_exists('checked', $data)) {
            $checked = $data['checked'];

            if ($checked == false) {
                unset($data['checked']);
            } else {
                $data['checked'] = 'checked';
            }
        }

        if ($checked == true) {
            $defaults['checked'] = 'checked';
        } else {
            unset($defaults['checked']);
        }

        return "<input ".self::_parse_form_attributes($data, $defaults).$extra." />\n";
    }
278804
public function createFilterRowCheckbox($inputField = null, $value = null) {
		$result = '';
		if (is_array($inputField)) {
			$inputField = array_keys($inputField);
			$inputField = (string)array_shift($inputField);
		}
		if (empty($inputField) || (strpos($inputField, '.') === false)) {
			return $result;
		}

		$uniqid = uniqid();
		$dataPath = 'FilterData.0.' . $inputField;
		$inputFieldName = $dataPath . '.';
		$data = (array)$this->request->data($dataPath);
		$options = [
			'value' => $value,
			'checked ' => in_array($value, $data),
			'hiddenField' => false,
			'required' => false,
			'secure' => false,
		];
		$this->setEntity($inputFieldName . $uniqid);
		$options = $this->domId($options);
		$options = $this->_initInputField($inputFieldName, $options);
		$result = $this->ExtBs3Form->checkbox($inputFieldName, $options) .
			$this->ExtBs3Form->label($inputFieldName . $uniqid, '');
		$result = $this->Html->div('checkbox', $result);

		return $result;
	}
48840
protected function get_checkbox_checked_state( $name, $value, $checked ) {
		$request = $this->request( $name );

		if ( ! $request && null !== $this->session && ! $this->old_input_is_empty() && is_null( $this->old( $name ) ) ) {
			return false;
		}

		if ( $this->missing_old_and_model( $name ) && is_null( $request ) ) {
			return $checked;
		}

		$posted = $this->get_value_attribute( $name, $checked );

		if ( is_array( $posted ) ) {
			return in_array( $value, $posted );
		}

		if ( $posted instanceof Collection ) {
			return $posted->contains( 'id', $value );
		}

		return (bool) $posted;
	}
202405
public static function checkbox($field, $value = null, $checked = null, array $attributes = array())
	{
		return static::$instance->checkbox($field, $value, $checked, $attributes);
	}
696326
public static function checkBox($name, $checked = false, $htmlOptions = array())
    {
        $label = TbArray::popValue('label', $htmlOptions, false);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
        self::addCssClass('checkbox', $labelOptions);
        $input = parent::checkBox($name, $checked, $htmlOptions);
        return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
    }
714215
public function dbg($var, $continue = 0, $element = "pre", $extra = "") {
	  echo "<" . $element . ">";
	  echo "Vartype: " . gettype($var) . "\n";
	  if ( is_array($var) ) echo "Elements: " . count($var) . "\n";
	  elseif ( is_string($var) ) echo "Length: " . strlen($var) . "\n";
	  if ($extra) {
	  	echo $extra . "\n";
	  }
	  echo "\n";
	  print_r($var);
	  echo "</" . $element . ">";
		if (!$continue) exit();
	}
1002217
private function composeElement($key, $attributes, $extra = [], $hasCloseTag = false)
    {
        $value = (isset($extra['value'])) ? $extra['value'] : $key;
        $type = (isset($extra['type'])) ? $extra['type'] : $key;
        list($elClass, $attributes) = $this->highlightErrorElement($key, $attributes);

        $val = '';
        if ($hasCloseTag) {
            if (is_object($this->entity)) {
                if (method_exists($this->entity, 'get'.Inflector::camelize($key))) {
                    $val = $this->entity->{'get'.Inflector::camelize($key)}();
                } elseif (property_exists($this->entity, $key)) {
                    $property = (new \ReflectionClass($this->entity))->getProperty($key);
                    if ($property->isPublic()) {
                        $val = $property->getValue();
                    }
                } else {
                    $val = $this->entity->{$key};
                }
            }

            $val = (!isset($attributes['value'])) ? (!empty($val)) ? 'value="'.$val.'"' : ''  : '';

            $this->elements[static::$formHolder[static::$formName]][$key] =
                "<$type name='".$key."' $val ".$this->attributes($attributes). ' '.$elClass.' />'.PHP_EOL;

            return $this;
        }

        $this->elements[static::$formHolder[static::$formName]][$key] =
            "<$type for='".$key."' ".$this->attributes($attributes). ' '.$elClass.' >'.$value."</$type>".PHP_EOL;


        return $this;
    }
110741
public function toggleCheckboxes($id, $value = null, array $params = array())
    {

        $js = sprintf('%1$s("#%2$s").click(function(){
            var checkboxes = %1$s("%3$s");
            checkboxes.prop("checked", !checkboxes.prop("checked"));
});',
                \ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(),
                $id,
                $params['selector']
        );
        unset($params['selector']);

        $this->jquery->addOnLoad($js);

        //Now do something to add the jquery stuff
        return $this->view->formButton($id, $value, $params);
    }
1189371
protected function createInput($type, $name, $value = null, $extra = null)
    {
        $html = '<input type="' . $type . '" name="' . $name . '"';
        if ($value !== null)
        {
            $html .= ' value="' . $value . '"';
        }
        if ($extra !== null)
        {
            $html .= ' ' . $extra;
        }
        $html .= '>';
        return $html;
    }
546626
function val(value) {
  var first = this.get(0);

  function getValue(el) {
    var nm = el.tagName.toLowerCase()
      , type = el.getAttribute('type');
    if(nm === SELECT) {
      return getSelectValues(el).join(
        el.getAttribute('data-delimiter') || ',');
    }else if(type === CHECKBOX) {
      return Boolean(el.checked);
    }
    return el.value;
  }

  function setValue(el, value) {
    var nm = el.tagName.toLowerCase()
      , type = el.getAttribute('type');
    if(nm === TEXTAREA) {
      while(el.childNodes.length) {
        el.removeChild(el.childNodes[0])
      }
      el.appendChild(document.createTextNode(value));
    }else if(nm === SELECT) {
      setSelectValues(el, value);
    }else if(type === RADIO) {
      el.setAttribute('checked', '');
    }else if(type === CHECKBOX && Boolean(value)) {
      el.checked = true;
    }else{
      el.value = value;
    }
  }

  if(value === undefined && first) {
    return getValue(first);
  }else if(value) {
    this.each(function(el) {
      setValue(el, value);
    })
  }
  return this;
}
936414
public static function checkboxSmart($name, $checked = false, $options = [])
    {
        $options['checked'] = (boolean)$checked;
        $value = array_key_exists('value', $options) ? $options['value'] : '1';
        if (isset($options['uncheck'])) {
            // add a hidden field so that if the checkbox is not selected, it still submits a value
            $hidden = static::hiddenInput($name, $options['uncheck']);
            unset($options['uncheck']);
        } else {
            $hidden = '';
        }
        if (isset($options['label'])) {
            $label = $options['label'];
            $labelOptions = isset($options['labelOptions']) ? $options['labelOptions'] : [];
            unset($options['label'], $options['labelOptions']);
            $iconOptions = ArrayHelper::remove($options, 'iconOptions', []);
            $iconTag = ArrayHelper::remove($iconOptions, 'tag', 'i');
            $content = static::label(static::input('checkbox', $name, $value, $options) . Html::tag($iconTag, null, $iconOptions) . $label, null, $labelOptions);
            return $hidden . $content;
        } else {
            return $hidden . static::input('checkbox', $name, $value, $options);
        }
    }
320437
public function url($name, $value = null, array $attributes = array(), array $extra = array())
    {
        return $this->build('url', $name, $value, $attributes, $extra);
    }
40188
function(value, element) {
           var html = [],
               checked = $.fn.editableutils.itemsByValue(value, this.sourceData);
               
           if(checked.length) {
               $.each(checked, function(i, v) { html.push($.fn.editableutils.escape(v.text)); });
               $(element).html(html.join('<br>'));
           } else {
               $(element).empty(); 
           }
        }
1264587
public function checkbox($name, $value = 1, $label = null, $checked = null, $options = array())
    {
        if ($this->hasErrors($name)) {
            $options = $this->appendClassToOptions('is-invalid', $options);
        }

        $checkable = parent::checkbox($name, $value, $checked, $options);

        return $this->wrapCheckable($label, 'checkbox', $checkable);
    }
1287416
private String generateValue() {

        String result = "";
        for (CmsCheckBox checkbox : m_checkboxes) {
            if (checkbox.isChecked()) {
                result += checkbox.getInternalValue() + ",";
            }
        }
        if (result.contains(",")) {
            result = result.substring(0, result.lastIndexOf(","));
        }
        return result;
    }
90652
private static function createWarningFromInvalidValue(array $extra, $key, $default, $additionalMessage = '')
    {
        $warning = sprintf(
            'Invalid value "%s" for option "%s", defaulting to "%s".',
            $extra[$key],
            $key,
            $default
        );

        if ($additionalMessage) {
            $warning .= ' ' . $additionalMessage;
        }

        return $warning;
    }
669504
public function success($msg = null, $data = null, $extraData = [])
    {
        $return = $this->output(1, $msg, $data, $extraData);

        return $this->responseJson($return);
    }