openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 53eaec840a9e18aa3e7f0b4de7851e1f5b9b781c
parent 377ea4a7e1adc40108f8201c64f9b44124023373
Author: Jan Dankert <devnull@localhost>
Date:   Tue, 11 Dec 2018 00:57:29 +0100

Fix: Suchindex beinhaltet jetzt auch den Titel und ist nun ein JSON-Array.

Diffstat:
modules/cms-core/model/BaseObject.class.php | 14++++++++++++--
modules/cms-core/model/Name.class.php | 14+++++++-------
modules/cms-macros/macro/SearchIndex.class.php | 13++++++++++---
3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/modules/cms-core/model/BaseObject.class.php b/modules/cms-core/model/BaseObject.class.php @@ -589,7 +589,8 @@ SQL if ( intval($this->parentid) == 0 ) $this->isRoot = true; - else $this->isRoot = false; + else + $this->isRoot = false; $this->createDate = $row['create_date' ]; $this->lastchangeDate = $row['lastchange_date']; @@ -1457,9 +1458,18 @@ SQL { $languageId = $this->getProject()->getDefaultLanguageId(); + return $this->getNameForLanguage( $languageId ); + } + + + /** + * @return Name + */ + public function getNameForLanguage( $languageid ) + { $name = new Name(); $name->objectid = $this->objectid; - $name->languageid = $languageId; + $name->languageid = $languageid; $name->load(); return $name; diff --git a/modules/cms-core/model/Name.class.php b/modules/cms-core/model/Name.class.php @@ -18,6 +18,13 @@ namespace cms\model { public $objectid; + /** Sprach-ID + * @see Language + * @type Integer + */ + public $languageid; + + /** Logischer (sprachabhaengiger) Name des Objektes * (wird in Tabelle <code>name</code> abgelegt) * @type String @@ -29,13 +36,6 @@ namespace cms\model { * @type String */ public $description; - - /** Sprach-ID - * @see Language - * @type Integer - */ - public $languageid; - /** <strong>Konstruktor</strong> * * @param Integer Objekt-ID diff --git a/modules/cms-macros/macro/SearchIndex.class.php b/modules/cms-macros/macro/SearchIndex.class.php @@ -1,6 +1,7 @@ <?php use cms\model\Folder; +use cms\model\Name; use cms\model\Page; use cms\model\Project; use cms\publish\PublishEdit; @@ -43,9 +44,15 @@ class SearchIndex extends Macro $page->publisher = new PublishEdit(); $page->load(); $page->generate(); - $searchIndex[ $pageid ] = array( - 'url' => $this->page->path_to_object( $pageid ), - 'content'=> array_reduce( + + $name = $page->getNameForLanguage( $this->page->languageid ); + + $searchIndex[] = array( + 'id' => $pageid, + 'title' => $name->name, + 'filename'=> $page->filename, + 'url' => $this->page->path_to_object( $pageid ), + 'content' => array_reduce( $page->values, function($act, $value) {