/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Formlaporan::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_output' => $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_class', $this->nama_class])->andFilterWhere(['like', 'nama_kolom_array', $this->nama_kolom_array])->andFilterWhere(['like', 'nama_kolom_json', $this->nama_kolom_json]);
     return $dataProvider;
 }
 /**
  * Finds the Formlaporan model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Formlaporan the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Formlaporan::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function actionHapusform($id)
 {
     $form = Formlaporan::findOne(['id_output' => $id]);
     /* Delete model file */
     unlink(Yii::getAlias('@vendor/kemdikbud/yii2-target-output/models/') . $form->nama_class . '.php');
     /* Delete model file */
     /* Delete table */
     $string = 'DROP TABLE ' . $form->nama_tabel;
     Yii::$app->db->createCommand($string)->execute();
     /* Delete table */
     Formlaporan::deleteAll('id_output = ' . $id);
     return $this->redirect(['view', 'id' => $id]);
 }
Example #4
0
<?php

use yii\helpers\Html;
use kemdikbud\to\models\Formlaporan;
/* Script untuk count output target */
$arraybaselinesudahselesai = \kemdikbud\to\models\Formlaporan::findone(['id_output' => $model->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 */
/* Script condition untuk status target
 * Merah = Belum ada form | abu-abu = dalam proses | Biru proses complite
 */
if ($count === '-') {
    $class_sintax = 'danger';
    $class_dropdown = '#F2DEDE';
} elseif ($count >= 0 and $count < $model->vol) {
    $class_sintax = 'default';
    $class_dropdown = '#eee';
} elseif ($count >= $model->vol) {
    $class_sintax = 'primary';
    $class_dropdown = '#337ab7';
}
/* Script condition untuk status target
 * Merah = Belum ada form | abu-abu = dalam proses | Biru proses complite
 */
?>