diff --git a/core/module/sitemap/sitemap.php b/core/module/sitemap/sitemap.php
index 61f885a7..60f9a082 100644
--- a/core/module/sitemap/sitemap.php
+++ b/core/module/sitemap/sitemap.php
@@ -13,21 +13,100 @@
* @link http://zwiicms.fr/
*/
-class sitemap extends common {
+class sitemap extends common
+{
+ public static $actions = [
+ 'index' => self::GROUP_VISITOR
+ ];
- public static $actions = [
- 'index' => self::GROUP_VISITOR
- ];
+ public static $siteMap = '';
- /**
- * Plan du site
- */
- public function index() {
- // Valeurs en sortie
- $this->addOutput([
- 'title' => 'Plan du site',
- 'view' => 'index'
- ]);
- }
+ /**
+ * Plan du site
+ */
+ public function index()
+ {
+ $items = '
';
+ foreach ($this->getHierarchy(null, true, null) as $parentId => $childIds) {
+ $items .= '- ';
+ if ($this->getData(['page', $parentId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
+ $items .= '' .$this->getData(['page', $parentId, 'title']) . '';
+ // $items .= '<';
+ } else {
+ // page désactivée
+ $items .= $this->getData(['page', $parentId, 'title']);
+ }
+
+ // ou articles d'un blog
+ if ($this->getData(['page', $parentId, 'moduleId']) === 'blog' &&
+ !empty($this->getData(['module',$parentId, 'posts' ]))) {
+ $items .= '
';
+ // Ids des articles par ordre de publication
+ $articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $parentId,'posts']), 'publishedOn', 'SORT_DESC');
+ $articleIdsStates = helper::arrayCollumn($this->getData(['module', $parentId, 'posts']), 'state', 'SORT_DESC');
+ $articleIds = [];
+ foreach ($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
+ if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) {
+ $articleIds[] = $articleId;
+ }
+ }
+ foreach ($articleIds as $articleId => $article) {
+ if ($this->getData(['module',$parentId,'posts',$article,'state']) === true) {
+ $items .= '- ';
+ $items .= '' . $this->getData(['module',$parentId,'posts',$article,'title']) . '';
+ $items .= '
';
+ }
+ }
+ $items .= '
';
+ }
+
+ foreach ($childIds as $childId) {
+ $items .= '';
+ // Sous-page
+ $items .= '- ';
+ if ($this->getData(['page', $childId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
+ $items .= '' . $this->getData(['page', $childId, 'title']) . '';
+ } else {
+ // page désactivée
+ $items .= $this->getData(['page', $childId, 'title']);
+ }
+ $items .= '
';
-}
\ No newline at end of file
+
+ // Articles d'une sous-page blog
+ if ($this->getData(['page', $childId, 'moduleId']) === 'blog' &&
+ !empty($this->getData(['module', $childId, 'posts' ]))) {
+ $items .= '';
+ // Ids des articles par ordre de publication
+ $articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $childId,'posts']), 'publishedOn', 'SORT_DESC');
+ $articleIdsStates = helper::arrayCollumn($this->getData(['module', $childId, 'posts']), 'state', 'SORT_DESC');
+ $articleIds = [];
+ foreach ($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
+ if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) {
+ $articleIds[] = $articleId;
+ }
+ }
+ foreach ($articleIds as $articleId => $article) {
+ if ($this->getData(['module',$childId,'posts',$article,'state']) === true) {
+ $items .= '- ';
+ $items .= '' . $this->getData(['module',$childId,'posts',$article,'title']) . '';
+ $items .= '
';
+ }
+ }
+ $items .= '
';
+ }
+ $items .= '
';
+ // Fin du grand bloc
+ $items .= '
';
+ }
+ }
+
+ self::$siteMap = $items;
+
+ // Valeurs en sortie
+ $this->addOutput([
+ 'title' => 'Plan du site',
+ 'view' => 'index'
+ ]);
+ }
+}
diff --git a/core/module/sitemap/view/index/index.css b/core/module/sitemap/view/index/index.css
index 05c72d6a..b796d68a 100755
--- a/core/module/sitemap/view/index/index.css
+++ b/core/module/sitemap/view/index/index.css
@@ -12,6 +12,17 @@
* @link http://zwiicms.fr/
*/
- ul {
- list-style-type: circle;
- }
\ No newline at end of file
+ #siteMap ul {
+ list-style: none ;
+ margin-left: .5em;
+ padding-left: 1em;
+ line-height: 1.5em;
+ }
+
+.pageIcon li::before {
+ content: "📄 ";
+}
+
+.articleIcon li::before {
+ content: "📝 ";
+}
\ No newline at end of file
diff --git a/core/module/sitemap/view/index/index.php b/core/module/sitemap/view/index/index.php
index e8a9fd9d..faed1382 100644
--- a/core/module/sitemap/view/index/index.php
+++ b/core/module/sitemap/view/index/index.php
@@ -1,76 +1,4 @@
-
- getHierarchy(null,true,null) as $parentId => $childIds): ?>
- -
- getData(['page', $parentId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group']))
- { ?>
- getData(['locale', 'homePageId'])) ? helper::baseUrl() . $parentId : helper::baseUrl(false) ; ?>
- getData(['page', $parentId, 'title']); ?>
- getData(['page', $parentId, 'title']);
- } ?>
-
-
- -
-
- getData(['page', $childId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group']))
- { ?>
- getData(['locale', 'homePageId'])) ? helper::baseUrl() . $childId : helper::baseUrl(false) ; ?>
- getData(['page', $childId, 'title']); ?>
-
-
- getData(['page', $childId, 'title']); }?>
-
-
-
- getData(['page', $childId, 'moduleId']) === 'blog' &&
- !empty($this->getData(['module', $childId, 'posts' ])) ) { ?>
- getData(['module', $childId,'posts']), 'publishedOn', 'SORT_DESC');
- $articleIdsStates = helper::arrayCollumn($this->getData(['module', $childId, 'posts']), 'state', 'SORT_DESC');
- $articleIds = [];
- foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
- if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {
- $articleIds[] = $articleId;
- }
- }
- foreach($articleIds as $articleId => $article): ?>
- getData(['module',$childId,'posts',$article,'state']) === true) {?>
- -
- getData(['module',$childId,'posts',$article,'title']); ?>
-
-
-
-
-
-
-
-
- getData(['page', $parentId, 'moduleId']) === 'blog' &&
- !empty($this->getData(['module',$parentId, 'posts' ])) ) { ?>
- getData(['module', $parentId,'posts']), 'publishedOn', 'SORT_DESC');
- $articleIdsStates = helper::arrayCollumn($this->getData(['module', $parentId, 'posts']), 'state', 'SORT_DESC');
- $articleIds = [];
- foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
- if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {
- $articleIds[] = $articleId;
- }
- }
- foreach($articleIds as $articleId => $article): ?>
- getData(['module',$parentId,'posts',$article,'state']) === true ): ?>
- -
- getData(['module',$parentId,'posts',$article,'title']); ?>
-
-
-
-
-
-
-
\ No newline at end of file
+";
+ echo $module::$siteMap;
+ echo "";