Modifiacation sitemap / pages et sous-pages masquées
This commit is contained in:
parent
932cb0f178
commit
2de4c06d25
|
@ -32,7 +32,22 @@ class sitemap extends common
|
|||
include('./core/module/sitemap/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_sitemap.php');
|
||||
|
||||
$items = '<ul>';
|
||||
|
||||
|
||||
// Groupe du client connecté (1, 2, 3, 4) ou non connecté (0)
|
||||
$groupUser = $this->getUser('group') === false ? 0 : $this->getUser('group');
|
||||
foreach ($this->getHierarchy(null, true, null) as $parentId => $childIds) {
|
||||
// Cas où les pages enfants enfant sont toutes desactivées dans le menu
|
||||
$totalChild = 0;
|
||||
$disableChild = 0;
|
||||
foreach($childIds as $childKey) {
|
||||
$totalChild += 1;
|
||||
if( $this->getData(['page', $childKey, 'disable']) === true ) $disableChild +=1;
|
||||
}
|
||||
// Ne pas afficher les pages masquées dans le menu latéral ou les pages désactivées sans sous-page active pour les clients < éditeur
|
||||
if ($this->getData(['page',$parentId,'hideMenuSide']) === true || ( $this->getData(['page',$parentId,'disable']) && (empty($childIds) || $disableChild === $totalChild) && $groupUser < 2 ) ) {
|
||||
continue;
|
||||
}
|
||||
$items .= ' <li>';
|
||||
if ($this->getData(['page', $parentId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
|
||||
$pageUrl = ($parentId !== $this->getData(['locale', 'homePageId'])) ? helper::baseUrl() . $parentId : helper::baseUrl(false);
|
||||
|
@ -66,17 +81,21 @@ class sitemap extends common
|
|||
}
|
||||
|
||||
foreach ($childIds as $childId) {
|
||||
$items .= '<ul>';
|
||||
// Sous-page
|
||||
$items .= ' <li>';
|
||||
if ($this->getData(['page', $childId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
|
||||
$pageUrl = ($childId !== $this->getData(['locale', 'homePageId'])) ? helper::baseUrl() . $childId : helper::baseUrl(false) ;
|
||||
$items .= '<a href="' . $pageUrl . '">' . $this->getData(['page', $childId, 'title']) . '</a>';
|
||||
} else {
|
||||
// page désactivée
|
||||
$items .= $this->getData(['page', $childId, 'title']);
|
||||
}
|
||||
$items .= '</li>';
|
||||
// Passer les sous-pages masquées ou désactivées si client < éditeur
|
||||
if ($this->getData(['page',$childId,'hideMenuSide']) === true || ( $this->getData(['page',$childId,'disable']) === true && $groupUser < 2)) {
|
||||
continue;
|
||||
}
|
||||
$items .= '<ul>';
|
||||
// Sous-page
|
||||
$items .= ' <li>';
|
||||
if ($this->getData(['page', $childId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
|
||||
$pageUrl = ($childId !== $this->getData(['locale', 'homePageId'])) ? helper::baseUrl() . $childId : helper::baseUrl(false) ;
|
||||
$items .= '<a href="' . $pageUrl . '">' . $this->getData(['page', $childId, 'title']) . '</a>';
|
||||
} else {
|
||||
// page désactivée
|
||||
$items .= $this->getData(['page', $childId, 'title']);
|
||||
}
|
||||
$items .= '</li>';
|
||||
|
||||
// Articles d'une sous-page blog
|
||||
if ($this->getData(['page', $childId, 'moduleId']) === 'blog' &&
|
||||
|
|
Loading…
Reference in New Issue