public function changeBlock($property) { $change = Change::find()->where(['approved' => 0, 'canceled' => 0, 'class' => $this->owner->className(), 'object_id' => $this->owner->id, 'property' => $property])->one(); if ($change) { if ($change->pre) { return Html::tag('div', \Yii::t('app', '<span class="glyphicon glyphicon-exclamation-sign"></span> Изменение этого поля на "' . $change->value_new . '" ожидает проверки модератором.'), ['class' => 'help-block', 'style' => 'font-size: 90%; color: #F19A2C;']); } else { return Html::tag('div', \Yii::t('app', '<span class="glyphicon glyphicon-exclamation-sign"></span> Изменения этого поля еще не одобрены администратором.'), ['class' => 'help-block', 'style' => 'font-size: 90%; color: #F19A2C;']); } } }
/** * Lists all Change models. * @return mixed */ public function actionIndex() { $query = Change::find(); $params = Yii::$app->request->get('Change'); if ($params['filter']) { $query->orFilterWhere(['like', 'title', $params['filter']]); } if ($params['status'] != '') { $query->andWhere(['status' => $params['status']]); } $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['created' => SORT_DESC]], 'pagination' => ['pageSize' => 10]]); return $this->render('@vendor/floor12/yii2-change-field-control-behavior/views/index.php', ['dataProvider' => $dataProvider]); }