Browse Source

extraPosition manquante

12_dev
Fred Tempez 4 months ago
parent
commit
a3651b189f
  1. 135
      core/core.php

135
core/core.php

@ -1675,10 +1675,53 @@ class common {
*/
public function showMenu() {
// Met en forme les items du menu
$itemsLeft = '';
$itemsLeft = $this->formatMenu(false);
// Menu extra
$itemsRight = $this->formatMenu(true);
// Lien de connexion
if(
(
$this->getData(['theme', 'menu', 'loginLink'])
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
)
OR $this->getUrl(0) === 'theme'
) {
$itemsRight .= '<li id="menuLoginLink" ' .
($this->getUrl(0) === 'theme' ? 'class="displayNone"' : '') .
'><a href="' . helper::baseUrl() . 'user/login/' .
strip_tags(str_replace('/', '_', $this->getUrl())) .
'">' . template::ico('login') .'</a></li>';
}
// Commandes pour les membres simples
if($this->getUser('group') == self::GROUP_MEMBER
&& ( $this->getData(['theme','menu','memberBar']) === true
|| $this->getData(['theme','footer','displayMemberBar']) === false
)
) {
if( $this->getData(['user', $this->getUser('id') , 'files']) === true) $itemsRight .= '<li><a href="' . helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json') .'" data-tippy-content="Gérer les fichiers" data-lity>' . template::ico('folder') . '</a></li>';
$itemsRight .= '<li><a href="' . helper::baseUrl() . 'user/edit/' . $this->getUser('id'). '/' . $_SESSION['csrf'] . '" data-tippy-content="Gérer mon compte">' . template::ico('user', 'right') . '</a></li>';
$itemsRight .= '<li><a id="barLogout" href="' . helper::baseUrl() . 'user/logout" data-tippy-content="Me déconnecter">' . template::ico('logout') . '</a></li>';
}
// Retourne les items du menu
echo '<ul class="navMain" id="menuLeft">' . $itemsLeft . '</ul><ul class="navMain" id="menuRight">' . $itemsRight;
if ($this->getData(['config', 'i18n', 'enable']) === true) {
echo $this->showi18n();
}
echo '</ul>';
}
/**
* Cette fonction est appelée par showMenu
* Elle permet de générer le menu selon qu'il s'agisse du menu principal ou du petit menu
* @param $menu bool false pour le menu principal, true pour le petit menu
*/
private function formatMenu($extra = false) {
$items = '';
$currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2);
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
// Menu extra ou standard
if (
// Absence de la position extra, la page est toujours affichée à gauche.
($this->getData(['page',$parentPageId,'extraPosition']) !== NULL || $extra === true)
@ -1690,7 +1733,7 @@ class common {
$active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : '';
$targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page de l'item
$itemsLeft .= '<li id="' . $parentPageId .'">';
$items .= '<li id="' . $parentPageId .'">';
if ( ( $this->getData(['page',$parentPageId,'disable']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
@ -1701,32 +1744,32 @@ class common {
)
){
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
$itemsLeft .= '<a id="' . $parentPageId . '" href="' . $pageUrl . '">';
$items .= '<a id="' . $parentPageId . '" href="' . $pageUrl . '">';
} else {
$pageUrl = ($this->getData(['locale', 'homePageId']) === $parentPageId) ? helper::baseUrl(false) : helper::baseUrl() . $parentPageId;
$itemsLeft .= '<a class="' . $active . '" id="' . $parentPageId . '" href="' . $pageUrl . '"' . $targetBlank . '>';
$items .= '<a class="' . $active . '" id="' . $parentPageId . '" href="' . $pageUrl . '"' . $targetBlank . '>';
}
switch ($this->getData(['page', $parentPageId, 'typeMenu'])) {
case '' :
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
break;
case 'text' :
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
break;
case 'icon' :
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" />';
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" />';
} else {
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
case 'icontitle' :
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'titlshortTitlee']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" data-tippy-content="';
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']).'"/>';
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'titlshortTitlee']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" data-tippy-content="';
$items .= $this->getData(['page', $parentPageId, 'shortTitle']).'"/>';
} else {
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
}
@ -1739,21 +1782,21 @@ class common {
}
if($childrenPageIds && $disableChild !== $totalChild &&
$this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) {
$itemsLeft .= template::ico('down', 'left');
$items .= template::ico('down', 'left');
}
// ------------------------------------------------
$itemsLeft .= '</a>';
$items .= '</a>';
if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true ||
empty($childrenPageIds)) {
continue;
}
$itemsLeft .= '<ul class="navSub">';
$items .= '<ul class="navSub">';
foreach($childrenPageIds as $childKey) {
// Propriétés de l'item
$active = ($childKey === $currentPageId) ? 'active ' : '';
$targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page du sous-item
$itemsLeft .= '<li id=' . $childKey .'>';
$items .= '<li id=' . $childKey .'>';
if ( ( $this->getData(['page',$childKey,'disable']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) OR (
@ -1763,80 +1806,52 @@ class common {
)
){
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
$itemsLeft .= '<a id="' . $parentPageId . '" href="'. $pageUrl .'">';
$items .= '<a id="' . $parentPageId . '" href="'. $pageUrl .'">';
} else {
$pageUrl = ($this->getData(['locale', 'homePageId']) === $childKey) ? helper::baseUrl(false) : helper::baseUrl() . $childKey;
$itemsLeft .= '<a class="' . $active . ' ' . $parentPageId . '" id="' . $childKey . '" href="' . $pageUrl . '"' . $targetBlank . '>';
$items .= '<a class="' . $active . ' ' . $parentPageId . '" id="' . $childKey . '" href="' . $pageUrl . '"' . $targetBlank . '>';
}
switch ($this->getData(['page', $childKey, 'typeMenu'])) {
case '' :
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
$items .= $this->getData(['page', $childKey, 'shortTitle']);
break;
case 'text' :
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
$items .= $this->getData(['page', $childKey, 'shortTitle']);
break;
case 'icon' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
} else {
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
case 'icontitle' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" data-tippy-content="';
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']).'"/>';
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" data-tippy-content="';
$items .= $this->getData(['page', $childKey, 'shortTitle']).'"/>';
} else {
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
$items .= $this->getData(['page', $childKey, 'shortTitle']);
}
break;
case 'icontext' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
$items .= $this->getData(['page', $childKey, 'shortTitle']);
} else {
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
$items .= $this->getData(['page', $childKey, 'shortTitle']);
}
break;
}
$itemsLeft .= '</a></li>';
$items .= '</a></li>';
}
$itemsLeft .= '</ul>';
}
// Lien de connexion
$itemsRight = '';
if(
(
$this->getData(['theme', 'menu', 'loginLink'])
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
)
OR $this->getUrl(0) === 'theme'
) {
$itemsRight .= '<li id="menuLoginLink" ' .
($this->getUrl(0) === 'theme' ? 'class="displayNone"' : '') .
'><a href="' . helper::baseUrl() . 'user/login/' .
strip_tags(str_replace('/', '_', $this->getUrl())) .
'">' . template::ico('login') .'</a></li>';
}
// Commandes pour les membres simples
if($this->getUser('group') == self::GROUP_MEMBER
&& ( $this->getData(['theme','menu','memberBar']) === true
|| $this->getData(['theme','footer','displayMemberBar']) === false
)
) {
if( $this->getData(['user', $this->getUser('id') , 'files']) === true) $itemsRight .= '<li><a href="' . helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json') .'" data-tippy-content="Gérer les fichiers" data-lity>' . template::ico('folder') . '</a></li>';
$itemsRight .= '<li><a href="' . helper::baseUrl() . 'user/edit/' . $this->getUser('id'). '/' . $_SESSION['csrf'] . '" data-tippy-content="Gérer mon compte">' . template::ico('user', 'right') . '</a></li>';
$itemsRight .= '<li><a id="barLogout" href="' . helper::baseUrl() . 'user/logout" data-tippy-content="Me déconnecter">' . template::ico('logout') . '</a></li>';
}
// Retourne les items du menu
echo '<ul class="navMain" id="menuLeft">' . $itemsLeft . '</ul><ul class="navMain" id="menuRight">' . $itemsRight;
if ($this->getData(['config', 'i18n', 'enable']) === true) {
echo $this->showi18n();
$items .= '</ul>';
}
echo '</ul>';
return($items);
}
/**
* Générer un menu pour la barre latérale
* Uniquement texte

Loading…
Cancel
Save