This commit is contained in:
2020-10-06 14:27:47 +07:00
commit 586be80cf6
16613 changed files with 3274099 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
/* @var $this \yii\web\View */
/* @var $panel yii\debug\panels\UserPanel */
use yii\bootstrap\Tabs;
use yii\widgets\DetailView;
?>
<h1>User</h1>
<?php
if (isset($panel->data['identity'])) {
$items = [
[
'label' => 'User',
'content' => '<h2>User Info</h2>' . DetailView::widget([
'model' => $panel->data['identity'],
'attributes' => $panel->data['attributes']
]),
'active' => true,
],
];
if ($panel->data['rolesProvider'] || $panel->data['permissionsProvider']) {
$items[] = [
'label' => 'Roles and Permissions',
'content' => $this->render('roles', ['panel' => $panel])
];
}
if ($panel->canSwitchUser()) {
$items[] = [
'label' => 'Switch User',
'content' => $this->render(
'switch',
[
'panel' => $panel
]
)
];
}
echo Tabs::widget([
'items' => $items,
]);
} else {
echo 'Is guest.';
} ?>

View File

@@ -0,0 +1,42 @@
<?php
/* @var $panel yii\debug\panels\UserPanel */
use yii\grid\GridView;
?>
<?php
if ($panel->data['rolesProvider']) {
echo '<h2>Roles</h2>';
echo GridView::widget([
'dataProvider' => $panel->data['rolesProvider'],
'columns' => [
'name',
'description',
'ruleName',
'data',
'createdAt:datetime',
'updatedAt:datetime'
]
]);
}
if ($panel->data['permissionsProvider']) {
echo '<h2>Permissions</h2>';
echo GridView::widget([
'dataProvider' => $panel->data['permissionsProvider'],
'columns' => [
'name',
'description',
'ruleName',
'data',
'createdAt:datetime',
'updatedAt:datetime'
]
]);
} ?>

View File

@@ -0,0 +1,25 @@
<?php
/* @var $this \yii\web\View */
/* @var $panel yii\debug\panels\UserPanel */
?>
<div class="yii-debug-toolbar__block">
<a href="<?= $panel->getUrl() ?>">
<?php if (!isset($panel->data['id'])): ?>
<span class="yii-debug-toolbar__label">Guest</span>
<?php else: ?>
<?php if ($panel->getUser()->isGuest || $panel->userSwitch->isMainUser()): ?>
User <span
class="yii-debug-toolbar__label yii-debug-toolbar__label_info"><?= $panel->data['id'] ?></span>
<?php else: ?>
User switching <span
class="yii-debug-toolbar__label yii-debug-toolbar__label_warning"><?= $panel->data['id'] ?></span>
<?php endif; ?>
<?php if ($panel->canSwitchUser()): ?>
<span class="yii-debug-toolbar__switch-icon yii-debug-toolbar__userswitch"
id="yii-debug-toolbar__switch-users">
</span>
<?php endif; ?>
<?php endif; ?>
</a>
</div>

View File

@@ -0,0 +1,65 @@
<?php
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Html;
use yii\debug\UserswitchAsset;
use yii\grid\GridView;
/* @var $this \yii\web\View */
/* @var $panel yii\debug\panels\UserPanel */
UserswitchAsset::register($this);
echo '<h2>Switch user</h2>';
?>
<div class="row">
<div class="col-sm-7">
<?php $formSet = ActiveForm::begin([
'action' => \yii\helpers\Url::to(['user/set-identity']),
'layout' => 'horizontal',
'options' => [
'id' => 'debug-userswitch__set-identity',
'style' => $panel->canSearchUsers() ? 'display:none' : ''
]
]);
echo $formSet->field(
$panel->userSwitch,
'user[id]', ['options' => ['class' => '']])
->textInput(['id' => 'user_id', 'name' => 'user_id'])
->label('Switch User');
echo Html::submitButton('Switch', ['class' => 'btn btn-primary']);
ActiveForm::end();
?>
</div>
<div class="col-sm-5">
<?php
if (!$panel->userSwitch->isMainUser()) {
$formReset = ActiveForm::begin([
'action' => \yii\helpers\Url::to(['user/reset-identity']),
'options' => [
'id' => 'debug-userswitch__reset-identity',
]
]);
echo Html::submitButton('Reset to <span class="yii-debug-toolbar__label yii-debug-toolbar__label_info">' .
$panel->userSwitch->getMainUser()->getId() .
'</span>', ['class' => 'btn btn-default']);
ActiveForm::end();
}
?>
</div>
</div>
<?php
if ($panel->canSearchUsers()) {
\yii\widgets\Pjax::begin(['id' => 'debug-userswitch__filter', 'timeout' => false]);
echo GridView::widget([
'dataProvider' => $panel->getUserDataProvider(),
'filterModel' => $panel->getUsersFilterModel(),
'tableOptions' => [
'class' => 'table table-bordered table-responsive table-hover table-pointer'
],
'columns' => $panel->filterColumns
]);
\yii\widgets\Pjax::end();
}