mirror of
https://github.com/Karaka-Management/oms-Navigation.git
synced 2026-02-15 08:18:40 +00:00
Started to implement profile admin functionality
This commit is contained in:
parent
ba828cb414
commit
3d661ee769
|
|
@ -27,6 +27,5 @@ use phpOMS\Stdlib\Base\Enum;
|
||||||
abstract class LinkType extends Enum
|
abstract class LinkType extends Enum
|
||||||
{
|
{
|
||||||
public const CATEGORY = 0;
|
public const CATEGORY = 0;
|
||||||
|
public const LINK = 1;
|
||||||
public const LINK = 1;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Account\Account;
|
use phpOMS\Account\Account;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigation class.
|
* Navigation class.
|
||||||
|
|
@ -85,24 +86,17 @@ class Navigation
|
||||||
{
|
{
|
||||||
if (empty($this->nav)) {
|
if (empty($this->nav)) {
|
||||||
$this->nav = [];
|
$this->nav = [];
|
||||||
$uriPdo = '';
|
|
||||||
|
|
||||||
$i = 1;
|
$query = new Builder($this->dbPool->get('select'));
|
||||||
foreach ($hashes as $hash) {
|
$query->prefix($this->dbPool->get('select')->prefix);
|
||||||
$uriPdo .= ':pid' . $i . ',';
|
$sth = $query->select('*')
|
||||||
$i++;
|
->from('nav')
|
||||||
}
|
->whereIn('nav.nav_pid', $hashes)
|
||||||
|
->orderBy('nav.nav_order', 'ASC')
|
||||||
|
->execute();
|
||||||
|
|
||||||
$uriPdo = \rtrim($uriPdo, ',');
|
$qry = $query->toSql();
|
||||||
$sth = $this->dbPool->get('select')->con->prepare('SELECT * FROM `' . $this->dbPool->get('select')->prefix . 'nav` WHERE `nav_pid` IN(' . $uriPdo . ') ORDER BY `nav_order` ASC');
|
|
||||||
|
|
||||||
$i = 1;
|
|
||||||
foreach ($hashes as $hash) {
|
|
||||||
$sth->bindValue(':pid' . $i, $hash, \PDO::PARAM_STR);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sth->execute();
|
|
||||||
$tempNav = $sth->fetchAll(\PDO::FETCH_GROUP);
|
$tempNav = $sth->fetchAll(\PDO::FETCH_GROUP);
|
||||||
|
|
||||||
foreach ($tempNav as $id => $link) {
|
foreach ($tempNav as $id => $link) {
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,15 @@
|
||||||
/**
|
/**
|
||||||
* @var \Modules\Navigation\Views\NavigationView $this
|
* @var \Modules\Navigation\Views\NavigationView $this
|
||||||
*/
|
*/
|
||||||
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT])) {
|
|
||||||
|
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT])
|
||||||
|
&& \phpOMS\Utils\ArrayUtils::inArrayRecursive($this->parent, $this->nav[\Modules\Navigation\Models\NavigationType::CONTENT], 'nav_parent')
|
||||||
|
) {
|
||||||
echo '<div class="row"><div class="col-xs-12"><ul class="nav-top" role="navigation">';
|
echo '<div class="row"><div class="col-xs-12"><ul class="nav-top" role="navigation">';
|
||||||
|
|
||||||
foreach ($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT] as $key => $parent) {
|
foreach ($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT] as $key => $parent) {
|
||||||
foreach ($parent as $link) {
|
foreach ($parent as $link) {
|
||||||
if ($link['nav_parent'] == $this->parent) {
|
if ($link['nav_parent'] === $this->parent) {
|
||||||
echo '<li><a href="' . \phpOMS\Uri\UriFactory::build($link['nav_uri']) . '">'
|
echo '<li><a href="' . \phpOMS\Uri\UriFactory::build($link['nav_uri']) . '">'
|
||||||
. $this->getHtml($link['nav_name']) . '</a>';
|
. $this->getHtml($link['nav_name']) . '</a>';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user