From 4d9d71602e4c2c500b71a66cbc5d8e070c144859 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 3 Apr 2021 16:24:25 +0200 Subject: [PATCH] init ok --- core/core.php | 5 +++++ module/news/news.php | 20 ++++++++++++++++++-- module/news/view/index/index.css | 1 + module/news/view/index/index.php | 2 +- site/data/modules/news/actu/style.css | 1 + 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 site/data/modules/news/actu/style.css diff --git a/core/core.php b/core/core.php index c2dabd12..4fbaf6a6 100755 --- a/core/core.php +++ b/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)) { diff --git a/module/news/news.php b/module/news/news.php index cd4eeabd..5e794f70 100755 --- a/module/news/news.php +++ b/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']) ]); } diff --git a/module/news/view/index/index.css b/module/news/view/index/index.css index a7550927..c462ebbd 100755 --- a/module/news/view/index/index.css +++ b/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%; diff --git a/module/news/view/index/index.php b/module/news/view/index/index.php index 9a22558b..a26a37d5 100755 --- a/module/news/view/index/index.php +++ b/module/news/view/index/index.php @@ -5,7 +5,7 @@

getUrl(0) . '/' . $newsId . '">' . $news['title'] . ''; ?>

-
+
diff --git a/site/data/modules/news/actu/style.css b/site/data/modules/news/actu/style.css new file mode 100644 index 00000000..c5d13cc5 --- /dev/null +++ b/site/data/modules/news/actu/style.css @@ -0,0 +1 @@ +.newsContent {height:200px;} \ No newline at end of file