public function search($params) { /*[5.1] JOIN TABLE */ $query = Modulset::find(); $dataProvider_hrd = new ActiveDataProvider(['query' => $query]); /*[5.3] LOAD VALIDATION PARAMS */ /*LOAD FARM VER 1*/ $this->load($params); if (!$this->validate()) { return $dataProvider_hrd; } /*[5.4] FILTER WHERE LIKE (string/integer)*/ /* FILTER COLUMN Author -ptr.nov-*/ $query->andFilterWhere(['like', 'MDL_ID', $this->MDL_ID])->andFilterWhere(['like', 'MDL_NM', $this->MDL_NM]); return $dataProvider_hrd; }
/** * CLASS TABLE FIND PrimaryKey * Example: Employe::find() */ protected function findModel($id) { if (($model = Modulset::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php use yii\helpers\Html; use app\models\hrd\Modulset; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\builder\FormGrid; use kartik\widgets\FileInput; use yii\helpers\ArrayHelper; $this->mddPage = 'hrd'; $form = ActiveForm::begin(['type' => ActiveForm::TYPE_VERTICAL]); $nlDigit = Modulset::find()->count() + 1; $nl = 'LG' . $nlDigit; ?> <?php echo FormGrid::widget(['model' => $model, 'form' => $form, 'autoGenerateColumns' => true, 'rows' => [['contentBefore' => '<legend class="text-info"><small>DEPARTMENT IDENTITY</small></legend>', 'columns' => 1, 'autoGenerateColumns' => false, 'attributes' => ['employe_identity' => ['label' => 'Dept.ID', 'columns' => 5, 'attributes' => ['DEP_ID' => ['type' => Form::INPUT_TEXT, 'Form::SIZE_LARGE', 'options' => [], 'columnOptions' => ['colspan' => 3]], 'DEP_NM' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Department Name...'], 'columnOptions' => ['colspan' => 4]], 'DEP_DCRP' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Department Description ...'], 'columnOptions' => ['colspan' => 4]], 'SORT' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'SORT...'], 'columnOptions' => ['colspan' => 4]]]]]], ['attributes' => ['actions' => ['type' => Form::INPUT_RAW, 'value' => '<div style="text-align: right; margin-top: 20px">' . Html::resetButton('Reset', ['class' => 'btn btn-default']) . ' ' . Html::submitButton('Submit', ['class' => 'btn btn-primary']) . '</div>']]]]]); ActiveForm::end();