autofixes

This commit is contained in:
Dennis Eichhorn 2020-08-30 20:13:11 +02:00
parent 0b43d9b520
commit 446af118eb
5 changed files with 21 additions and 5 deletions

View File

@ -27,5 +27,6 @@ use phpOMS\Stdlib\Base\Enum;
abstract class LinkType extends Enum
{
public const CATEGORY = 0;
public const LINK = 1;
}

View File

@ -25,18 +25,32 @@ namespace Modules\Navigation\Models;
class NavElement
{
public int $id = 0;
public string $pid = '';
public string $name = '';
public int $type = 1;
public int $subtype = 2;
public ?string $icon = null;
public ?string $uri = null;
public string $target = 'self';
public ?string $action = null;
public string $from = '0';
public int $order = 1;
public int $parent = 0;
public ?int $permissionPerm = null;
public ?int $permissionType = null;
public ?int $permissionElement = null;
}

View File

@ -29,7 +29,7 @@ if (isset($this->nav[NavigationType::SIDE])) : ?>
<?php if (isset($parent['nav_icon'])) : ?>
<i class="<?= $this->printHtml($parent['nav_icon']); ?>"></i>
<?php endif; ?>
<span><?= $this->getHtml($parent['nav_name'], 'Navigation') ?></span><i class="fa fa-chevron-right expand"></i></label>
<span><?= $this->getHtml($parent['nav_name'], 'Navigation'); ?></span><i class="fa fa-chevron-right expand"></i></label>
<?php if (isset($this->nav[NavigationType::SIDE][LinkType::LINK])) :
foreach ($this->nav[NavigationType::SIDE][LinkType::LINK] as $key2 => $link) :
if ($link['nav_parent'] === $key) :
@ -40,8 +40,8 @@ if (isset($this->nav[NavigationType::SIDE])) : ?>
// todo: very simpleminded solution. doesn't work for root path /en/backend etc. e.g. dashboard
// this also fails for urls which are not structured like a tree
?>
<li<?= (\count($parentUri) > 2 && \stripos($uriPath, $miniParent) !== false) ? ' class="active"' : '' ?>>
<a href="<?= $uri; ?>"><?= $this->getHtml($link['nav_name'], 'Navigation') ?></a>
<li<?= (\count($parentUri) > 2 && \stripos($uriPath, $miniParent) !== false) ? ' class="active"' : ''; ?>>
<a href="<?= $uri; ?>"><?= $this->getHtml($link['nav_name'], 'Navigation'); ?></a>
<?php endif;
endforeach;
endif; ?>

View File

@ -23,13 +23,13 @@ if (isset($this->nav[NavigationType::TOP])) : ?>
<?php $unread = $this->getData('unread');
foreach ($this->nav[NavigationType::TOP] as $key => $parent) :
foreach ($parent as $id => $link) : ?>
<li><a id="link-<?= $id; ?>" target="<?= $link['nav_target'] ?>" href="<?= \phpOMS\Uri\UriFactory::build($link['nav_uri']); ?>"<?= $link['nav_action'] !== null ? ' data-action=\'' . $link['nav_action'] . '\'' : ''; ?>>
<li><a id="link-<?= $id; ?>" target="<?= $link['nav_target']; ?>" href="<?= \phpOMS\Uri\UriFactory::build($link['nav_uri']); ?>"<?= $link['nav_action'] !== null ? ' data-action=\'' . $link['nav_action'] . '\'' : ''; ?>>
<?php if (isset($link['nav_icon'])) : ?>
<i class="<?= $this->printHtml($link['nav_icon']); ?> infoIcon"><?php if (isset($unread[$link['nav_from']]) && $unread[$link['nav_from']] > 0) : ?><span class="badge"><?= $this->printHtml($unread[$link['nav_from']]); ?></span><?php endif; ?></i>
<?php endif; ?>
<span class="link"><?= $this->getHtml($link['nav_name'], 'Navigation') ?><span></a>
<span class="link"><?= $this->getHtml($link['nav_name'], 'Navigation'); ?><span></a>
<?php endforeach;
endforeach; ?>
</ul>

View File

@ -26,6 +26,7 @@ use phpOMS\Uri\HttpUri;
class AdminTest extends \PHPUnit\Framework\TestCase
{
protected const MODULE_NAME = 'Navigation';
protected const URI_LOAD = '';
use \Modules\tests\ModuleTestTrait;