menuRight

This commit is contained in:
Prof Langues 2020-10-13 11:04:30 +02:00
parent d0827ca3e7
commit aa7a0926c4
2 changed files with 55 additions and 33 deletions

View File

@ -2338,7 +2338,7 @@ class layout extends common {
*/ */
public function showMenu() { public function showMenu() {
// Met en forme les items du menu // Met en forme les items du menu
$items = ''; $itemsLeft = '';
$currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2); $currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2);
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) { foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
// Passer les entrées masquées // Passer les entrées masquées
@ -2346,36 +2346,36 @@ class layout extends common {
$active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : ''; $active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : '';
$targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : ''; $targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page de l'item // Mise en page de l'item
$items .= '<li>'; $itemsLeft .= '<li>';
if ( $this->getData(['page',$parentPageId,'disable']) === true if ( $this->getData(['page',$parentPageId,'disable']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') ) AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') )
{$items .= '<a class="' . $parentPageId . '" href="'.$this->getUrl(1).'">'; {$itemsLeft .= '<a class="' . $parentPageId . '" href="'.$this->getUrl(1).'">';
} else { } else {
$items .= '<a class="' . $active . $parentPageId . '" href="' . helper::baseUrl() . $parentPageId . '"' . $targetBlank . '>'; $itemsLeft .= '<a class="' . $active . $parentPageId . '" href="' . helper::baseUrl() . $parentPageId . '"' . $targetBlank . '>';
} }
switch ($this->getData(['page', $parentPageId, 'typeMenu'])) { switch ($this->getData(['page', $parentPageId, 'typeMenu'])) {
case '' : case '' :
$items .= $this->getData(['page', $parentPageId, 'title']); $itemsLeft .= $this->getData(['page', $parentPageId, 'title']);
break; break;
case 'text' : case 'text' :
$items .= $this->getData(['page', $parentPageId, 'title']); $itemsLeft .= $this->getData(['page', $parentPageId, 'title']);
break; break;
case 'icon' : case 'icon' :
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" />'; $itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" />';
} else { } else {
$items .= $this->getData(['page', $parentPageId, 'title']); $itemsLeft .= $this->getData(['page', $parentPageId, 'title']);
} }
break; break;
case 'icontitle' : case 'icontitle' :
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" data-tippy-content="'; $itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" data-tippy-content="';
$items .= $this->getData(['page', $parentPageId, 'title']).'"/>'; $itemsLeft .= $this->getData(['page', $parentPageId, 'title']).'"/>';
} else { } else {
$items .= $this->getData(['page', $parentPageId, 'title']); $itemsLeft .= $this->getData(['page', $parentPageId, 'title']);
} }
break; break;
} }
@ -2388,64 +2388,65 @@ class layout extends common {
} }
if($childrenPageIds && $disableChild !== $totalChild && if($childrenPageIds && $disableChild !== $totalChild &&
$this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) { $this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) {
$items .= template::ico('down', 'left'); $itemsLeft .= template::ico('down', 'left');
} }
// ------------------------------------------------ // ------------------------------------------------
$items .= '</a>'; $itemsLeft .= '</a>';
if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true || if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true ||
empty($childrenPageIds)) { empty($childrenPageIds)) {
continue; continue;
} }
$items .= '<ul class="navLevel2">'; $itemsLeft .= '<ul class="navLevel2">';
foreach($childrenPageIds as $childKey) { foreach($childrenPageIds as $childKey) {
// Propriétés de l'item // Propriétés de l'item
$active = ($childKey === $currentPageId) ? 'active ' : ''; $active = ($childKey === $currentPageId) ? 'active ' : '';
$targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : ''; $targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page du sous-item // Mise en page du sous-item
$items .= '<li>'; $itemsLeft .= '<li>';
if ( $this->getData(['page',$childKey,'disable']) === true if ( $this->getData(['page',$childKey,'disable']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') ) { AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') ) {
$items .= '<a class="' . $parentPageId . '" href="'.$this->getUrl(1).'">'; $itemsLeft .= '<a class="' . $parentPageId . '" href="'.$this->getUrl(1).'">';
} else { } else {
$items .= '<a class="' . $active . $parentPageId . '" href="' . helper::baseUrl() . $childKey . '"' . $targetBlank . '>'; $itemsLeft .= '<a class="' . $active . $parentPageId . '" href="' . helper::baseUrl() . $childKey . '"' . $targetBlank . '>';
} }
switch ($this->getData(['page', $childKey, 'typeMenu'])) { switch ($this->getData(['page', $childKey, 'typeMenu'])) {
case '' : case '' :
$items .= $this->getData(['page', $childKey, 'title']); $itemsLeft .= $this->getData(['page', $childKey, 'title']);
break; break;
case 'text' : case 'text' :
$items .= $this->getData(['page', $childKey, 'title']); $itemsLeft .= $this->getData(['page', $childKey, 'title']);
break; break;
case 'icon' : case 'icon' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") { if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />'; $itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
} else { } else {
$items .= $this->getData(['page', $parentPageId, 'title']); $itemsLeft .= $this->getData(['page', $parentPageId, 'title']);
} }
break; break;
case 'icontitle' : case 'icontitle' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") { if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" data-tippy-content="'; $itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" data-tippy-content="';
$items .= $this->getData(['page', $childKey, 'title']).'"/>'; $itemsLeft .= $this->getData(['page', $childKey, 'title']).'"/>';
} else { } else {
$items .= $this->getData(['page', $childKey, 'title']); $itemsLeft .= $this->getData(['page', $childKey, 'title']);
} }
break; break;
case 'icontext' : case 'icontext' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") { if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />'; $itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
$items .= $this->getData(['page', $childKey, 'title']); $itemsLeft .= $this->getData(['page', $childKey, 'title']);
} else { } else {
$items .= $this->getData(['page', $childKey, 'title']); $itemsLeft .= $this->getData(['page', $childKey, 'title']);
} }
break; break;
} }
$items .= '</a></li>'; $itemsLeft .= '</a></li>';
} }
$items .= '</ul>'; $itemsLeft .= '</ul>';
} }
// Lien de connexion // Lien de connexion
$itemsRight = '';
if( if(
( (
$this->getData(['theme', 'menu', 'loginLink']) $this->getData(['theme', 'menu', 'loginLink'])
@ -2453,7 +2454,7 @@ class layout extends common {
) )
OR $this->getUrl(0) === 'theme' OR $this->getUrl(0) === 'theme'
) { ) {
$items .= '<li id="menuLoginLink" ' . $itemsRight .= '<li id="menuLoginLink" ' .
($this->getUrl(0) === 'theme' ? 'class="displayNone"' : '') . ($this->getUrl(0) === 'theme' ? 'class="displayNone"' : '') .
'><a href="' . helper::baseUrl() . 'user/login/' . '><a href="' . helper::baseUrl() . 'user/login/' .
strip_tags(str_replace('/', '_', $this->getUrl())) . strip_tags(str_replace('/', '_', $this->getUrl())) .
@ -2465,11 +2466,11 @@ class layout extends common {
|| $this->getData(['theme','footer','displayMemberBar']) === false || $this->getData(['theme','footer','displayMemberBar']) === false
) )
) { ) {
$items .= '<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 href="' . helper::baseUrl() . 'user/edit/' . $this->getUser('id'). '/' . $_SESSION['csrf'] . '" data-tippy-content="Gérer mon compte">' . template::ico('user', 'right') . '</a></li>';
$items .= '<li><a id="barLogout" href="' . helper::baseUrl() . 'user/logout" data-tippy-content="Me déconnecter">' . template::ico('logout') . '</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 // Retourne les items du menu
echo '<ul class="navLevel1">' . $items . '</ul>'; echo '<ul class="navLevel1" id="menuLeft">' . $itemsLeft . '</ul><ul id="menuRight">' . $itemsRight . '</ul>';
} }
/** /**

View File

@ -518,6 +518,26 @@ nav a {
transition: background .3s ease-out; transition: background .3s ease-out;
} }
nav #menuLeft {
float: left;
}
nav #menuRight {
float: right;
font-size: 12px;
}
/* fin barre de menu */
nav::after {
content: " ";
clear: both;
display: flex;
}
nav::before {
content: " ";
clear: left;
display: flex;
}
nav a:hover { nav a:hover {
text-decoration: none; text-decoration: none;
} }
@ -1393,3 +1413,4 @@ th.col12 {
-o-transform:scale(1.25); /* Opera */ -o-transform:scale(1.25); /* Opera */
transform:scale(1.25); transform:scale(1.25);
} }