|
@ -66,9 +66,6 @@ class Icheck extends InputWidget { |
|
|
if ($this->hasModel() && !isset($options['name'])) { |
|
|
if ($this->hasModel() && !isset($options['name'])) { |
|
|
$this->name = $this->options['name'] = Html::getInputName($this->model, $this->attribute); |
|
|
$this->name = $this->options['name'] = Html::getInputName($this->model, $this->attribute); |
|
|
} |
|
|
} |
|
|
if (count($this->items) > 1) { |
|
|
|
|
|
$this->name .="[]"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -84,7 +81,10 @@ class Icheck extends InputWidget { |
|
|
*/ |
|
|
*/ |
|
|
protected function registerJs() { |
|
|
protected function registerJs() { |
|
|
$js = <<<SCRIPT |
|
|
$js = <<<SCRIPT |
|
|
$("input[name='{$this->name}']").iCheck(); |
|
|
|
|
|
|
|
|
$("input[name='{$this->name}']").iCheck({ |
|
|
|
|
|
checkboxClass: 'icheckbox_flat-blue', |
|
|
|
|
|
radioClass: 'iradio_flat-blue', |
|
|
|
|
|
}); |
|
|
SCRIPT; |
|
|
SCRIPT; |
|
|
$this->getView()->registerJs($js); |
|
|
$this->getView()->registerJs($js); |
|
|
} |
|
|
} |
|
@ -92,9 +92,11 @@ SCRIPT; |
|
|
protected function renderCheckBox() { |
|
|
protected function renderCheckBox() { |
|
|
$line = []; |
|
|
$line = []; |
|
|
foreach ($this->items as $key => $val) { |
|
|
foreach ($this->items as $key => $val) { |
|
|
$line[] = Html::tag('input', $key, ["type" => "radio", "name" => $this->name]); |
|
|
|
|
|
|
|
|
$input = Html::tag('input', $key, ["type" => "radio", "name" => $this->name]); |
|
|
|
|
|
$line[] = Html::tag('label', $input ." ". $val); |
|
|
} |
|
|
} |
|
|
return implode("\n", $line); |
|
|
|
|
|
|
|
|
$content = implode("\n", $line); |
|
|
|
|
|
return Html::tag('div', $content); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |