Commit 4698313babd999507275ba1dd986e8c207b536dc
1 parent
4d0b6b18
Importers CRUD
Showing
8 changed files
with
221 additions
and
3 deletions
Show diff stats
backend/controllers/UserController.php
... | ... | @@ -4,7 +4,7 @@ namespace backend\controllers; |
4 | 4 | |
5 | 5 | use Yii; |
6 | 6 | use backend\models\User; |
7 | -use common\models\UserSearch; | |
7 | +use backend\models\UserSearch; | |
8 | 8 | use yii\web\Controller; |
9 | 9 | use yii\web\NotFoundHttpException; |
10 | 10 | use yii\filters\VerbFilter; |
... | ... | @@ -14,7 +14,6 @@ use yii\filters\VerbFilter; |
14 | 14 | */ |
15 | 15 | class UserController extends Controller |
16 | 16 | { |
17 | - public $layout = "/column"; | |
18 | 17 | public function behaviors() |
19 | 18 | { |
20 | 19 | return [ | ... | ... |
common/models/UserSearch.php renamed to backend/models/UserSearch.php
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\ActiveForm; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model backend\models\User */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="user-form"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin(); ?> | |
14 | + | |
15 | + <?= $form->field($model, 'login')->textInput(['maxlength' => true]) ?> | |
16 | + | |
17 | + <?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?> | |
18 | + | |
19 | + <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?> | |
20 | + | |
21 | + <?= $form->field($model, 'is_super')->textInput() ?> | |
22 | + | |
23 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | |
24 | + | |
25 | + <?= $form->field($model, 'office_id')->textInput() ?> | |
26 | + | |
27 | + <?= $form->field($model, 'photo')->textInput(['maxlength' => true]) ?> | |
28 | + | |
29 | + <?= $form->field($model, 'contacts')->textInput(['maxlength' => true]) ?> | |
30 | + | |
31 | + <?= $form->field($model, 'acl_accounts_access')->textInput() ?> | |
32 | + | |
33 | + <?= $form->field($model, 'active')->textInput() ?> | |
34 | + | |
35 | + <div class="form-group"> | |
36 | + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
37 | + </div> | |
38 | + | |
39 | + <?php ActiveForm::end(); ?> | |
40 | + | |
41 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\ActiveForm; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model backend\models\UserSearch */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="user-search"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin([ | |
14 | + 'action' => ['index'], | |
15 | + 'method' => 'get', | |
16 | + ]); ?> | |
17 | + | |
18 | + <?= $form->field($model, 'id') ?> | |
19 | + | |
20 | + <?= $form->field($model, 'login') ?> | |
21 | + | |
22 | + <?= $form->field($model, 'password') ?> | |
23 | + | |
24 | + <?= $form->field($model, 'email') ?> | |
25 | + | |
26 | + <?= $form->field($model, 'is_super') ?> | |
27 | + | |
28 | + <?php // echo $form->field($model, 'name') ?> | |
29 | + | |
30 | + <?php // echo $form->field($model, 'office_id') ?> | |
31 | + | |
32 | + <?php // echo $form->field($model, 'photo') ?> | |
33 | + | |
34 | + <?php // echo $form->field($model, 'contacts') ?> | |
35 | + | |
36 | + <?php // echo $form->field($model, 'acl_accounts_access') ?> | |
37 | + | |
38 | + <?php // echo $form->field($model, 'active') ?> | |
39 | + | |
40 | + <div class="form-group"> | |
41 | + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> | |
42 | + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> | |
43 | + </div> | |
44 | + | |
45 | + <?php ActiveForm::end(); ?> | |
46 | + | |
47 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model backend\models\User */ | |
8 | + | |
9 | +$this->title = 'Create User'; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-create"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <?= $this->render('_form', [ | |
18 | + 'model' => $model, | |
19 | + ]) ?> | |
20 | + | |
21 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\grid\GridView; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $searchModel backend\models\UserSearch */ | |
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | + | |
10 | +$this->title = 'Users'; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-index"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
17 | + | |
18 | + <p> | |
19 | + <?= Html::a('Create User', ['create'], ['class' => 'btn btn-success']) ?> | |
20 | + </p> | |
21 | + | |
22 | + <?= GridView::widget([ | |
23 | + 'dataProvider' => $dataProvider, | |
24 | + 'filterModel' => $searchModel, | |
25 | + 'columns' => [ | |
26 | + ['class' => 'yii\grid\SerialColumn'], | |
27 | + | |
28 | + 'id', | |
29 | + 'login', | |
30 | + 'password', | |
31 | + 'email:email', | |
32 | + 'is_super', | |
33 | + // 'name', | |
34 | + // 'office_id', | |
35 | + // 'photo', | |
36 | + // 'contacts', | |
37 | + // 'acl_accounts_access', | |
38 | + // 'active', | |
39 | + | |
40 | + ['class' => 'yii\grid\ActionColumn'], | |
41 | + ], | |
42 | + ]); ?> | |
43 | + | |
44 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | +/* @var $this yii\web\View */ | |
6 | +/* @var $model backend\models\User */ | |
7 | + | |
8 | +$this->title = 'Update User: ' . ' ' . $model->name; | |
9 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | |
10 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; | |
11 | +$this->params['breadcrumbs'][] = 'Update'; | |
12 | +?> | |
13 | +<div class="user-update"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <?= $this->render('_form', [ | |
18 | + 'model' => $model, | |
19 | + ]) ?> | |
20 | + | |
21 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\DetailView; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model backend\models\User */ | |
8 | + | |
9 | +$this->title = $model->name; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-view"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <p> | |
18 | + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a('Delete', ['delete', 'id' => $model->id], [ | |
20 | + 'class' => 'btn btn-danger', | |
21 | + 'data' => [ | |
22 | + 'confirm' => 'Are you sure you want to delete this item?', | |
23 | + 'method' => 'post', | |
24 | + ], | |
25 | + ]) ?> | |
26 | + </p> | |
27 | + | |
28 | + <?= DetailView::widget([ | |
29 | + 'model' => $model, | |
30 | + 'attributes' => [ | |
31 | + 'id', | |
32 | + 'login', | |
33 | + 'password', | |
34 | + 'email:email', | |
35 | + 'is_super', | |
36 | + 'name', | |
37 | + 'office_id', | |
38 | + 'photo', | |
39 | + 'contacts', | |
40 | + 'acl_accounts_access', | |
41 | + 'active', | |
42 | + ], | |
43 | + ]) ?> | |
44 | + | |
45 | +</div> | ... | ... |