first commit
This commit is contained in:
12
backend/modules/profile/views/default/index.php
Executable file
12
backend/modules/profile/views/default/index.php
Executable file
@ -0,0 +1,12 @@
|
||||
<div class="profile-default-index">
|
||||
<h1><?= $this->context->action->uniqueId ?></h1>
|
||||
<p>
|
||||
This is the view content for action "<?= $this->context->action->id ?>".
|
||||
The action belongs to the controller "<?= get_class($this->context) ?>"
|
||||
in the "<?= $this->context->module->id ?>" module.
|
||||
</p>
|
||||
<p>
|
||||
You may customize this page by editing the following file:<br>
|
||||
<code><?= __FILE__ ?></code>
|
||||
</p>
|
||||
</div>
|
40
backend/modules/profile/views/profile/_form.php
Executable file
40
backend/modules/profile/views/profile/_form.php
Executable file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var common\models\Profile $model */
|
||||
/** @var common\models\User[] $users */
|
||||
/** @var common\models\Text[] $texts */
|
||||
/** @var yii\widgets\ActiveForm $form */
|
||||
?>
|
||||
|
||||
<div class="profile-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'user_id')->dropDownList(ArrayHelper::map($users, 'id', 'username')) ?>
|
||||
|
||||
<?= $form->field($model, 'file')->fileInput() ?>
|
||||
|
||||
<?= $form->field($model, 'activity')->checkbox() ?>
|
||||
|
||||
<?php
|
||||
if (!empty($texts)):
|
||||
foreach ($texts as $i => $text): ?>
|
||||
|
||||
<?= $form->field($text, 'title[' . $text['language'] . ']')->textInput(['maxlength' => true, 'value' => $text->title])->label($text['language'] . ' заголовок') ?>
|
||||
|
||||
<?= $form->field($text, 'text[' . $text['language'] . ']')->textarea(['value' => $text->title])->label($text['language'] . ' текст') ?>
|
||||
|
||||
<?php endforeach; endif; ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
35
backend/modules/profile/views/profile/_search.php
Executable file
35
backend/modules/profile/views/profile/_search.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var app\modules\profile\models\ProfileSearch $model */
|
||||
/** @var yii\widgets\ActiveForm $form */
|
||||
?>
|
||||
|
||||
<div class="profile-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id') ?>
|
||||
|
||||
<?= $form->field($model, 'user_id') ?>
|
||||
|
||||
<?= $form->field($model, 'created_at') ?>
|
||||
|
||||
<?= $form->field($model, 'image') ?>
|
||||
|
||||
<?= $form->field($model, 'activity') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
24
backend/modules/profile/views/profile/create.php
Executable file
24
backend/modules/profile/views/profile/create.php
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var common\models\Profile $model */
|
||||
/** @var common\models\User[] $users */
|
||||
/** @var common\models\Text[] $texts */
|
||||
|
||||
$this->title = 'Create Profile';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Profiles', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="profile-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
'users' => $users,
|
||||
'texts' => $texts
|
||||
]) ?>
|
||||
|
||||
</div>
|
57
backend/modules/profile/views/profile/index.php
Executable file
57
backend/modules/profile/views/profile/index.php
Executable file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use common\models\Profile;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use yii\grid\ActionColumn;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var app\modules\profile\models\ProfileSearch $searchModel */
|
||||
/** @var yii\data\ActiveDataProvider $dataProvider */
|
||||
|
||||
$this->title = 'Profiles';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="profile-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Create Profile', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'id',
|
||||
'created_at',
|
||||
[
|
||||
'attribute' => 'user_id',
|
||||
'value' => function($model){return $model->user->username;},
|
||||
],
|
||||
[
|
||||
'attribute' => 'image',
|
||||
'value' => function($model){return '/uploads/' . $model->image;},
|
||||
'format' => ['image', ['width' => 100, 'height' => 100]],
|
||||
],
|
||||
[
|
||||
'attribute' => 'activity',
|
||||
'value' => function($model){return $model->getStatusLabel();},
|
||||
],
|
||||
[
|
||||
'class' => ActionColumn::className(),
|
||||
'urlCreator' => function ($action, Profile $model, $key, $index, $column) {
|
||||
return Url::toRoute([$action, 'id' => $model->id]);
|
||||
}
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
|
||||
</div>
|
25
backend/modules/profile/views/profile/update.php
Executable file
25
backend/modules/profile/views/profile/update.php
Executable file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var common\models\Profile $model */
|
||||
/** @var common\models\User[] $users */
|
||||
/** @var common\models\Text[] $texts */
|
||||
|
||||
$this->title = 'Update Profile: ' . $model->id;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Profiles', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="profile-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
'users' => $users,
|
||||
'texts' => $texts
|
||||
]) ?>
|
||||
|
||||
</div>
|
50
backend/modules/profile/views/profile/view.php
Executable file
50
backend/modules/profile/views/profile/view.php
Executable file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var common\models\Profile $model */
|
||||
|
||||
$this->title = $model->id;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Profiles', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
?>
|
||||
<div class="profile-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id',
|
||||
[
|
||||
'attribute' => 'user_id',
|
||||
'value' => function($model){return $model->user->username;},
|
||||
],
|
||||
'created_at',
|
||||
[
|
||||
'attribute' => 'image',
|
||||
'value' => function($model){return '/uploads/' . $model->image;},
|
||||
'format' => ['image', ['width' => 100, 'height' => 100]],
|
||||
],
|
||||
[
|
||||
'attribute' => 'activity',
|
||||
'value' => function($model){return $model->getStatusLabel();},
|
||||
],
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user