NAVIGATION
This is an old revision of the document!
Autom. move of expired article into a archive category
This script is working for one article list in one category and one archive category.
The ID of the source category (where the article list is) is registered in $my_article_cat . The Target- or archive category (where the articles at expiration to be kept) is registered in $my_archive_cat .
Condition: * Source category must be run in article list-mode: top article count > 1
Recommended:
rt_article_move_to_archive V1.0 26.07.09
Docu: –
Forum: –
Autor: K.Heermann (flip-flop) http://planmatrix.de
CMS version: >= 1.3.x
Version: V1.0
Tag: –
Fileiname: rt_article_move_to_archive.php
Folder: template/inc_script/frontend_render/
Condition: → /config/phpwcms/conf.inc.php
<?php /* ***************************************************************************** Autom. Verschieben von abgelaufenen Artikeln in eine Archivkategorie autom. expired article move into a archive category 26.07.09 Knut Heermann (flip-flop) http://planmatrix.de Bedingung // Condition: - Quell-Kategorie muss im Artikel-Listenmodus arbeiten "Anzahl an Top-Artikeln > 1" - // Source category must be run in article list-mode "top article count > 1" - Artikel in dieser Kategorie "[x](verfuegbar nach Enddatum (archivieren))" - // Articles in this category "[x](available after end date (archive))" Empfohlen // Recommended: Quellkategorie // Source category = Archiv [ ] Zielkategorie // Target category = Archiv [x] ***************************************************************************** */ // ----------------------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ----------------------------------------------------------------------------- // USERINPUT ====================================================== // Kategorie-ID in der das Artikel-Listing laeuft (Quelle) // Category-ID where the article listing is running (source) $my_article_cat = 14; // ID der Archiv-Kategorie in die verschoben werden soll (Ziel) // ID of the archive category (target) $my_archive_cat = 35; // USERINPUT END ================================================== // Nur ausfuehren wenn der Listenmodus in der Kategorie eingeschaltet und die angegebene Kategorie aktiv ist // Only run if list mode in category is true and the specified category is active if( $content['list_mode'] == true && $content['cat_id'] == $my_article_cat) { // Gibt es einen Artikel bei dem das Datum abgelaufen ist? // Is there an article with expired date? $article = array(); $my_time = time(); // for faster processing foreach($content['articles'] as $key => $value) { if ($content['articles'][$key]['article_killdate'] < $my_time ) { $article[] = $value['article_id']; } } // Wenn mindestens ein Artikel vorhanden ist // If minimum one article exists if(count($article)) { $sql = 'UPDATE '.DB_PREPEND.'phpwcms_article SET '; $sql .= "article_cid= ".$my_archive_cat." "; $sql .= "WHERE article_cid= ".$my_article_cat." AND article_archive_status=1 AND article_deleted=0 "; $sql .= " AND article_public=1 AND article_aktiv=1 AND article_end < NOW() "; $queryResult = _dbQuery($sql, 'UPDATE'); } } ?>