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

View File

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

View File

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

View File

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