/** * PilotprojectSearch searchEmp * @author ptrnov <*****@*****.**> * @since 1.1 */ public function searchEmp($params) { /*COMPONENT USER OPTION */ $profile = Yii::$app->getUserOpt->Profile_user(); //$query = Pilotproject::find()->Where('sc0001.STATUS<>3 AND CREATED_BY='. Yii::$app->user->identity->id .' AND DEP_ID="'.$this->gtDeptid() .'"'); //$query = Pilotproject::find()->Where('sc0001.STATUS<>3 AND CREATED_BY='. Yii::$app->user->identity->id .' AND DEP_ID="'.$this->getOptUser()->emp->DEP_ID .'"'); //$query = Pilotproject::find()->Where('sc0001.STATUS<>3 AND CREATED_BY='. Yii::$app->user->identity->id .' AND DEP_ID="'.Yii::$app->getUserOpt->Profile_user()->emp->DEP_ID .'"'); $query = Pilotproject::find()->andWhere('sc0001.STATUS<>3 AND DEP_ID="' . $profile->emp->DEP_ID . '" AND CREATED_BY=' . Yii::$app->user->identity->id)->orWhere('DESTINATION_TO=' . $profile->id); $dataProvider = new ActiveDataProvider(['query' => $query]); $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; } $query->andFilterWhere(['ID' => $this->ID, 'PARENT' => $this->PARENT, 'SORT' => $this->SORT, 'PILOT_ID' => $this->PILOT_ID, 'PILOT_NM' => $this->PILOT_NM, 'DSCRP' => $this->DSCRP, 'PLAN_DATE1' => $this->PLAN_DATE1, 'PLAN_DATE2' => $this->PLAN_DATE2, 'ACTUAL_DATE1' => $this->ACTUAL_DATE1, 'ACTUAL_DATE2' => $this->ACTUAL_DATE2, 'DESTINATION_TO' => $this->DESTINATION_TO, 'BOBOT' => $this->BOBOT, 'STATUS' => $this->STATUS]); $query->andFilterWhere(['like', 'PILOT_NM', $this->PILOT_NM])->andFilterWhere(['like', 'CORP_ID', $this->CORP_ID])->andFilterWhere(['like', 'DEP_ID', $this->DEP_ID]); $query->orderby(['SORT' => SORT_ASC]); //SORT PENTING UNTUK RECURSIVE BIAR TREE BISA URUTAN, save => (IF (PATENT =0) {SORT=ID}, ELSE {SORT=PATENT}, note Parent=ID header return $dataProvider; }
var chart = new FusionCharts({ type: "gantt", renderAt: "chart-container", width: "100%", height: "600", dataFormat: "json", dataSource: myData }) .render(); }); ', $this::POS_READY); /* AUTHOR -ptr.nov- GRIDVIEW PILOT*/ $gv_pilot = GridView::widget(['id' => 'gv-pilot', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Header', 'attribute' => 'SORT', 'value' => function ($model, $key, $index, $widget) { $Proj_sort = Pilotproject::find()->where(['ID' => $model->SORT])->one(); return $Proj_sort->PILOT_NM; }, 'filter' => ArrayHelper::map(Pilotproject::find()->where('ID=SORT')->asArray()->all(), 'ID', 'PILOT_NM'), 'group' => true], ['label' => 'Sechedule', 'attribute' => 'PILOT_NM'], ['attribute' => 'PLAN_DATE1', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'PLAN_DATE2', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'BOBOT', 'format' => 'Html', 'value' => function ($model, $key, $index, $widget) { return StarRating::widget(['name' => 'rating_1']); }], ['attribute' => 'ACTUAL_DATE1', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'ACTUAL_DATE2', 'filterType' => GridView::FILTER_DATE], ['label' => 'Discription', 'attribute' => 'DSCRP', 'mergeHeader' => true, 'value' => function ($model, $key, $index, $widget) { if ($model->DSCRP != '') { return substr($model->DSCRP, 0, 30) . ' ...'; //Author -ptr.nov- limit disply text } else { return ''; } }], ['label' => 'Status', 'attribute' => 'STATUS', 'format' => 'html', 'hAlign' => 'center', 'value' => function ($model) { if ($model->STATUS == 0) { return Html::a('<i class="fa fa-edit"></i> Open', '', ['class' => 'btn btn-success btn-sm', 'title' => 'Open']); } else { if ($model->STATUS == 1) { return Html::a('<i class="fa fa-close"></i> Close', '', ['class' => 'btn btn-danger btn-sm', 'title' => 'Closing']); }
return Html::a('<button type="button" class="btn btn-success btn-xs" style="width:50px">Create</button>', ['/widget/pilotproject/create'], ['data-toggle' => "modal", 'data-target' => "#gv-pilotp-create", 'data-title' => $model->PILOT_ID]); }]]], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'gv-pilot']], 'toolbar' => [['content' => Html::button('<i class="glyphicon glyphicon-plus"></i>', ['type' => 'button', '', 'class' => 'btn btn-success', 'onclick' => 'alert("This will launch the book creation form.\\n\\nDisabled for this demo!");']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['grid-demo'], ['data-pjax' => 0, 'class' => 'btn btn-default', ''])], '{export}', '{toggleData}'], 'panel' => ['type' => 'info', 'heading' => 'Pilot Project'], 'hover' => true, 'responsive' => true, 'bordered' => true, 'striped' => true, 'autoXlFormat' => true, 'export' => ['fontAwesome' => true, 'showConfirmAlert' => false]]); /** * GridView CRUD Pilot Project Employe ActiveRecord Data * * @author ptrnov <*****@*****.**> * @since 1.1 * id_user=1 [user id login] * pilih=1 [0=department;1=user aktif] * @link https://github.com/C12D/advanced/blob/master/lukisongroup/view/widget/pilotp/index.php * @see https://github.com/C12D/advanced/blob/master/lukisongroup/view/widget/pilotp/index.php */ $gv_pilotEmp = GridView::widget(['id' => 'gv-pilot-emp', 'dataProvider' => $dataProviderEmp, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Header', 'attribute' => 'SORT', 'value' => function ($model, $key, $index, $widget) { $Proj_sort = Pilotproject::find()->where(['ID' => $model->SORT])->one(); return $Proj_sort->PILOT_NM; }, 'filter' => ArrayHelper::map(Pilotproject::find()->where('ID=SORT')->asArray()->all(), 'ID', 'PILOT_NM'), 'group' => true], ['label' => 'Sechedule', 'attribute' => 'PILOT_NM'], ['attribute' => 'PLAN_DATE1', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'PLAN_DATE2', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'ACTUAL_DATE1', 'filterType' => GridView::FILTER_DATE], ['attribute' => 'ACTUAL_DATE2', 'filterType' => GridView::FILTER_DATE], ['label' => 'Discription', 'attribute' => 'DSCRP', 'mergeHeader' => true, 'value' => function ($model, $key, $index, $widget) { if ($model->DSCRP != '') { return substr($model->DSCRP, 0, 30) . ' ...'; //Author -ptr.nov- limit disply text } else { return ''; } }], ['label' => 'Status', 'attribute' => 'STATUS', 'format' => 'html', 'hAlign' => 'center', 'value' => function ($model) { if ($model->STATUS == 0) { return Html::a('<i class="fa fa-edit"></i> Open', '', ['class' => 'btn btn-success btn-sm', 'title' => 'Open']); } else { if ($model->STATUS == 1) { return Html::a('<i class="fa fa-close"></i> Close', '', ['class' => 'btn btn-danger btn-sm', 'title' => 'Closing']); } } }, 'filter' => ['0' => 'Open', '1' => 'Close']], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Action']], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'gv-pilot']], 'toolbar' => [['content' => Html::button('<i class="glyphicon glyphicon-plus"></i>', ['type' => 'button', '', 'class' => 'btn btn-success', 'onclick' => 'alert("This will launch the book creation form.\\n\\nDisabled for this demo!");']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['grid-demo'], ['data-pjax' => 0, 'class' => 'btn btn-default', ''])], '{export}', '{toggleData}'], 'panel' => ['type' => 'info', 'heading' => 'Pilot Project'], 'hover' => true, 'responsive' => true, 'bordered' => true, 'striped' => true, 'autoXlFormat' => true, 'export' => ['fontAwesome' => true, 'showConfirmAlert' => false]]);
/** * Finds the Pilotproject model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Pilotproject the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($ID, $PILOT_ID) { if (($model = Pilotproject::findOne(['ID' => $ID, 'PILOT_ID' => $PILOT_ID])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }