/** * Displays list of choosen audit table records * * @return string the rendering result */ public function actionIndex() { $dynamicModel = $this->createAuditForm(); $auditForm = new AuditForm(); $auditForm->addFormValidators($dynamicModel); $dataProvider = null; $arrayDiff = []; /** @var Module $module */ $module = $this->module; if ($dynamicModel->load(Yii::$app->request->get()) && $dynamicModel->validate()) { $this->setCurrentModel($dynamicModel->table); $this->hiddenColumns = array_merge($module->auditColumns, $module->tables[$dynamicModel->table]['hiddenColumns']); $dataProvider = $this->createDataProvider($dynamicModel); $arrayDiff = []; $previousModel = null; foreach ($dataProvider->getModels() as $model) { $auditId = $model['audit_id']; $model = $this->unsetHiddenColumns($model); $arrayDiff[$auditId] = $this->createDiff($model, $dynamicModel, $previousModel, $auditId); $previousModel = $model; } } return $this->render('index', ['model' => $dynamicModel, 'dataProvider' => $dataProvider, 'arrayDiff' => $arrayDiff, 'fields' => $auditForm->getFormFields($dynamicModel), 'hiddenColumns' => $this->hiddenColumns]); }
<?php /** * Displays content durning status change * @author Patryk Radziszewski <*****@*****.**> */ use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\widgets\ListView; ?> <div class="page-header"> <?php $form = ActiveForm::begin(['method' => 'GET']); ?> <?php echo \nineinchnick\audit\models\AuditForm::renderRow($this, $model, $form, [$fields], Yii::$app->request->getIsAjax() ? 12 : 6); ?> <?php echo Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-success']); ?> <?php ActiveForm::end(); ?> </div> <?php foreach (Yii::$app->session->getAllFlashes() as $key => $message) { echo '<div class="alert alert-' . $key . '">' . $message . '</div>'; } if ($dataProvider) { ?> <?php