/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Outputbaseline::find(); $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, 'id_base_line' => $this->id_base_line, 'date_created' => $this->date_created, 'id_user_created' => $this->id_user_created, 'date_updated' => $this->date_updated, 'id_user_updated' => $this->id_user_updated, 'approved' => $this->approved, 'date_approved' => $this->date_approved]); $query->andFilterWhere(['like', 'nama_tabel', $this->nama_tabel])->andFilterWhere(['like', 'nama_kolom_array', $this->nama_kolom_array])->andFilterWhere(['like', 'nama_kolom_json', $this->nama_kolom_json])->andFilterWhere(['like', 'nama_class', $this->nama_class]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use kemdikbud\to\models\Baseline; use kemdikbud\to\models\Outputbaseline; use wbraganca\dynamicform\DynamicFormWidget; /* @var $this yii\web\View */ /* @var $model kemdikbud\to\models\Outputbaseline */ /* @var $form yii\widgets\ActiveForm */ /* Script condition untuk Dropdown * Form output hanya 1 untuk tiap target * Ketika format form sudah dibuat maka tidak bisa dibuat form lagi */ $arraybaseline = Outputbaseline::find()->select('id_base_line')->indexBy('id_base_line')->column(); $arraybaselinesudahselesai = []; foreach ($arraybaseline as $key => $value) { $arraybaselinesudahselesai[':' . $key] = $value; } $stringcondition = ''; $urutan_index = 0; foreach ($arraybaselinesudahselesai as $key => $value) { $urutan_index++; if ($urutan_index !== count($arraybaselinesudahselesai)) { $stringcondition .= 'id != ' . $key . ' and '; } else { $stringcondition .= 'id != ' . $key; } } /* Script condition untuk Dropdown
<?php use yii\helpers\Html; use yii\grid\GridView; $this->title = $data->kode . ' - ' . $data->uraian; $this->params['breadcrumbs'][] = 'Output'; $this->params['breadcrumbs'][] = $this->title; /* Script untuk count output target */ $arraybaselinesudahselesai = \kemdikbud\to\models\Outputbaseline::findone(['id_base_line' => $data->id]); if ($arraybaselinesudahselesai['nama_class']) { $class_name = '\\kemdikbud\\to\\models\\' . ucfirst($arraybaselinesudahselesai['nama_class']); $count = $class_name::find()->count(); } else { $count = '-'; } /* Script untuk count output target */ ?> <div class="col-sm-12 col-md-12"> <div class="panel-footer"> <div class="row"> <div class="col-md-1"> <center> <small>Kode</small><br> <b><?php echo $data->kode; ?> </b> </center> </div> <div class="col-md-9">
/** * Finds the Outputbaseline model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Outputbaseline the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Outputbaseline::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }