コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = DraftPlan::find()->where('STATUS<>3')->orderBy(['GEO_ID' => SORT_DESC, 'GEO_SUB' => SORT_DESC, 'ODD_EVEN' => SORT_DESC, 'DAY_ID' => SORT_DESC]);
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => false]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['ID' => $this->ID, 'GEO_ID' => $this->GeoNm, 'LAYER_ID' => $this->LayerNm, 'DAY_ID' => $this->DAY_ID, 'DAY_VALUE' => $this->DayNm, 'STATUS' => $this->STATUS, 'YEAR' => $this->YEAR, 'ODD_EVEN' => $this->GanjilGenap, 'CREATED_AT' => $this->CREATED_AT, 'UPDATED_AT' => $this->UPDATED_AT, 'CUST_KD' => $this->CUST_KD]);
     $query->andFilterWhere(['like', 'CUST_KD', $this->CustNm])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]);
     return $dataProvider;
 }
コード例 #2
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,
コード例 #3
0
 /**
  * Finds the DraftPlan model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return DraftPlan the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = DraftPlan::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }