mirror of
https://github.com/Karaka-Management/oms-Navigation.git
synced 2026-02-14 07:48:41 +00:00
Implement task navigation info
This commit is contained in:
parent
e81af78ff8
commit
a154f2789e
|
|
@ -115,6 +115,40 @@ class Controller extends ModuleAbstract implements WebInterface
|
||||||
return $navView;
|
return $navView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getView(RequestAbstract $request, ResponseAbstract $response)
|
||||||
|
{
|
||||||
|
$navObj = \Modules\Navigation\Models\Navigation::getInstance($request, $this->app->dbPool);
|
||||||
|
$nav = new \Modules\Navigation\Views\NavigationView($this->app, $request, $response);
|
||||||
|
$nav->setNav($navObj->getNav());
|
||||||
|
$nav->setLanguage($request->getL11n()->getLanguage());
|
||||||
|
$unread = [];
|
||||||
|
|
||||||
|
foreach($this->receiving as $receiving) {
|
||||||
|
$unread[$receiving] = $this->app->moduleManager->get($receiving)->openNav($request->getAccount());
|
||||||
|
}
|
||||||
|
|
||||||
|
$nav->setData('unread', $unread);
|
||||||
|
|
||||||
|
return $nav;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadLanguage(RequestAbstract $request, ResponseAbstract $response) {
|
||||||
|
$languages = $this->app->moduleManager->getLanguageFiles($request);
|
||||||
|
|
||||||
|
foreach ($languages as $path) {
|
||||||
|
if ($path[strlen($path) - 1] === '/') {
|
||||||
|
// Is not a navigation file
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = __DIR__ . '/../..' . $path . '.' . $response->getL11n()->getLanguage() . '.lang.php';
|
||||||
|
|
||||||
|
/** @noinspection PhpIncludeInspection */
|
||||||
|
$lang = include $path;
|
||||||
|
$this->app->l11nManager->loadLanguage($response->getL11n()->getLanguage(), 'Navigation', $lang);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $pageId Page/parent Id for navigation
|
* @param int $pageId Page/parent Id for navigation
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,13 @@
|
||||||
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::TOP])): ?>
|
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::TOP])): ?>
|
||||||
<ul id="t-nav" role="navigation">
|
<ul id="t-nav" role="navigation">
|
||||||
|
|
||||||
<?php foreach ($this->nav[\Modules\Navigation\Models\NavigationType::TOP] as $key => $parent) :
|
<?php $unread = $this->getData('unread');
|
||||||
|
foreach ($this->nav[\Modules\Navigation\Models\NavigationType::TOP] as $key => $parent) :
|
||||||
foreach ($parent as $link) : ?>
|
foreach ($parent as $link) : ?>
|
||||||
<li><a href="<?= \phpOMS\Uri\UriFactory::build($link['nav_uri']); ?>">
|
<li><a href="<?= \phpOMS\Uri\UriFactory::build($link['nav_uri']); ?>">
|
||||||
|
|
||||||
<?php if (isset($link['nav_icon'])) : ?>
|
<?php if (isset($link['nav_icon'])) : ?>
|
||||||
<i class="<?= $link['nav_icon']; ?>"></i>
|
<i class="<?= $link['nav_icon']; ?> infoIcon"><?php if(isset($unread[$link['nav_from']])) : ?><span class="badge"><?= $unread[$link['nav_from']]; ?></span><?php endif; ?></i>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?= $this->getText($link['nav_name']); ?></a>
|
<?= $this->getText($link['nav_name']); ?></a>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user