some
This commit is contained in:
parent
b5b7befd34
commit
28c8e24847
@ -26,12 +26,8 @@
|
||||
<div class="wrapper d-flex align-items-stretch">
|
||||
<nav id="sidebar">
|
||||
<div class="p-4 pt-5">
|
||||
<a href="#" class="img logo rounded-circle mb-5"
|
||||
<a href="<?= '/admin/user/view/' . \kernel\modules\user\service\UserService::getAuthUser()->id ?>" class="img logo rounded-circle mb-5"
|
||||
style="background-image: url(<?= \kernel\modules\user\service\UserService::getAuthUserPhoto() ?? '/resources/images/noPhoto.png' ?>);"></a>
|
||||
|
||||
|
||||
<!-- style="background-image: url(/resources/images/noPhoto.png);"></a>-->
|
||||
|
||||
<p>
|
||||
<?= \kernel\modules\user\service\UserService::getAuthUsername() ?>
|
||||
</p>
|
||||
|
23
kernel/filters/BootstrapSelectFilterWithPrompt.php
Normal file
23
kernel/filters/BootstrapSelectFilterWithPrompt.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\filters;
|
||||
|
||||
use itguild\forms\builders\SelectBuilder;
|
||||
use Itguild\Tables\Filter\Filter;
|
||||
use kernel\helpers\Debug;
|
||||
|
||||
class BootstrapSelectFilterWithPrompt extends Filter
|
||||
{
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$select = SelectBuilder::build($this->name, [
|
||||
'class' => 'form-control',
|
||||
'options' => $this->param,
|
||||
'value' => $this->value,
|
||||
'prompt' => "Не выбрано"
|
||||
]);
|
||||
|
||||
return "<td>" . $select->create()->fetch() . "</td>";
|
||||
}
|
||||
}
|
21
kernel/filters/BootstrapTextFilter.php
Normal file
21
kernel/filters/BootstrapTextFilter.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\filters;
|
||||
|
||||
use itguild\forms\builders\TextInputBuilder;
|
||||
use Itguild\Tables\Filter\Filter;
|
||||
|
||||
class BootstrapTextFilter extends Filter
|
||||
{
|
||||
|
||||
public function fetch()
|
||||
{
|
||||
$textInput = TextInputBuilder::build($this->name, [
|
||||
'value' => $this->value,
|
||||
'class' => "form-control"
|
||||
]);
|
||||
|
||||
return "<td>" . $textInput->create()->fetch() . "</td>";
|
||||
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ $table->addAction(function ($row, $url) use ($moduleService) {
|
||||
$table->columns([
|
||||
'type' => [
|
||||
'filter' => [
|
||||
'class' => \kernel\filters\BootstrapSelectFilter::class,
|
||||
'class' => \kernel\filters\BootstrapSelectFilterWithPrompt::class,
|
||||
'param' => [
|
||||
'kernel' => 'kernel',
|
||||
'entity' => 'entity',
|
||||
|
@ -23,7 +23,7 @@ $table = new ListEloquentTable(new EloquentDataProvider(Post::class, [
|
||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||
'baseUrl' => "/admin/post",
|
||||
'searchPrefix' => "",
|
||||
'searchParams' => $get
|
||||
'searchParams' => $get,
|
||||
]));
|
||||
|
||||
//\kernel\helpers\Debug::dd((new \kernel\Request())->get());
|
||||
@ -47,13 +47,13 @@ foreach ($additionals as $additional) {
|
||||
$table->columns([
|
||||
'title' => [
|
||||
'filter' => [
|
||||
'class' => \Itguild\Tables\Filter\InputTextFilter::class,
|
||||
'class' => \kernel\filters\BootstrapTextFilter::class,
|
||||
'value' => $get['title'] ?? ''
|
||||
]
|
||||
],
|
||||
'content' => [
|
||||
'filter' => [
|
||||
'class' => \Itguild\Tables\Filter\InputTextFilter::class,
|
||||
'class' => \kernel\filters\BootstrapTextFilter::class,
|
||||
'value' => $get['content'] ?? ''
|
||||
]
|
||||
],
|
||||
@ -72,10 +72,12 @@ $table->columns([
|
||||
return User::find($data)->username;
|
||||
},
|
||||
'filter' => [
|
||||
'class' => \kernel\filters\BootstrapSelectFilter::class,
|
||||
'class' => \kernel\filters\BootstrapSelectFilterWithPrompt::class,
|
||||
'param' => \kernel\modules\user\service\UserService::createUsernameArr(),
|
||||
'value' => $get['user_id'] ?? ''
|
||||
]
|
||||
'value' => $get['user_id'] ?? '',
|
||||
'prompt' => 'dsds'
|
||||
],
|
||||
'prompt' => 'dsds'
|
||||
]
|
||||
]);
|
||||
|
||||
|
@ -82,6 +82,16 @@ class UserService
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function getAuthUserId(): string
|
||||
{
|
||||
$user = self::getAuthUser();
|
||||
if ($user){
|
||||
return $user->id;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function getAuthUserPhoto(): string|null
|
||||
{
|
||||
$user = self::getAuthUser();
|
||||
|
@ -17,13 +17,15 @@ use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnViewWidget;
|
||||
|
||||
$get = (new \kernel\Request())->get();
|
||||
|
||||
$table = new ListEloquentTable(new EloquentDataProvider(User::class, [
|
||||
'currentPage' => $page_number,
|
||||
'perPage' => 3,
|
||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||
'baseUrl' => "/admin/user",
|
||||
'filters' => ['email'],
|
||||
]));
|
||||
'searchPrefix' => "",
|
||||
'searchParams' => $get,]));
|
||||
|
||||
$entityRelation = new \kernel\EntityRelation();
|
||||
$additionals = $entityRelation->getEntityRelationsBySlug("user");
|
||||
@ -37,7 +39,8 @@ foreach ($additionals as $additional) {
|
||||
$table->columns([
|
||||
'username' => [
|
||||
"filter" => [
|
||||
'class' => \Itguild\Tables\Filter\InputTextFilter::class
|
||||
'class' => \kernel\filters\BootstrapTextFilter::class,
|
||||
'value' => $get['username'] ?? null,
|
||||
]
|
||||
],
|
||||
'user_photo' => function ($data) {
|
||||
|
Loading…
Reference in New Issue
Block a user