wip
This commit is contained in:
parent
cfdd9d11ea
commit
309de4c823
core
@ -495,9 +495,11 @@ class layout extends common
|
||||
*/
|
||||
public function showMenu()
|
||||
{
|
||||
// Met en forme les items du menu
|
||||
$itemsLeft = $this->formatMenu();
|
||||
|
||||
// Met en forme les items du menu si affiché
|
||||
$itemsLeft = '';
|
||||
if ($this->getData(['theme', 'menu', 'hidePages'])) {
|
||||
$itemsLeft = $this->formatMenu();
|
||||
}
|
||||
// Menu extra
|
||||
$itemsRight = $this->formatMenu(true);
|
||||
|
||||
@ -527,7 +529,7 @@ class layout extends common
|
||||
$this->getData(['theme', 'menu', 'userReport']) === true
|
||||
&& self::$siteContent !== 'home'
|
||||
// Pas de statistiques pour les espaces ouverts
|
||||
&& $this->getData(['course', self::$siteContent, 'enrolment']) >= 1
|
||||
&& $this->getData(['course', self::$siteContent, 'enrolment']) >= 1
|
||||
) {
|
||||
$href = '';
|
||||
switch ($this->getUser('group')) {
|
||||
@ -624,35 +626,94 @@ class layout extends common
|
||||
{
|
||||
$items = '';
|
||||
$currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2);
|
||||
// La liste des pages n'est générée si le thème ne l'autorise pas sauf pour la page home.
|
||||
if (
|
||||
self::$siteContent === 'home'
|
||||
|| (
|
||||
self::$siteContent !== 'home'
|
||||
&& $this->getData(['theme', 'menu', 'hidePages']) === true
|
||||
)
|
||||
) {
|
||||
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)
|
||||
&&
|
||||
$this->getData(['page', $parentPageId, 'extraPosition']) !== $extra
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
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)
|
||||
&&
|
||||
$this->getData(['page', $parentPageId, 'extraPosition']) !== $extra
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
// Propriétés de l'item
|
||||
$active = ($parentPageId === $currentPageId or in_array($currentPageId, $childrenPageIds)) ? 'active ' : '';
|
||||
$targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : '';
|
||||
// Mise en page de l'item
|
||||
$items .= '<li id="' . $parentPageId . '">';
|
||||
|
||||
if (
|
||||
($this->getData(['page', $parentPageId, 'disable']) === true
|
||||
and $this->isConnected() === false
|
||||
) or ($this->getData(['page', $parentPageId, 'disable']) === true
|
||||
and $this->isConnected() === true
|
||||
and $this->getUser('group') < self::GROUP_EDITOR
|
||||
)
|
||||
) {
|
||||
$pageUrl = ($this->getData(['config', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
|
||||
$items .= '<a href="' . $pageUrl . '">';
|
||||
} else {
|
||||
$pageUrl = ($this->getData(['config', 'homePageId']) === $parentPageId) ? helper::baseUrl(false) : helper::baseUrl() . $parentPageId;
|
||||
$items .= '<a class="' . $active . '" href="' . $pageUrl . '"' . $targetBlank . '>';
|
||||
}
|
||||
|
||||
switch ($this->getData(['page', $parentPageId, 'typeMenu'])) {
|
||||
case '':
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
break;
|
||||
case 'text':
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
break;
|
||||
case 'icon':
|
||||
if ($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 {
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
}
|
||||
break;
|
||||
case 'icontitle':
|
||||
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
|
||||
$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 {
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Cas où les pages enfants enfant sont toutes masquées dans le menu
|
||||
// ne pas afficher de symbole lorsqu'il n'y a rien à afficher
|
||||
$totalChild = 0;
|
||||
$disableChild = 0;
|
||||
foreach ($childrenPageIds as $childKey) {
|
||||
$totalChild += 1;
|
||||
}
|
||||
if (
|
||||
$childrenPageIds && $disableChild !== $totalChild &&
|
||||
$this->getdata(['page', $parentPageId, 'hideMenuChildren']) === false
|
||||
) {
|
||||
$items .= template::ico('down', ['margin' => 'left']);
|
||||
}
|
||||
// ------------------------------------------------
|
||||
$items .= '</a>';
|
||||
if (
|
||||
$this->getdata(['page', $parentPageId, 'hideMenuChildren']) === true ||
|
||||
empty($childrenPageIds)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$items .= '<ul class="navSub">';
|
||||
foreach ($childrenPageIds as $childKey) {
|
||||
// Propriétés de l'item
|
||||
$active = ($parentPageId === $currentPageId or in_array($currentPageId, $childrenPageIds)) ? 'active ' : '';
|
||||
$targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : '';
|
||||
// Mise en page de l'item
|
||||
$items .= '<li id="' . $parentPageId . '">';
|
||||
|
||||
$active = ($childKey === $currentPageId) ? 'active ' : '';
|
||||
$targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : '';
|
||||
// Mise en page du sous-item
|
||||
$items .= '<li id=' . $childKey . '>';
|
||||
if (
|
||||
($this->getData(['page', $parentPageId, 'disable']) === true
|
||||
($this->getData(['page', $childKey, 'disable']) === true
|
||||
and $this->isConnected() === false
|
||||
) or ($this->getData(['page', $parentPageId, 'disable']) === true
|
||||
) or ($this->getData(['page', $childKey, 'disable']) === true
|
||||
and $this->isConnected() === true
|
||||
and $this->getUser('group') < self::GROUP_EDITOR
|
||||
)
|
||||
@ -660,113 +721,45 @@ class layout extends common
|
||||
$pageUrl = ($this->getData(['config', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
|
||||
$items .= '<a href="' . $pageUrl . '">';
|
||||
} else {
|
||||
$pageUrl = ($this->getData(['config', 'homePageId']) === $parentPageId) ? helper::baseUrl(false) : helper::baseUrl() . $parentPageId;
|
||||
$items .= '<a class="' . $active . '" href="' . $pageUrl . '"' . $targetBlank . '>';
|
||||
$pageUrl = ($this->getData(['config', 'homePageId']) === $childKey) ? helper::baseUrl(false) : helper::baseUrl() . $childKey;
|
||||
$items .= '<a class="' . $active . ' ' . $parentPageId . '" href="' . $pageUrl . '"' . $targetBlank . '>';
|
||||
}
|
||||
|
||||
switch ($this->getData(['page', $parentPageId, 'typeMenu'])) {
|
||||
switch ($this->getData(['page', $childKey, 'typeMenu'])) {
|
||||
case '':
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
break;
|
||||
case 'text':
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
break;
|
||||
case 'icon':
|
||||
if ($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']) . '" />';
|
||||
if ($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 {
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
}
|
||||
break;
|
||||
case 'icontitle':
|
||||
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
|
||||
$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']) . '"/>';
|
||||
if ($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']) . '" data-tippy-content="';
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']) . '"/>';
|
||||
} else {
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
}
|
||||
break;
|
||||
case 'icontext':
|
||||
if ($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']) . '" />';
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
} else {
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Cas où les pages enfants enfant sont toutes masquées dans le menu
|
||||
// ne pas afficher de symbole lorsqu'il n'y a rien à afficher
|
||||
$totalChild = 0;
|
||||
$disableChild = 0;
|
||||
foreach ($childrenPageIds as $childKey) {
|
||||
$totalChild += 1;
|
||||
}
|
||||
if (
|
||||
$childrenPageIds && $disableChild !== $totalChild &&
|
||||
$this->getdata(['page', $parentPageId, 'hideMenuChildren']) === false
|
||||
) {
|
||||
$items .= template::ico('down', ['margin' => 'left']);
|
||||
}
|
||||
// ------------------------------------------------
|
||||
$items .= '</a>';
|
||||
if (
|
||||
$this->getdata(['page', $parentPageId, 'hideMenuChildren']) === true ||
|
||||
empty($childrenPageIds)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$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
|
||||
$items .= '<li id=' . $childKey . '>';
|
||||
if (
|
||||
($this->getData(['page', $childKey, 'disable']) === true
|
||||
and $this->isConnected() === false
|
||||
) or ($this->getData(['page', $childKey, 'disable']) === true
|
||||
and $this->isConnected() === true
|
||||
and $this->getUser('group') < self::GROUP_EDITOR
|
||||
)
|
||||
) {
|
||||
$pageUrl = ($this->getData(['config', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
|
||||
$items .= '<a href="' . $pageUrl . '">';
|
||||
} else {
|
||||
$pageUrl = ($this->getData(['config', 'homePageId']) === $childKey) ? helper::baseUrl(false) : helper::baseUrl() . $childKey;
|
||||
$items .= '<a class="' . $active . ' ' . $parentPageId . '" href="' . $pageUrl . '"' . $targetBlank . '>';
|
||||
}
|
||||
|
||||
switch ($this->getData(['page', $childKey, 'typeMenu'])) {
|
||||
case '':
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
break;
|
||||
case 'text':
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
break;
|
||||
case 'icon':
|
||||
if ($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 {
|
||||
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
|
||||
}
|
||||
break;
|
||||
case 'icontitle':
|
||||
if ($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']) . '" data-tippy-content="';
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']) . '"/>';
|
||||
} else {
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
}
|
||||
break;
|
||||
case 'icontext':
|
||||
if ($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']) . '" />';
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
} else {
|
||||
$items .= $this->getData(['page', $childKey, 'shortTitle']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
$items .= '</a></li>';
|
||||
}
|
||||
$items .= '</ul>';
|
||||
$items .= '</a></li>';
|
||||
}
|
||||
$items .= '</ul>';
|
||||
}
|
||||
|
||||
return ($items);
|
||||
}
|
||||
|
||||
|
@ -369,24 +369,25 @@ core.start = function () {
|
||||
}
|
||||
}
|
||||
}).trigger("resize");
|
||||
|
||||
/**
|
||||
* Masque les pages du menu si demandé dans la configuration du thème du menu
|
||||
* Masque les pages du menu si demandé dans la configuration du thème du menu sauf dans home
|
||||
*/
|
||||
// Option active
|
||||
var hidePages = "<?php echo $this->getData(['theme', 'menu', 'hidePages'])?>";
|
||||
|
||||
// Récupérer les valeurs de dimensions
|
||||
var padding = "<?php echo $this->getData(['theme', 'menu', 'height'])?>";
|
||||
var firstPadding = parseFloat(padding.split(" ")[0]); // Convertir la première valeur en nombre
|
||||
var fontSize = parseFloat("<?php echo $this->getData(['theme', 'text', 'fontSize'])?>"); // Taille du texte
|
||||
var menuFontSize = parseFloat("<?php echo $this->getData(['theme', 'menu', 'fontSize'])?>"); // Taille du menu
|
||||
|
||||
// Convertir menuFontSize en pixels
|
||||
var menuFontSizeInPx = menuFontSize * fontSize;
|
||||
|
||||
// Calculer la hauteur totale
|
||||
var totalHeight = firstPadding + fontSize + menuFontSizeInPx;
|
||||
if (hidePages == 1) {
|
||||
// Récupérer les valeurs de dimensions
|
||||
var padding = "<?php echo $this->getData(['theme', 'menu', 'height'])?>";
|
||||
var firstPadding = parseFloat(padding.split(" ")[0]); // Convertir la première valeur en nombre
|
||||
var fontSize = parseFloat("<?php echo $this->getData(['theme', 'text', 'fontSize'])?>"); // Taille du texte
|
||||
var menuFontSize = parseFloat("<?php echo $this->getData(['theme', 'menu', 'fontSize'])?>"); // Taille du menu
|
||||
|
||||
// Convertir menuFontSize en pixels
|
||||
var menuFontSizeInPx = menuFontSize * fontSize;
|
||||
|
||||
// Calculer la hauteur totale
|
||||
var totalHeight = firstPadding + fontSize + menuFontSizeInPx;
|
||||
$("#menuLeft").css({
|
||||
"visibility": "hidden",
|
||||
"overflow": "hidden",
|
||||
|
@ -1010,7 +1010,9 @@ class common
|
||||
|
||||
/**
|
||||
* Accède à l'utilisateur connecté
|
||||
* @param int $key Clé de la valeur
|
||||
* @param string $key Clé de la valeur
|
||||
* @param mixed $perm1
|
||||
* @param mixed $perm2
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUser($key, $perm1 = null, $perm2 = null)
|
||||
|
@ -604,7 +604,9 @@ class theme extends common
|
||||
]
|
||||
]);
|
||||
// Active le rapport des consultations si options active dans le thème
|
||||
$this->setData(['course', self::$siteContent, 'report', true]);
|
||||
if (self::$siteContent !== 'home') {
|
||||
$this->setData(['course', self::$siteContent, 'report', true]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => helper::translate('Modifications enregistrées'),
|
||||
@ -681,14 +683,14 @@ class theme extends common
|
||||
'value' => template::ico('pencil'),
|
||||
//'disabled' => !empty($fontUsed[$fontId])
|
||||
])
|
||||
: '',
|
||||
: '',
|
||||
$type !== 'websafe' ? template::button('themeFontDelete' . $fontId, [
|
||||
'class' => 'themeFontDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/fontDelete/' . $type . '/' . $fontId,
|
||||
'value' => template::ico('cancel'),
|
||||
'disabled' => !empty($fontUsed[$fontId])
|
||||
])
|
||||
: ''
|
||||
: ''
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -1015,7 +1017,8 @@ class theme extends common
|
||||
'notification' => $data['notification'],
|
||||
'state' => $data['success'],
|
||||
'view' => 'manage'
|
||||
]);;
|
||||
]);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user