search 2.7 initialisaiton
This commit is contained in:
parent
a6a37a4fc8
commit
29d46887e9
@ -1,5 +1,6 @@
|
||||
# Version 2.7
|
||||
- Traduction
|
||||
- Suppression du cadre de présentation des résultats
|
||||
- Initialisation du module
|
||||
# Version 2.6
|
||||
- Chargement de la feuille de style si présente
|
@ -17,7 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class search extends common {
|
||||
class search extends common
|
||||
{
|
||||
|
||||
const VERSION = '2.7';
|
||||
const REALNAME = 'Recherche';
|
||||
@ -48,16 +49,21 @@ class search extends common {
|
||||
* Mise à jour du module
|
||||
* Appelée par les fonctions index et config
|
||||
*/
|
||||
private function update() {
|
||||
private function update()
|
||||
{
|
||||
|
||||
|
||||
$versionData = $this->getData(['module',$this->getUrl(0),'config', 'versionData' ]);
|
||||
|
||||
// le module n'est pas initialisé
|
||||
if ($versionData === NULL) {
|
||||
if (
|
||||
$this->getData(['module', $this->getUrl(0), 'config']) === NULL
|
||||
|| $this->getData(['module', $this->getUrl(0), 'theme']) === NULL
|
||||
|| !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')
|
||||
) {
|
||||
$this->init();
|
||||
}
|
||||
|
||||
$versionData = $this->getData(['module', $this->getUrl(0), 'config', 'versionData']);
|
||||
|
||||
// Mise à jour 2.2
|
||||
if (version_compare($versionData, '2.2', '<')) {
|
||||
if (is_dir(self::DATADIRECTORY . 'pages/')) {
|
||||
@ -73,7 +79,8 @@ class search extends common {
|
||||
/**
|
||||
* Initialisation du module
|
||||
*/
|
||||
private function init(){
|
||||
private function init()
|
||||
{
|
||||
|
||||
|
||||
$fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css';
|
||||
@ -103,12 +110,12 @@ class search extends common {
|
||||
// Stocker le nom de la feuille de style
|
||||
$this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Configuration vide
|
||||
public function config() {
|
||||
public function config()
|
||||
{
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
@ -141,7 +148,6 @@ class search extends common {
|
||||
'notification' => $success !== FALSE ? 'Modifications enregistrées' : 'Modifications non enregistrées !',
|
||||
'state' => $success !== FALSE
|
||||
]);
|
||||
|
||||
}
|
||||
// Valeurs en sortie, affichage du formulaire
|
||||
$this->addOutput([
|
||||
@ -153,7 +159,8 @@ class search extends common {
|
||||
]);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
@ -184,9 +191,11 @@ class search extends common {
|
||||
|
||||
if ($motclef !== '') {
|
||||
foreach ($this->getHierarchy(null, false, null) as $parentId => $childIds) {
|
||||
if ($this->getData(['page', $parentId, 'disable']) === false &&
|
||||
if (
|
||||
$this->getData(['page', $parentId, 'disable']) === false &&
|
||||
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
|
||||
$this->getData(['page', $parentId, 'block']) !== 'bar') {
|
||||
$this->getData(['page', $parentId, 'block']) !== 'bar'
|
||||
) {
|
||||
$url = $parentId;
|
||||
$titre = $this->getData(['page', $parentId, 'title']);
|
||||
//$content = file_get_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getData(['page', $parentId, 'content']));
|
||||
@ -201,9 +210,11 @@ class search extends common {
|
||||
|
||||
foreach ($childIds as $childId) {
|
||||
// Sous page
|
||||
if ($this->getData(['page', $childId, 'disable']) === false &&
|
||||
if (
|
||||
$this->getData(['page', $childId, 'disable']) === false &&
|
||||
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
|
||||
$this->getData(['page', $parentId, 'block']) !== 'bar') {
|
||||
$this->getData(['page', $parentId, 'block']) !== 'bar'
|
||||
) {
|
||||
$url = $childId;
|
||||
$titre = $this->getData(['page', $childId, 'title']);
|
||||
//$content = file_get_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getData(['page', $childId, 'content']));
|
||||
@ -217,8 +228,7 @@ class search extends common {
|
||||
}
|
||||
|
||||
// Articles d'une sous-page blog ou de news
|
||||
if ( $this->getData([ 'module', $childId, 'posts'])
|
||||
) {
|
||||
if ($this->getData(['module', $childId, 'posts'])) {
|
||||
foreach ($this->getData(['module', $childId, 'posts']) as $articleId => $article) {
|
||||
if ($this->getData(['module', $childId, 'posts', $articleId, 'state']) === true) {
|
||||
$url = $childId . '/' . $articleId;
|
||||
@ -235,12 +245,10 @@ class search extends common {
|
||||
}
|
||||
|
||||
// Articles d'un blog ou de news
|
||||
if ( $this->getData([ 'module', $parentId, 'posts'])
|
||||
) {
|
||||
if ($this->getData(['module', $parentId, 'posts'])) {
|
||||
|
||||
foreach ($this->getData(['module', $parentId, 'posts']) as $articleId => $article) {
|
||||
if($this->getData(['module',$parentId,'posts',$articleId,'state']) === true)
|
||||
{
|
||||
if ($this->getData(['module', $parentId, 'posts', $articleId, 'state']) === true) {
|
||||
$url = $parentId . '/' . $articleId;
|
||||
$titre = $article['title'];
|
||||
$contenu = ' ' . $titre . ' ' . $article['content'];
|
||||
@ -336,5 +344,4 @@ class search extends common {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user