From fa71a79f474fe69110830316dd4d91b1abeff5e8 Mon Sep 17 00:00:00 2001 From: Thorben <2708231+eaCe@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:57:35 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Nur=20Eintr=C3=A4ge=20mit=20Status=201=20od?= =?UTF-8?q?er=200=20ausgeben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Es werden nur noch Einträge die veröffentlicht sind ausgegeben, oder Einträge die geplant sind und deren Datum und Uhrzeit erreicht ist. --- lib/neues.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/neues.php b/lib/neues.php index 66cfe7a..0137e45 100644 --- a/lib/neues.php +++ b/lib/neues.php @@ -18,7 +18,10 @@ class neues */ public static function getList(int $rowsPerPage = 10, string $pageCursor = 'page'): string { - $query = neues_entry::query()->orderBy('publishdate', 'desc'); + $query = neues_entry::query() + ->whereRaw('status = 0 OR status = 1') + ->where('publishdate', rex_sql::datetime(), '<=') + ->orderBy('publishdate', 'desc'); $pager = new rex_pager($rowsPerPage, $pageCursor); $posts = $query->paginate($pager); From 87c54b0ea79a0745a65c5fa805086bc397f6b9d1 Mon Sep 17 00:00:00 2001 From: eaCe Date: Sun, 3 Mar 2024 12:57:58 +0000 Subject: [PATCH 2/3] Apply php-cs-fixer changes --- boot.php | 2 -- install.php | 3 --- lib/rex_cronjob_neues_publish.php | 1 - 3 files changed, 6 deletions(-) diff --git a/boot.php b/boot.php index 17f81e6..d89ca33 100644 --- a/boot.php +++ b/boot.php @@ -5,7 +5,6 @@ } if (rex_addon::get('yform')->isAvailable() && !rex::isSafeMode()) { - rex_yform_manager_dataset::setModelClass( 'rex_neues_entry', neues_entry::class, @@ -22,7 +21,6 @@ 'rex_neues_entry_lang', neues_entry_lang::class, ); - } if (rex::isBackend() && 'neues/entry' == rex_be_controller::getCurrentPage() || 'yform/manager/data_edit' == rex_be_controller::getCurrentPage()) { diff --git a/install.php b/install.php index 1e05c0c..d7a7142 100644 --- a/install.php +++ b/install.php @@ -6,7 +6,6 @@ } if (!rex_media::get('neues_entry_fallback_image.png')) { - rex_file::copy(rex_path::addon('neues', '/install/neues_entry_fallback_image.png'), rex_path::media('neues_entry_fallback_image.png')); $data = []; $data['title'] = 'Aktuelles - Fallback-Image'; @@ -30,9 +29,7 @@ /* URL-Profile installieren */ if (rex_addon::get('url') && rex_addon::get('url')->isAvailable()) { - if (false === rex_config::get('neues', 'url_profile', false)) { - $rex_neues_category = array_filter(rex_sql::factory()->getArray("SELECT * FROM rex_url_generator_profile WHERE `table_name` = '1_xxx_rex_neues_category'")); if (!$rex_neues_category) { $query = rex_file::get(rex_path::addon('neues', 'install/rex_url_profile_neues_category.sql')); diff --git a/lib/rex_cronjob_neues_publish.php b/lib/rex_cronjob_neues_publish.php index 2448e31..ec2d904 100644 --- a/lib/rex_cronjob_neues_publish.php +++ b/lib/rex_cronjob_neues_publish.php @@ -4,7 +4,6 @@ class rex_cronjob_neues_publish extends rex_cronjob { public function execute() { - /* Collection von Neues-Einträgen, die noch nicht veröffentlicht sind, aber es sein sollten. (geplant) */ $neues_entry_to_publish = neues_entry::query()->where('status', 0)->where('publishdate', date('Y-m-d'), '<')->find(); $neues_entry_to_publish->setValue('status', 1); From 7b905c60d07f3341765d22c119ade329e78ee085 Mon Sep 17 00:00:00 2001 From: Thorben <2708231+eaCe@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:20:54 +0100 Subject: [PATCH 3/3] where status >= 1 --- lib/neues.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/neues.php b/lib/neues.php index 0137e45..48d0e8e 100644 --- a/lib/neues.php +++ b/lib/neues.php @@ -19,7 +19,7 @@ class neues public static function getList(int $rowsPerPage = 10, string $pageCursor = 'page'): string { $query = neues_entry::query() - ->whereRaw('status = 0 OR status = 1') + ->where('status', 1, '>=') ->where('publishdate', rex_sql::datetime(), '<=') ->orderBy('publishdate', 'desc'); $pager = new rex_pager($rowsPerPage, $pageCursor);