[9.2.15] Affichage d'une page Lity sans la structure du site (manue, bannière, footer)

This commit is contained in:
fredtempez 2019-12-08 16:48:42 +01:00
parent 4504eb8662
commit f2c01e7e9f
3 changed files with 127 additions and 28 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## version 9.2.15
- Amélioration :
- Affichage du contenu seul d'une page du site dans une popup Lity sans menu, bannière et pied de page
## version 9.2.14 ## version 9.2.14
- Mise à jour : - Mise à jour :
- Script d'upload du gestionnaire de fichiers - Script d'upload du gestionnaire de fichiers

View File

@ -21,6 +21,7 @@ class common {
const DISPLAY_LAYOUT_BLANK = 2; const DISPLAY_LAYOUT_BLANK = 2;
const DISPLAY_LAYOUT_MAIN = 3; const DISPLAY_LAYOUT_MAIN = 3;
const DISPLAY_LAYOUT_LIGHT = 4; const DISPLAY_LAYOUT_LIGHT = 4;
const DISPLAY_LAYOUT_POPUP = 5;
const GROUP_BANNED = -1; const GROUP_BANNED = -1;
const GROUP_VISITOR = 0; const GROUP_VISITOR = 0;
const GROUP_MEMBER = 1; const GROUP_MEMBER = 1;
@ -69,6 +70,7 @@ class common {
'notification' => '', 'notification' => '',
'redirect' => '', 'redirect' => '',
'script' => '', 'script' => '',
'targetLity' => false,
'showBarEditButton' => false, 'showBarEditButton' => false,
'showPageContent' => false, 'showPageContent' => false,
'state' => false, 'state' => false,
@ -1302,7 +1304,8 @@ class core extends common {
'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']),
'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']),
'contentRight' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barRight']),'content']), 'contentRight' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barRight']),'content']),
'contentLeft' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'content']) 'contentLeft' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'content']),
'targetLity' => is_null($this->getData(['page', $this->getUrl(0), 'targetLity'])) ? false : $this->getData(['page', $this->getUrl(0), 'targetLity'])
]); ]);
} }
// Importe le module // Importe le module
@ -1319,7 +1322,8 @@ class core extends common {
'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']),
'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']),
'contentRight' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barRight']),'content']), 'contentRight' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barRight']),'content']),
'contentLeft' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'content']) 'contentLeft' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'content']),
'targetLity' => is_null($this->getData(['page', $this->getUrl(0), 'targetLity'])) ? false : $this->getData(['page', $this->getUrl(0), 'targetLity'])
]); ]);
$pageContent = $this->getData(['page', $this->getUrl(0), 'content']); $pageContent = $this->getData(['page', $this->getUrl(0), 'content']);
} }
@ -1397,13 +1401,13 @@ class core extends common {
header('Location:' . $output['redirect']); header('Location:' . $output['redirect']);
exit(); exit();
} }
} }
// Données en sortie applicables même lorsqu'une notice est présente // Données en sortie applicables même lorsqu'une notice est présente
// Affichage // Affichage
if($output['display']) { if($output['display']) {
$this->addOutput([ $this->addOutput([
'display' => $output['display'] 'display' => $output['display']
]); ]);
} }
// Contenu brut // Contenu brut
if($output['content']) { if($output['content']) {
@ -1523,29 +1527,37 @@ class core extends common {
'metaDescription' => $this->getData(['config', 'metaDescription']) 'metaDescription' => $this->getData(['config', 'metaDescription'])
]); ]);
} }
// Choix du type d'affichage
switch($this->output['display']) { if($this->output['targetLity']) {
// Layout vide require 'core/layout/popup.php';
case self::DISPLAY_LAYOUT_BLANK: } else {
require 'core/layout/blank.php'; switch($this->output['display']) {
break; // Layout vide
// Affichage en JSON case self::DISPLAY_LAYOUT_BLANK:
case self::DISPLAY_JSON: require 'core/layout/blank.php';
header('Content-Type: application/json'); break;
echo json_encode($this->output['content']); // Affichage en JSON
break; case self::DISPLAY_JSON:
// Layout alléger header('Content-Type: application/json');
case self::DISPLAY_LAYOUT_LIGHT: echo json_encode($this->output['content']);
require 'core/layout/light.php'; break;
break; // Layout alléger
// Layout principal case self::DISPLAY_LAYOUT_LIGHT:
case self::DISPLAY_LAYOUT_MAIN: require 'core/layout/light.php';
require 'core/layout/main.php'; break;
break; // Layout principal
// Layout brut case self::DISPLAY_LAYOUT_MAIN:
case self::DISPLAY_RAW: require 'core/layout/main.php';
echo $this->output['content']; break;
break; // Layout poup lity
case self::DISPLAY_LAYOUT_POPUP:
break;
// Layout brut
case self::DISPLAY_RAW:
echo $this->output['content'];
break;
}
} }
} }

83
core/layout/popup.php Normal file
View File

@ -0,0 +1,83 @@
<?php $layout = new layout($this); ?>
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#" lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php $layout->showMetaTitle(); ?>
<?php $layout->showMetaDescription(); ?>
<?php $layout->showMetaType(); ?>
<?php $layout->showMetaImage(); ?>
<?php $layout->showFavicon(); ?>
<?php $layout->showVendor(); ?>
<?php $layout->showAnalytics(); ?>
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>site/data/theme.css?<?php echo md5_file(self::DATA_DIR.'theme.css'); ?>">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>site/data/custom.css?<?php echo md5_file(self::DATA_DIR.'custom.css'); ?>">
<?php $layout->showStyle(); ?>
<?php if (file_exists('site/data/head.inc.html')) {
include('site/data/head.inc.html');
}?>
</head>
<body>
<!-- Corps de page -->
<section>
<?php
// Gabarit :
// Récupérer la config de la page courante
$blocks = explode('-',$this->getData(['page',$this->getUrl(0),'block']));
// Initialiser
$blockleft=$blockright="";
switch (sizeof($blocks)) {
case 1 : // une colonne
$content = 'col'. $blocks[0] ;
break;
case 2 : // 2 blocks
if ($blocks[0] < $blocks[1]) { // détermine la position de la colonne
$blockleft = 'col'. $blocks[0];
$content = 'col'. $blocks[1] ;
} else {
$content = 'col' . $blocks[0];
$blockright = 'col' . $blocks[1];
}
break;
case 3 : // 3 blocks
$blockleft = 'col' . $blocks[0];
$content = 'col' . $blocks[1];
$blockright = 'col' . $blocks[2];
}
// Page pleine pour la configuration des modules et l'édition des pages sauf l'affichae d'un article de blog
$pattern = ['config','edit','add','comment','data'];
if ((sizeof($blocks) === 1 ||
in_array($this->getUrl(1),$pattern) )
) { // Pleine page en mode configuration
$layout->showContent();
if (file_exists('site/data/body.inc.html')) {
include('site/data/body.inc.html');
}
} else {
?>
<div class="row siteContainer">
<?php
if ($blockleft !== "") :?>
<div class="<?php echo $blockleft; ?>" id="contentLeft"><?php $layout->showBarContentLeft(); ?></div>
<?php endif; ?>
<div class="<?php echo $content; ?>" id="contentSite"><?php $layout->showContent();
if (file_exists('site/data/body.inc.html')) {
include('site/data/body.inc.html');
}
?>
</div>
<?php
if ($blockright !== "") :?>
<div class="<?php echo $blockright; ?>" id="contentRight"><?php $layout->showBarContentRight(); ?></div>
<?php endif; ?>
</div>
<?php }
?>
</section>
<!-- Lien remonter en haut -->
<div id="backToTop"><?php echo template::ico('up'); ?></div>
<?php $layout->showScript();?>
</body>
</html>