модуль генерации пользователей

This commit is contained in:
Glambertessa
2019-11-14 17:21:34 +03:00
parent 601b62aa8d
commit f8222eb89c
19 changed files with 426 additions and 163 deletions

View File

@ -28,7 +28,7 @@ use yii\widgets\ActiveForm;
<div class="row" style="padding-bottom: 15px">
<div class="imgUpload col-xs-6">
<div class="media__upload_img"><img src="<?= $model->photo; ?>" width="100px"/></div>
<div class="media__upload_img"><img src="<?= $model->photo; ?>" width="100px" /></div>
<?php
echo InputFile::widget([
'language' => 'ru',
@ -47,13 +47,13 @@ use yii\widgets\ActiveForm;
?>
</div>
<div class="col-xs-6">
<!--<div class="media__upload_img"><img src="<?/*= $model->photo; */?>" width="100px"/></div>-->
<!--<div class="media__upload_img"><img src="<?/*= $model->photo; */ ?>" width="100px"/></div>-->
<?php
echo InputFile::widget([
'language' => 'ru',
'controller' => 'elfinder',
// вставляем название контроллера, по умолчанию равен elfinder
'filter' => ['image','application/zip','application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
'filter' => ['image', 'application/zip', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
// фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-con..
'name' => 'UserCard[resume]',
'id' => 'usercard-resume',
@ -73,31 +73,36 @@ use yii\widgets\ActiveForm;
</div>
<div class="col-xs-6">
<?= $form->field($model, 'gender')->dropDownList($model->genders,
[
'prompt' => 'Выберите'
]) ?>
<?= $form->field($model, 'gender')->dropDownList(
$model->genders,
[
'prompt' => 'Выберите'
]
) ?>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<?= $form->field($model, 'dob')->input('date',
[
'placeholder' => 'Zadejte svůj Datum narození',
'language' => 'en',
"data-format" => "DD MMMM YYYY",
]) ?>
</div>
<div class="col-xs-6">
<?= $form->field($model, 'status')
->dropDownList(\common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROFILE),
<?= $form->field($model, 'dob')->input(
'date',
[
'prompt' => 'Выберите'
'placeholder' => 'Zadejte svůj Datum narození',
'language' => 'en',
"data-format" => "DD MMMM YYYY",
]
) ?>
</div>
<div class="col-xs-6">
<?= $form->field($model, 'status')
->dropDownList(
\common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROFILE),
[
'prompt' => 'Выберите'
]
) ?>
</div>
</div>
<div class="row">
@ -116,10 +121,11 @@ use yii\widgets\ActiveForm;
<div class="row">
<div class="col-xs-12">
<?= $form->field($model, 'skill')->widget(Select2::class,
<?= $form->field($model, 'skill')->widget(
Select2::class,
[
'data' => \yii\helpers\ArrayHelper::map(\common\models\Skill::find()->all(),'id', 'name'),
'options' => ['placeholder' => '...','class' => 'form-control', 'multiple' => true],
'data' => \yii\helpers\ArrayHelper::map(\common\models\Skill::find()->all(), 'id', 'name'),
'options' => ['placeholder' => '...', 'class' => 'form-control', 'multiple' => true],
'pluginOptions' => [
'allowClear' => true
],
@ -130,49 +136,52 @@ use yii\widgets\ActiveForm;
<div class="row">
<div class="col-xs-12">
<?= $form->field($model, 'fields')->widget(MultipleInput::class, [
'cloneButton' => true,
'columns' => [
[
'name' => 'field_id',
'type' => 'dropDownList',
'title' => 'Поле',
'defaultValue' => null,
'items' => \yii\helpers\ArrayHelper::map(\backend\modules\settings\models\AdditionalFields::find()
->joinWith('useFields')
->where(['`use_field`.`use`' => \common\models\UseStatus::USE_PROFILE])
->all(),
'id', 'name'),
'options' => ['prompt' => 'Выберите']
],
[
'name' => 'value',
'title' => 'Значение',
'type' => InputFile::className(),
'options' => [
'language' => 'ru',
'controller' => 'elfinder',
// вставляем название контроллера, по умолчанию равен elfinder
// фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-con..
'name' => 'fields[value]',
'id' => 'fields-value',
'options' => ['class' => 'form-control itemImg', 'maxlength' => '255'],
'buttonOptions' => ['class' => 'btn btn-primary'],
'value' => $model->fields[0]['value'],
'buttonName' => 'Выбрать файл',
<?= $form->field($model, 'fields')->widget(MultipleInput::class, [
'cloneButton' => true,
'columns' => [
[
'name' => 'field_id',
'type' => 'dropDownList',
'title' => 'Поле',
'defaultValue' => null,
'items' => \yii\helpers\ArrayHelper::map(
\backend\modules\settings\models\AdditionalFields::find()
->joinWith('useFields')
->where(['`use_field`.`use`' => \common\models\UseStatus::USE_PROFILE])
->all(),
'id',
'name'
),
'options' => ['prompt' => 'Выберите']
],
[
'name' => 'value',
'title' => 'Значение',
'type' => InputFile::className(),
'options' => [
'language' => 'ru',
'controller' => 'elfinder',
// вставляем название контроллера, по умолчанию равен elfinder
// фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-con..
'name' => 'fields[value]',
'id' => 'fields-value',
'options' => ['class' => 'form-control itemImg', 'maxlength' => '255'],
'buttonOptions' => ['class' => 'btn btn-primary'],
'value' => $model->fields[0]['value'],
'buttonName' => 'Выбрать файл',
],
],
[
'name' => 'order',
'title' => 'Приоритет',
'enableError' => true,
'options' => [
'class' => 'input-priority'
]
],
],
[
'name' => 'order',
'title' => 'Приоритет',
'enableError' => true,
'options' => [
'class' => 'input-priority'
]
],
],
])->label('Дополнительно');
?>
])->label('Дополнительно');
?>
</div>
</div>
@ -182,4 +191,4 @@ use yii\widgets\ActiveForm;
<?php ActiveForm::end(); ?>
</div>
</div>

View File

@ -13,4 +13,4 @@ $this->params['breadcrumbs'][] = $this->title;
'model' => $model,
]) ?>
</div>
</div>

View File

@ -0,0 +1,3 @@
<?php
echo $massage;

View File

@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
<p>
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a('Сгенерировать пользователей', ['generate'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
@ -28,8 +29,8 @@ $this->params['breadcrumbs'][] = $this->title;
[
'label' => 'photo',
'format' => 'raw',
'value' => function($model){
return Html::img(Url::to($model->photo),[
'value' => function ($model) {
return Html::img(Url::to($model->photo), [
'style' => 'width:100px;'
]);
},
@ -42,14 +43,14 @@ $this->params['breadcrumbs'][] = $this->title;
//'dob',
[
'attribute' => 'status',
'value' => function($model){
'value' => function ($model) {
return $model->status0->name;
},
'filter' => kartik\select2\Select2::widget([
'model' => $searchModel,
'attribute' => 'status',
'data' => \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROFILE),
'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
'options' => ['placeholder' => 'Начните вводить...', 'class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
@ -58,22 +59,21 @@ $this->params['breadcrumbs'][] = $this->title;
//'created_at',
//'updated_at',
[
'label' => 'Навыки',
'format' => 'raw',
'value' => function($model){
$str = '';
foreach ($model->skillValues as $item)
{
$str .= $item->skill->name . ', ';
}
$str = substr( $str, 0, -2);
return $str;
},
'label' => 'Навыки',
'format' => 'raw',
'value' => function ($model) {
$str = '';
foreach ($model->skillValues as $item) {
$str .= $item->skill->name . ', ';
}
$str = substr($str, 0, -2);
return $str;
},
'filter' => kartik\select2\Select2::widget([
'attribute' => 'skills',
'attribute' => 'skills',
'model' => $searchModel,
'data' => \common\models\UserCard::getNameSkills(),
'options' => ['multiple' => true,'placeholder' => 'Выбрать параметр','class' => 'form-control'],
'options' => ['multiple' => true, 'placeholder' => 'Выбрать параметр', 'class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
@ -83,4 +83,4 @@ $this->params['breadcrumbs'][] = $this->title;
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>
</div>

View File

@ -6,6 +6,7 @@ use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\card\models\UserCard */
/* @var $userData common\models\User */
/* @var $skills \common\models\CardSkill */
/* @var $skill \common\models\Skill */
@ -27,14 +28,14 @@ $this->params['breadcrumbs'][] = $this->title;
[
'attribute' => 'Photo',
'format' => 'raw',
'value' => function($model){
'value' => function ($model) {
return Html::tag('img', null, ['src' => $model->photo, 'width' => '100px']);
}
],
[
'attribute' => 'Resume',
'format' => 'raw',
'value' => function($model){
'value' => function ($model) {
return Html::a('Скачать', $model->resume, ['target' => '_blank']);
}
],
@ -62,21 +63,21 @@ $this->params['breadcrumbs'][] = $this->title;
<h2>Навыки</h2>
<?php foreach ($skills as $skill): ?>
<?php foreach ($skills as $skill) : ?>
<span class="btn btn-default btn-sm"><?= $skill['skill']->name; ?></span>
<?php endforeach; ?>
<h2>Дополнительные сведения</h2>
<?= GridView::widget([
'dataProvider' => $modelFildValue,
'layout'=>"{items}",
'layout' => "{items}",
'columns' => [
'field.name:text:Поле',
[
'attribute' => 'value',
'format' => 'raw',
'value' => function($model){
if ($model->type_file == 'file'){
'value' => function ($model) {
if ($model->type_file == 'file') {
return $model->value . ' (' . Html::a('Скачать', $model->value, ['target' => '_blank', 'download' => 'download']) . ')';
}
return $model->value;
@ -84,4 +85,5 @@ $this->params['breadcrumbs'][] = $this->title;
],
],
]); ?>
</div>
</div>