Browse Source

init ok

theme2module
fredtempez 1 month ago
parent
commit
4d9d71602e
  1. 5
      core/core.php
  2. 20
      module/news/news.php
  3. 1
      module/news/view/index/index.css
  4. 2
      module/news/view/index/index.php
  5. 1
      site/data/modules/news/actu/style.css

5
core/core.php

@ -2211,6 +2211,11 @@ class core extends common {
'style' => file_get_contents($stylePath)
]);
}
if ($output['style']) {
$this->addOutput([
'style' => $this->output['style'] . file_get_contents($output['style'])
]);
}
// JS
$scriptPath = $modulePath . 'module/' . $moduleId . '/view/' . $output['view'] . '/' . $output['view'] . '.js.php';
if(file_exists($scriptPath)) {

20
module/news/news.php

@ -180,15 +180,30 @@ class news extends common {
public function config() {
// Mise à jour des données de module
$this->update();
// Soumission du formulaire
if($this->isPost()) {
// Générer la feuille de CSS
$class = get_called_class();
$moduleId = $this->getUrl(0);
$style = '.newsContent {height:' . $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT) . ';}';
// Dossier de l'instance
if (!is_dir(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId)) {
mkdir (self::DATA_DIR . 'modules/' . $class . '/' . $moduleId, 0775, true);
}
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '/style.css' , $style );
// Fin feuille de style
$this->setData(['module', $this->getUrl(0), 'config',[
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT),
'version' => $this->getData(['module', $this->getUrl(0), 'config', 'version'])
'version' => $this->getData(['module', $this->getUrl(0), 'config', 'version']),
'style' => $success ? self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '/style.css' : ''
]]);
// Valeurs en sortie
$this->addOutput([
@ -387,7 +402,8 @@ class news extends common {
$this->addOutput([
'showBarEditButton' => true,
'showPageContent' => true,
'view' => 'index'
'view' => 'index',
'style' => $this->getData(['module', $this->getUrl(0),'config', 'style'])
]);
}

1
module/news/view/index/index.css

@ -25,6 +25,7 @@
overflow: hidden; /* les dépassements seront masqués */
position: relative;
}
.newsBlur {
position: absolute;
bottom: -5%;

2
module/news/view/index/index.php

@ -5,7 +5,7 @@
<h1 class="newsTitle" id="<?php echo $newsId;?>">
<?php echo '<a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
</h1>
<div class="newsContent" style="height:<?php echo $this->getData(['module', $this->getUrl(0),'config', 'itemsHeight']); ?>;">
<div class="newsContent">
<?php echo $news['content']; ?>
<div class="newsBlur"></div>
</div>

1
site/data/modules/news/actu/style.css

@ -0,0 +1 @@
.newsContent {height:200px;}
Loading…
Cancel
Save