Skip to content

Commit

Permalink
Merge pull request #64 from FriendsOfREDAXO/eaCe-patch-1
Browse files Browse the repository at this point in the history
Nur Einträge mit Status 1 oder 0 ausgeben
  • Loading branch information
alxndr-w authored Mar 3, 2024
2 parents 41725fd + 7b905c6 commit 0d84312
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 0 additions & 2 deletions boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
}

if (rex_addon::get('yform')->isAvailable() && !rex::isSafeMode()) {

rex_yform_manager_dataset::setModelClass(
'rex_neues_entry',
neues_entry::class,
Expand All @@ -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()) {
Expand Down
3 changes: 0 additions & 3 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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'));
Expand Down
5 changes: 4 additions & 1 deletion lib/neues.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
->where('status', 1, '>=')
->where('publishdate', rex_sql::datetime(), '<=')
->orderBy('publishdate', 'desc');
$pager = new rex_pager($rowsPerPage, $pageCursor);
$posts = $query->paginate($pager);

Expand Down
1 change: 0 additions & 1 deletion lib/rex_cronjob_neues_publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0d84312

Please sign in to comment.