Started to implement profile admin functionality

This commit is contained in:
Dennis Eichhorn 2018-09-15 13:31:50 +02:00
parent ba828cb414
commit 3d661ee769
3 changed files with 15 additions and 19 deletions

View File

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

View File

@ -18,6 +18,7 @@ use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Message\RequestAbstract;
use phpOMS\Account\Account;
use phpOMS\Account\PermissionType;
use phpOMS\DataStorage\Database\Query\Builder;
/**
* Navigation class.
@ -85,24 +86,17 @@ class Navigation
{
if (empty($this->nav)) {
$this->nav = [];
$uriPdo = '';
$i = 1;
foreach ($hashes as $hash) {
$uriPdo .= ':pid' . $i . ',';
$i++;
}
$query = new Builder($this->dbPool->get('select'));
$query->prefix($this->dbPool->get('select')->prefix);
$sth = $query->select('*')
->from('nav')
->whereIn('nav.nav_pid', $hashes)
->orderBy('nav.nav_order', 'ASC')
->execute();
$uriPdo = \rtrim($uriPdo, ',');
$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');
$qry = $query->toSql();
$i = 1;
foreach ($hashes as $hash) {
$sth->bindValue(':pid' . $i, $hash, \PDO::PARAM_STR);
$i++;
}
$sth->execute();
$tempNav = $sth->fetchAll(\PDO::FETCH_GROUP);
foreach ($tempNav as $id => $link) {

View File

@ -13,12 +13,15 @@
/**
* @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">';
foreach ($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT] as $key => $parent) {
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']) . '">'
. $this->getHtml($link['nav_name']) . '</a>';
}