public function actionInsertoutput($id)
 {
     $datawiki = Outputbaseline::findOne(['id_base_line' => $id]);
     $data = Baseline::findOne(['id' => $id]);
     $class_name = '\\kemdikbud\\to\\models\\' . ucfirst(str_replace(['_'], [''], $datawiki->nama_tabel));
     $model = new $class_name();
     $dataProvider = new ActiveDataProvider(['query' => $class_name::find(), 'pagination' => ['pageSize' => 10]]);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['viewoutput', 'id' => $id, 'dataProvider' => $dataProvider, 'data' => $data]);
     } else {
         return $this->render('_insertoutput', ['datawiki' => $datawiki, 'model' => $model]);
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Baseline::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, 'jenis' => $this->jenis, 'wilayah' => $this->wilayah, 'kode' => $this->kode, 'volume' => $this->volume, 'harga_satuan' => $this->harga_satuan, 'harga_total' => $this->harga_total, 'tahun' => $this->tahun]);
     $query->andFilterWhere(['like', 'uraian', $this->uraian])->andFilterWhere(['like', 'satuan', $this->satuan]);
     return $dataProvider;
 }
Beispiel #3
0
    }
}
/* Script condition untuk Dropdown
 * Form output hanya 1 untuk tiap target
 * Ketika format form sudah dibuat maka tidak bisa dibuat form lagi
 */
?>
<script src="jquery-latest.min.js" type="text/javascript"></script>
<div class="outputbaseline-form">

    <?php 
$form = ActiveForm::begin(['id' => 'dynamic-form']);
?>

    <?php 
echo $form->field($model, 'id_base_line')->dropDownList(ArrayHelper::map(Baseline::find()->where($stringcondition, $arraybaselinesudahselesai)->all(), 'id', 'uraian'));
?>

    <!-- Data global Form -->

    <?php 
DynamicFormWidget::begin(['widgetContainer' => 'dynamicform_wrapper_template', 'widgetBody' => '.container-items-template', 'widgetItem' => '.item-template', 'limit' => 20, 'min' => 0, 'insertButton' => '.add-item-template', 'deleteButton' => '.remove-item-template', 'model' => $template[0], 'formId' => 'dynamic-form', 'formFields' => ['id']]);
?>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h4>
                <i class="glyphicon glyphicon-user"></i> Format tabel
                <button type="button" class="add-item-template btn btn-primary btn-sm pull-right"><i class="glyphicon glyphicon-plus"></i> Add</button>
            </h4>
        </div>
 /**
  * Finds the Baseline model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Baseline the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Baseline::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }