bug fixes and template adjustments

This commit is contained in:
Dennis Eichhorn 2021-07-31 17:20:49 +02:00
parent 6dee9b7de2
commit d038fa7c53
5 changed files with 8 additions and 7 deletions

View File

@ -209,8 +209,8 @@ final class ApiController extends Controller
*/
public static function createMediaPath(string $basePath = '/Modules/Media/Files') : string
{
$rndPath = \str_pad(\dechex(\mt_rand(0, 65535)), 4, '0', \STR_PAD_LEFT);
return $basePath . '/_' . $rndPath[0] . $rndPath[1] . '/' . $rndPath[2] . $rndPath[3];
$rndPath = \str_pad(\dechex(\mt_rand(0, 4294967295)), 8, '0', \STR_PAD_LEFT);
return $basePath . '/_' . $rndPath[0] . $rndPath[1] . $rndPath[2] . $rndPath[3] . '/_' . $rndPath[4] . $rndPath[5] . $rndPath[6] . $rndPath[7];
}
/**

View File

@ -99,7 +99,7 @@ final class CollectionMapper extends MediaMapper
public static function getByVirtualPath(string $virtualPath = '/', bool $hidden = false) : array
{
$depth = 3;
$query = self::getQuery();
$query = self::getQuery(depth: $depth);
$query->where(self::$table . '_d' . $depth . '.media_virtual', '=', $virtualPath);
$query->where(self::$table . '_d' . $depth . '.media_collection', '=', 1);

View File

@ -140,7 +140,7 @@ class MediaMapper extends DataMapperAbstract
public static function getByVirtualPath(string $virtualPath = '/', bool $hidden = false) : array
{
$depth = 3;
$query = self::getQuery();
$query = self::getQuery(depth: $depth);
$query->where(self::$table . '_d' . $depth . '.media_virtual', '=', $virtualPath);
if ($hidden === false) {

View File

@ -164,6 +164,7 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=
<td>
<td>
<td>
<td>
<?php endif; ?>
<?php $count = 0;
foreach ($media as $key => $value) :
@ -199,11 +200,11 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=
<td data-label="<?= $this->getHtml('Size'); ?>"><a href="<?= $url; ?>"><?php
$size = FileSizeType::autoFormat($value->size);
echo $this->printHtml($value->extension !== 'collection' ? \number_format($size[0], 1, '.', ',') . $size[1] : ''); ?></a>
<td data-label="<?= $this->getHtml('Creator'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->createdBy->name1); ?></a>
<td data-label="<?= $this->getHtml('Creator'); ?>"><a class="content" href="<?= UriFactory::build('{/prefix}profile/single?{?}&for=' . $value->createdBy->getId()); ?>"><?= $this->printHtml($value->createdBy->name1); ?></a>
<td data-label="<?= $this->getHtml('Created'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="6" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
<div class="portlet-foot">

View File

@ -10,7 +10,7 @@
"require-dev": {
"phpunit/phpunit": ">=9.4",
"friendsofphp/php-cs-fixer": ">=3.0",
"squizlabs/php_codesniffer": ">=3.5",
"squizlabs/php_codesniffer": ">=3.6",
"phpmd/phpmd": ">=2.9",
"phpstan/phpstan": ">=0.12.58",
"phan/phan": ">=3.2.6"