[10.0.58.dev] homepage ok

This commit is contained in:
fredtempez 2019-10-31 22:36:18 +01:00
parent 85b4b178ca
commit 755db23dd0
2 changed files with 20 additions and 8 deletions

View File

@ -31,7 +31,7 @@ class common {
const TEMP_DIR = 'site/tmp/';
// Numéro de version
const ZWII_VERSION = '10.0.57.dev';
const ZWII_VERSION = '10.0.58.dev';
public static $actions = [];
public static $coreModuleIds = [
@ -483,7 +483,6 @@ class common {
* @return string
*/
public function getHomePageId () {
$hierarchy = $this->getHierarchy(null, true);
foreach($this->getHierarchy(null, null, null) as $parentPageId => $childrenPageIds) {
if ($this->getData(['page',$parentPageId,"homePageId"]) === true) {
return ($parentPageId);
@ -496,6 +495,24 @@ class common {
}
}
/**
* Retourne l'Id de la homePage de la langue courante
* @return string
*/
public function resetHomePageId () {
foreach($this->getHierarchy(null, null, null) as $parentPageId => $childrenPageIds) {
if ($this->getData(['page',$parentPageId,"homePageId"]) === true) {
$this->setData(['page',$parentPageId,"homePageId", false]);
}
foreach($childrenPageIds as $childKey) {
if ($this->getData(['page',$childKey,"homePageId"]) === true) {
$this->setData(['page',$childKey,"homePageId", false]);
}
}
}
}
/**
* Accède à une valeur des variables http (ordre de recherche en l'absence de type : _COOKIE, _POST)
* @param string $key Clé de la valeur

View File

@ -241,12 +241,7 @@ class page extends common {
}
// Reset homePage
if ($this->getinput('pageHomePageId', helper::FILTER_BOOLEAN) === true ) {
foreach ($hierarchy as $hierarchyPageId) {
$this->setData(['page',$hierarchyPageId,"homePageId", false]);
foreach ($hierarchyPageId as $childId) {
$this->setData(['page',$childId,"homePageId", false]);
}
}
$this->resetHomePageId();
}
// Modifie la page ou en crée une nouvelle si l'id a changé
$this->setData([