diff --git a/backend/controllers/UserController.php b/backend/controllers/UserController.php index fec9436..4b3f48b 100644 --- a/backend/controllers/UserController.php +++ b/backend/controllers/UserController.php @@ -4,7 +4,7 @@ namespace backend\controllers; use Yii; use backend\models\User; -use common\models\UserSearch; +use backend\models\UserSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; @@ -14,7 +14,6 @@ use yii\filters\VerbFilter; */ class UserController extends Controller { - public $layout = "/column"; public function behaviors() { return [ diff --git a/backend/models/UserSearch.php b/backend/models/UserSearch.php new file mode 100644 index 0000000..e4a08e5 --- /dev/null +++ b/backend/models/UserSearch.php @@ -0,0 +1,75 @@ + $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, + 'is_super' => $this->is_super, + 'office_id' => $this->office_id, + 'acl_accounts_access' => $this->acl_accounts_access, + 'active' => $this->active, + ]); + + $query->andFilterWhere(['like', 'login', $this->login]) + ->andFilterWhere(['like', 'password', $this->password]) + ->andFilterWhere(['like', 'email', $this->email]) + ->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'photo', $this->photo]) + ->andFilterWhere(['like', 'contacts', $this->contacts]); + + return $dataProvider; + } +} diff --git a/backend/views/user/_form.php b/backend/views/user/_form.php new file mode 100644 index 0000000..2869b41 --- /dev/null +++ b/backend/views/user/_form.php @@ -0,0 +1,41 @@ + + +
+ + + + field($model, 'login')->textInput(['maxlength' => true]) ?> + + field($model, 'password')->passwordInput(['maxlength' => true]) ?> + + field($model, 'email')->textInput(['maxlength' => true]) ?> + + field($model, 'is_super')->textInput() ?> + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'office_id')->textInput() ?> + + field($model, 'photo')->textInput(['maxlength' => true]) ?> + + field($model, 'contacts')->textInput(['maxlength' => true]) ?> + + field($model, 'acl_accounts_access')->textInput() ?> + + field($model, 'active')->textInput() ?> + +
+ isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/user/_search.php b/backend/views/user/_search.php new file mode 100644 index 0000000..87afabf --- /dev/null +++ b/backend/views/user/_search.php @@ -0,0 +1,47 @@ + + + diff --git a/backend/views/user/create.php b/backend/views/user/create.php new file mode 100644 index 0000000..254e3e2 --- /dev/null +++ b/backend/views/user/create.php @@ -0,0 +1,21 @@ +title = 'Create User'; +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/user/index.php b/backend/views/user/index.php new file mode 100644 index 0000000..f24a914 --- /dev/null +++ b/backend/views/user/index.php @@ -0,0 +1,44 @@ +title = 'Users'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ 'btn btn-success']) ?> +

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id', + 'login', + 'password', + 'email:email', + 'is_super', + // 'name', + // 'office_id', + // 'photo', + // 'contacts', + // 'acl_accounts_access', + // 'active', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/backend/views/user/update.php b/backend/views/user/update.php new file mode 100644 index 0000000..d932521 --- /dev/null +++ b/backend/views/user/update.php @@ -0,0 +1,21 @@ +title = 'Update User: ' . ' ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update'; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/user/view.php b/backend/views/user/view.php new file mode 100644 index 0000000..7b18213 --- /dev/null +++ b/backend/views/user/view.php @@ -0,0 +1,45 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'login', + 'password', + 'email:email', + 'is_super', + 'name', + 'office_id', + 'photo', + 'contacts', + 'acl_accounts_access', + 'active', + ], + ]) ?> + +
diff --git a/common/models/UserSearch.php b/common/models/UserSearch.php deleted file mode 100644 index da031c5..0000000 --- a/common/models/UserSearch.php +++ /dev/null @@ -1,75 +0,0 @@ - $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, - 'is_super' => $this->is_super, - 'office_id' => $this->office_id, - 'acl_accounts_access' => $this->acl_accounts_access, - 'active' => $this->active, - ]); - - $query->andFilterWhere(['like', 'login', $this->login]) - ->andFilterWhere(['like', 'password', $this->password]) - ->andFilterWhere(['like', 'email', $this->email]) - ->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'photo', $this->photo]) - ->andFilterWhere(['like', 'contacts', $this->contacts]); - - return $dataProvider; - } -} -- libgit2 0.21.4