add user CRUD
This commit is contained in:
28
backend/views/user/_form.php
Normal file
28
backend/views/user/_form.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\User */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="user-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?php echo Yii::t('common', 'Create')?>
|
||||
|
||||
<?= $form->field($model, 'username')->textInput() ?>
|
||||
<?= $form->field($model, 'email')->textInput() ?>
|
||||
<?= $form->field($model, 'password_plain')->passwordInput() ?>
|
||||
<?= $form->field($model, 'password_repeat')->passwordInput() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Mentés') : Yii::t('app', 'Mentés'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
35
backend/views/user/_search.php
Normal file
35
backend/views/user/_search.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model frontend\models\UserSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<?= Yii::t('app','Keresés')?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="user-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'username') ?>
|
||||
|
||||
<?php echo $form->field($model, 'email') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('app', 'Keresés'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
21
backend/views/user/create.php
Normal file
21
backend/views/user/create.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\User */
|
||||
|
||||
$this->title = Yii::t('app', 'Új felhasználó');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Felhasználók'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="user-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
35
backend/views/user/index.php
Normal file
35
backend/views/user/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel frontend\models\UserSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('app', 'Felhasználók');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="user-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('app', 'Új felhasználó'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'username',
|
||||
'email:email',
|
||||
'created_at:datetime',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
23
backend/views/user/update.php
Normal file
23
backend/views/user/update.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\User */
|
||||
|
||||
$this->title = Yii::t('app', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'User',
|
||||
]) . ' ' . $model->id;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Users'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
|
||||
?>
|
||||
<div class="user-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
38
backend/views/user/view.php
Normal file
38
backend/views/user/view.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\User */
|
||||
|
||||
$this->title = $model->id;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Felhasználók'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="user-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'username',
|
||||
'email:email',
|
||||
'statusHuman',
|
||||
'created_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user