diff --git a/bl-kernel/abstract/dblist.class.php b/bl-kernel/abstract/dblist.class.php index 8af914f1..6b55cc18 100644 --- a/bl-kernel/abstract/dblist.class.php +++ b/bl-kernel/abstract/dblist.class.php @@ -34,6 +34,7 @@ class dbList extends dbJSON } // Returns the list of keys filter by pageNumber + // $pageNumber start in 1 public function getList($key, $pageNumber, $numberOfItems) { if (!isset($this->db[$key])) { diff --git a/bl-kernel/admin/themes/gris b/bl-kernel/admin/themes/gris index 372403e6..09138280 160000 --- a/bl-kernel/admin/themes/gris +++ b/bl-kernel/admin/themes/gris @@ -1 +1 @@ -Subproject commit 372403e6a9e33f57ccd4f57ad35007248440220e +Subproject commit 09138280134ec8014982f260c1ebb6a5b0091fdc diff --git a/bl-kernel/pagex.class.php b/bl-kernel/pagex.class.php index d7b5cc45..7b4733e3 100644 --- a/bl-kernel/pagex.class.php +++ b/bl-kernel/pagex.class.php @@ -265,6 +265,8 @@ class Page { return implode(',', $tags); } + + public function json($returnsArray=false) { $tmp['key'] = $this->key(); @@ -582,4 +584,27 @@ class Page { } return false; } + + // Returns an array with all pages key related to the page + // The relation is based on the tags + public function related() { + global $tags; + $pageTags = $this->tags(true); + $list = array(); + // For each tag get the list of related pages + foreach ($pageTags as $tagKey=>$tagName) { + $pagesRelated = $tags->getList($tagKey, 1, -1); + $list = array_merge($list, $pagesRelated); + } + + // Remove duplicates + $list = array_unique($list); + + // Remove himself from the list + if (($key = array_search($this->key(), $list)) !== false) { + unset($list[$key]); + } + + return $list; + } }