d1f8bd40
Alexey Boroda
first commit
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<?php
namespace backend\widgets\GridView\gridColumns;
use yii\helpers\{
ArrayHelper, Html, Json
};
/**
* Class CheckboxColumn
*
* @package backend\widgets\GridView\gridColumns
* @author FilamentV <vortex.filament@gmail.com>
* @copyright (c), Thread
*/
class CheckboxColumn extends \yii\grid\CheckboxColumn
{
public $name = 'input';
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
if ($this->checkboxOptions instanceof \Closure) {
$options = call_user_func($this->checkboxOptions, $model, $key, $index, $this);
} else {
$options = $this->checkboxOptions;
}
if (!isset($options['value'])) {
$options['value'] = is_array($key) ? Json::encode($key) : $key;
}
$checkbox = Html::beginTag('div', ['class' => 'icheckbox_square-green', 'style' => ['position' => 'relative']]);
$checkbox .= Html::checkbox($this->name, !empty($options['checked']),
ArrayHelper::merge(['class' => 'i-checks', 'style' => ['position' => 'absolute', 'opacity' => 0]],
$options));
$checkbox .= Html::tag('ins', '', [
'class' => 'iCheck-helper',
'style' => [
'position' => 'absolute',
'top' => '0%',
'left' => '0%',
'display' => 'block',
'width' => '100%',
'height' => '100%',
'margin' => '0px',
'padding' => '0px',
'border' => '0px',
'opacity' => 0,
'background' => 'rgb(255, 255, 255)'
]
]);
$checkbox .= Html::endTag('div');
return $checkbox;
}
}
|