Display block ok

This commit is contained in:
fredtempez 2019-01-03 19:54:44 +01:00
parent 61ff4dc49a
commit 7c30cbe4e8
4 changed files with 59 additions and 45 deletions

View File

@ -56,9 +56,7 @@ class common {
], ],
'timezone' => 'Europe/Paris', 'timezone' => 'Europe/Paris',
'title' => 'Zwii, votre site en quelques clics !', 'title' => 'Zwii, votre site en quelques clics !',
'itemsperPage' => 10, 'itemsperPage' => 10
'contentLeft' => '',
'contentRight' => ''
], ],
'core' => [ 'core' => [
'dataVersion' => 0, 'dataVersion' => 0,
@ -364,6 +362,10 @@ class common {
'fontWeight' => 'normal', 'fontWeight' => 'normal',
'textColor' => 'rgba(74, 105, 189, 1)', 'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none' 'textTransform' => 'none'
],
'block' => [
'contentLeft' => '',
'contentRight' => ''
] ]
] ]
]; ];
@ -998,8 +1000,8 @@ class common {
// Version 9.0.0 // Version 9.0.0
if($this->getData(['core', 'dataVersion']) < 900) { if($this->getData(['core', 'dataVersion']) < 900) {
$this->setData(['theme', 'site', 'blocks','100']); $this->setData(['theme', 'site', 'blocks','100']);
$this->setData(['config', 'contentLeft','']); $this->setData(['theme', 'block', 'contentLeft','']);
$this->setData(['config', 'contentRight','']); $this->setData(['theme', 'block', 'contentRight','']);
$this->setData(['core', 'dataVersion', 900]); $this->setData(['core', 'dataVersion', 900]);
$this->SaveData(); $this->SaveData();
} }

View File

@ -116,28 +116,40 @@
</nav> </nav>
<?php endif; ?> <?php endif; ?>
<!-- Corps --> <!-- Corps -->
<?php <?php if ($this->getUrl(0) === 'theme' OR
switch($this->getData(['theme','site','blocks'])) { $this->getUrl(0) === 'config' OR
case '33-66' : $this->getUrl(0) === 'user' ) { ?> <!-- Pas de multi colonne-->
<section><?php $layout->showContent(); ?></section>
<?php } else {
$blocks = explode('-',$this->getData(['theme','site','blocks']));
$blockleft=$blockright="";
switch (sizeof($blocks)) {
case 1 : // une colonne
$content = 'col'. $blocks[0] ;
break; break;
case '25-75' : case 2 : // 2 blocks
break; if ($blocks[0] < $blocks[1]) { // détermine la position de la colonne
case '25-50-25' : $blockright = 'col'. $blocks[0];
$content = 'col'. $blocks[1] ;
} else {
$content = 'col' . $blocks[0];
$blockleft = 'col' . $blocks[1];
}
break; break;
case 3 : // 3 blocks
$blockleft = 'col' . $blocks[0];
$content = 'col' . $blocks[1];
$blockright = 'col' . $blocks[2];
} }
?> ?>
<section><div class="col6 offset4"><?php $layout->showContent(); ?></div></section> <section>
<?php <div class="row">
switch($this->getData(['theme','site','blocks'])) { <?php if ($blockleft !== "") :?> <div class="<?php echo $blockleft; ?>"><?php echo $this->getData(['theme','block','contentLeft']);?></div> <?php endif; ?>
case '66-33' : <div class="<?php echo $content; ?>"><?php $layout->showContent(); ?></div>
break; <?php if ($blockright !== "") :?> <div class="<?php echo $blockright; ?>"><?php echo $this->getData(['theme','block','contentRight']);?></div> <?php endif; ?>
case '75-25' : </div>
break; </section>
case '25-50-25' : <?php } ?>
break;
}
?>
<!-- footer --> <!-- footer -->
<?php if( <?php if(
$this->getData(['theme', 'footer', 'position']) === 'site' $this->getData(['theme', 'footer', 'position']) === 'site'

View File

@ -204,12 +204,12 @@ class theme extends common {
]; ];
public static $siteBlocks = [ public static $siteBlocks = [
'100' => 'Une colonne', '12' => 'Une colonne',
'33-66' => 'Deux colonnes : 1/3 - 2/3', '4-8' => 'Deux colonnes : 1/3 - 2/3',
'66-33' => 'Deux colonnes : 2/3 - 1/3', '8-4' => 'Deux colonnes : 2/3 - 1/3',
'25-75' => 'Deux colonnes : 1/4 - 3/4', '3-9' => 'Deux colonnes : 1/4 - 3/4',
'75-25' => 'Deux colonnes : 3/4 - 1/2', '9-3' => 'Deux colonnes : 3/4 - 1/2',
'25-50-25' => 'Trois colonnes : 1/4 - 1/2 - 1/4' '3-6-3' => 'Trois colonnes : 1/4 - 1/2 - 1/4'
]; ];
@ -434,11 +434,11 @@ class theme extends common {
'radius' => $this->getInput('themeSiteRadius'), 'radius' => $this->getInput('themeSiteRadius'),
'shadow' => $this->getInput('themeSiteShadow'), 'shadow' => $this->getInput('themeSiteShadow'),
'width' => $this->getInput('themeSiteWidth'), 'width' => $this->getInput('themeSiteWidth'),
'blocks' => $this->getInput('themeSiteBlocks'), 'blocks' => $this->getInput('themeSiteBlocks')
]]); ]]);
$this->setData(['config', [ $this->setData(['theme','block', [
'contentLeft' => (empty($this->getInput('configContentleft', null)) ? "<p></p>" : $this->getInput('configContentleft', null)), 'contentLeft' => (empty($this->getInput('themeBlockContentLeft', null)) ? "<p></p>" : $this->getInput('themeBlockContentLeft', null)),
'contentRight' => (empty($this->getInput('configContentright', null)) ? "<p></p>" : $this->getInput('configContentright', null)) 'contentRight' => (empty($this->getInput('themeBlockContentRight', null)) ? "<p></p>" : $this->getInput('themeBlockContentRight', null))
]]); ]]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([

View File

@ -144,15 +144,15 @@
</div> </div>
<div class='row'> <div class='row'>
<div class="col6"> <div class="col6">
<?php echo template::textarea('configContentright', [ <?php echo template::textarea('themeBlockContentLeft', [
'class' => 'editorWysiwyg', 'class' => 'editorWysiwyg',
'value' => $this->getData(['config', 'contentRight']) 'value' => $this->getData(['theme','block', 'contentLeft'])
]); ?> ]); ?>
</div> </div>
<div class="col6"> <div class="col6">
<?php echo template::textarea('configContentleft', [ <?php echo template::textarea('themeBlockContentRight', [
'class' => 'editorWysiwyg', 'class' => 'editorWysiwyg',
'value' => $this->getData(['config', 'contentLeft']) 'value' => $this->getData(['theme','block', 'contentRight'])
]); ?> ]); ?>
</div> </div>
</div> </div>