create default profile image

This commit is contained in:
Dennis Eichhorn 2021-08-06 19:29:11 +02:00
parent 4c28981f1f
commit 08d382cfce
5 changed files with 79 additions and 64 deletions

View File

@ -77,6 +77,11 @@ final class BackendController extends Controller
$view->setData('accounts', ProfileMapper::getAfterPivot(0, null, 25));
}
$profileImage = $this->app->appSettings->get(null, 'default_profile_image', 'Profile');
$image = MediaMapper::get((int) $profileImage['content']);
$view->setData('defaultImage', $image);
return $view;
}
@ -122,6 +127,11 @@ final class BackendController extends Controller
$media = MediaMapper::getFor((int) $profile->account->getId(), 'createdBy');
$view->setData('media', $media instanceof NullMedia ? [] : (!\is_array($media) ? [$media] : $media));
$profileImage = $this->app->appSettings->get(null, 'default_profile_image', 'Profile');
$image = MediaMapper::get((int) $profileImage['content']);
$view->setData('defaultImage', $image);
return $view;
}

View File

@ -1,4 +1,5 @@
<div class="ipt-wrap wf-100">
<div>
<div class="ipt-wrap wf-100">
<div class="ipt-first">
<span class="input">
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
@ -41,8 +42,8 @@
</span>
</div>
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
</div>
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true">
</div>
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true">
<template id="<?= $this->getId(); ?>-tagTemplate">
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
<i class="fa fa-times"></i>
@ -51,4 +52,5 @@
<span data-tpl-text="/name/0" data-tpl-value="/name/0" data-value=""></span>
</span>
</template>
</div>
</div>

View File

@ -57,14 +57,16 @@ $next = empty($accounts) ? '{/prefix}profile/list' : '{/prefix}profile/list?
<i class="filter fa fa-filter"></i>
</label>
<tbody>
<?php $count = 0; foreach ($accounts as $key => $account) : ++$count;
$url = UriFactory::build('{/prefix}profile/single?{?}&id=' . $account->getId()); ?>
<?php $count = 0;
foreach ($accounts as $key => $account) : ++$count;
$url = UriFactory::build('{/prefix}profile/single?{?}&id=' . $account->getId());
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><img width="30" loading="lazy" class="profile-image"
src="<?=
$account->image instanceof NullMedia ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
UriFactory::build('{/prefix}' . $account->image->getPath()); ?>"></a>
$account->image instanceof NullMedia
? UriFactory::build('{/prefix}' . $this->getData('defaultImage')->getPath())
: UriFactory::build('{/prefix}' . $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>
<?php endforeach; ?>

View File

@ -71,9 +71,9 @@ echo $this->getData('nav')->render();
alt="<?= $this->getHtml('ProfileImage'); ?>"
itemprop="logo" loading="lazy"
src="<?=
$profile->image instanceof NullMedia ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
UriFactory::build('{/prefix}' . $profile->image->getPath()); ?>"
$profile->image instanceof NullMedia
? UriFactory::build('{/prefix}' . $this->getData('defaultImage')->getPath())
: UriFactory::build('{/prefix}' . $profile->image->getPath()); ?>"
width="100px"></div>
<?php if ($this->request->header->account === $account->getId()) : ?>
<div><a id="iProfileUploadButton" href="#upload" data-action='[

View File

@ -18,12 +18,13 @@
"directory": "Profile",
"dependencies": {
"Admin": "1.0.0",
"Media": "1.0.0",
"Home": "1.0.0",
"Contact": "1.0.0",
"Media": "1.0.0"
"Contact": "1.0.0"
},
"providing": {
"Navigation": "*"
"Navigation": "*",
"Media": "1.0.0"
},
"load": [
{