mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-01-10 14:58:40 +00:00
general fixes
This commit is contained in:
parent
af4ff6668f
commit
c5e414cf03
|
|
@ -21,6 +21,7 @@ use Modules\Profile\Models\SettingsEnum;
|
|||
use phpOMS\Asset\AssetType;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Localization\NullLocalization;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
|
@ -109,6 +110,25 @@ final class BackendController extends Controller
|
|||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$mapperQuery = ProfileMapper::get()
|
||||
->with('account')
|
||||
->with('account/addresses')
|
||||
->with('image');
|
||||
|
||||
/** @var \Modules\Profile\Models\Profile $profile */
|
||||
$profile = $request->hasData('for')
|
||||
? $mapperQuery->where('account', (int) $request->getData('for'))->execute()
|
||||
: $mapperQuery->where('id', (int) $request->getData('id'))->execute();
|
||||
|
||||
$view->data['account'] = $profile;
|
||||
|
||||
if ($profile->id === 0) {
|
||||
$response->header->status = RequestStatusCode::R_404;
|
||||
$view->setTemplate('/Web/Backend/Error/404');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/** @var \phpOMS\Model\Html\Head $head */
|
||||
$head = $response->data['Content']->head;
|
||||
$head->addAsset(AssetType::CSS, '/Modules/Calendar/Theme/Backend/css/styles.css?v=' . self::VERSION);
|
||||
|
|
@ -124,18 +144,6 @@ final class BackendController extends Controller
|
|||
$calendarView->setTemplate('/Modules/Calendar/Theme/Backend/Components/Calendar/mini');
|
||||
$view->data['calendar'] = $calendarView;
|
||||
|
||||
$mapperQuery = ProfileMapper::get()
|
||||
->with('account')
|
||||
->with('account/addresses')
|
||||
->with('image');
|
||||
|
||||
/** @var \Modules\Profile\Models\Profile $profile */
|
||||
$profile = $request->hasData('for')
|
||||
? $mapperQuery->where('account', (int) $request->getData('for'))->execute()
|
||||
: $mapperQuery->where('id', (int) $request->getData('id'))->execute();
|
||||
|
||||
$view->data['account'] = $profile;
|
||||
|
||||
$l11n = null;
|
||||
if ($profile->account->id === $request->header->account) {
|
||||
/** @var \phpOMS\Localization\Localization $l11n */
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ $next = empty($accounts) ? '{/base}/profile/list' : '{/base}/profile/list?{?
|
|||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_user'); ?>" width="30" loading="lazy" class="profile-image"
|
||||
src="<?= $account->image->id === 0
|
||||
? UriFactory::build($this->getData('defaultImage')->getPath())
|
||||
? UriFactory::build($this->data['defaultImage']->getPath())
|
||||
: UriFactory::build($account->image->getPath()); ?>"></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($account->account->name3 . ' ' . $account->account->name2 . ' ' . $account->account->name1); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Activity'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($account->account->getLastActive()->format('Y-m-d')); ?></a>
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ echo $this->data['nav']->render();
|
|||
alt="<?= $this->getHtml('ProfileImage'); ?>"
|
||||
itemprop="logo" loading="lazy"
|
||||
src="<?= $profile->image->id === 0
|
||||
? UriFactory::build($this->getData('defaultImage')->getPath())
|
||||
? UriFactory::build($this->data['defaultImage']->getPath())
|
||||
: UriFactory::build($profile->image->getPath()); ?>"
|
||||
width="100px"></div>
|
||||
<?php if ($this->request->header->account === $profile->account->id) : ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user