예제 #1
0
$actionClass = 'btn btn-info btn-xs';
$actionLabel = 'Update';
$attDinamik = [];
/*GRIDVIEW ARRAY FIELD HEAD*/
$headColomn = [['ID' => 0, 'ATTR' => ['FIELD' => 'SCDL_GROUP', 'SIZE' => '10px', 'label' => 'GROUP CODE', 'align' => 'left', 'warna' => '73, 162, 182, 1', 'grp' => false]], ['ID' => 1, 'ATTR' => ['FIELD' => 'ganjilGenap', 'SIZE' => '20px', 'label' => 'Week', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => true]], ['ID' => 2, 'ATTR' => ['FIELD' => 'dayNm', 'SIZE' => '20px', 'label' => 'Day Name', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => true]], ['ID' => 3, 'ATTR' => ['FIELD' => 'geonm', 'SIZE' => '20px', 'label' => 'GROUP_PRN', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => true]], ['ID' => 4, 'ATTR' => ['FIELD' => 'SUB_GEO', 'SIZE' => '20px', 'label' => 'GEO_SUB', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => true]], ['ID' => 5, 'ATTR' => ['FIELD' => 'useridNm', 'SIZE' => '20px', 'label' => 'UserName', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => true]]];
$gvHeadColomnBT = ArrayHelper::map($headColomn, 'ID', 'ATTR');
$attDinamik[] = ['class' => 'kartik\\grid\\SerialColumn', 'width' => '10px', 'header' => 'No.', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(73, 162, 182, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]];
/*GRIDVIEW ARRAY ROWS*/
foreach ($gvHeadColomnBT as $key => $value[]) {
    if ($value[$key]['FIELD'] == 'geonm') {
        # code...
        $attDinamik[] = ['attribute' => $value[$key]['FIELD'], 'label' => $value[$key]['label'], 'filterType' => GridView::FILTER_SELECT2, 'filter' => $drop, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Pilih Group'], 'hAlign' => 'right', 'vAlign' => 'middle', 'noWrap' => true, 'group' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => $value[$key]['SIZE'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(' . $value[$key]['warna'] . ')']], 'contentOptions' => ['style' => ['width' => $value[$key]['SIZE'], 'text-align' => $value[$key]['align'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]];
    } elseif ($value[$key]['FIELD'] == 'ganjilGenap') {
        $attDinamik[] = ['attribute' => $value[$key]['FIELD'], 'label' => $value[$key]['label'], 'filterType' => GridView::FILTER_SELECT2, 'filter' => $pekan, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Pilih'], 'hAlign' => 'right', 'vAlign' => 'middle', 'noWrap' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => $value[$key]['SIZE'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(' . $value[$key]['warna'] . ')']], 'contentOptions' => ['style' => ['width' => $value[$key]['SIZE'], 'text-align' => $value[$key]['align'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]];
    } elseif ($value[$key]['FIELD'] == 'dayNm') {
        $attDinamik[] = ['attribute' => $value[$key]['FIELD'], 'label' => $value[$key]['label'], 'filterType' => GridView::FILTER_SELECT2, 'filter' => DraftPlan::getDay(), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Pilih'], 'hAlign' => 'right', 'vAlign' => 'middle', 'noWrap' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => $value[$key]['SIZE'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(' . $value[$key]['warna'] . ')']], 'contentOptions' => ['style' => ['width' => $value[$key]['SIZE'], 'text-align' => $value[$key]['align'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]];
    } elseif ($value[$key]['FIELD'] == 'useridNm') {
        $attDinamik[] = ['attribute' => $value[$key]['FIELD'], 'label' => $value[$key]['label'], 'filterType' => GridView::FILTER_SELECT2, 'filter' => $user, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Pilih'], 'hAlign' => 'right', 'vAlign' => 'middle', 'noWrap' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => $value[$key]['SIZE'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(' . $value[$key]['warna'] . ')']], 'contentOptions' => ['style' => ['width' => $value[$key]['SIZE'], 'text-align' => $value[$key]['align'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]];
    } else {
        # code...
        # code...
        $attDinamik[] = ['attribute' => $value[$key]['FIELD'], 'label' => $value[$key]['label'], 'filter' => true, 'hAlign' => 'right', 'vAlign' => 'middle', 'noWrap' => true, 'group' => $value[$key]['grp'], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => $value[$key]['SIZE'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(' . $value[$key]['warna'] . ')']], 'contentOptions' => ['style' => ['text-align' => $value[$key]['align'], 'width' => $value[$key]['SIZE'], 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]];
    }
}
/*GRIDVIEW ARRAY ACTION*/
/*  $attDinamik[]=[
      'class'=>'kartik\grid\ActionColumn',
      'dropdown' => true,
      'dropdownOptions'=>['class'=>'pull-left dropup','style'=>['disable'=>true]],
      'dropdownButton'=>[
        'class' => $actionClass,