Re: Zeitsteuerung in Release: 4.8.12
Verfasst: Mo 9. Aug 2010, 19:04
Na alla gut ... ich kümmer mich die Woche mal drum
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Code: Alles auswählen
$sql = "SELECT idartlang, idart, time_move_cat, time_target_cat, time_online_move FROM ".$cfg["tab"]["art_lang"]." WHERE NOW() > dateend AND dateend != '0000-00-00 00:00:00' AND timemgmt = 1";
$db->query($sql);
while ($db->next_record()) {
if ($db->f("time_move_cat") == "1") {
Code: Alles auswählen
/**
* Edit all articles with time management function
*
* @param none
*
* @author Karsten Klopmann <kk@idea-tec.de>
* @copyright idea-tec GmbH 2010
*/
function conTimeMgmtKK() {
global $cfg;
$db = new DB_Contenido;
$db2 = new DB_Contenido;
$Now = date("Y-m-d h:i:s");
//-- Der Select wird dem Umstand gerecht, dass es in der Zeitsteuerung möglich ist ein Startdatum einzugeben, das NACH dem Enddatum liegt!!!
$sql = 'SELECT * FROM '.$cfg["tab"]["art_lang"].' where timemgmt = 1 and (datestart<dateend || dateend="0000-00-00 00:00:00")';
$db->query($sql);
while ($db->next_record()) {
$timemgmt_select = 'update '.$cfg["tab"]["art_lang"].' set ';
// zunächst schauen wir wie es basierend auf den jeweiligen Datumsangaben um den Online-Status steht
if ($db->f("datestart")<=$Now && $db->f("datestart")!="0000-00-00 00:00:00" && $db->f("online")==0) {
$timemgmt_select .= 'online=1, ';
if ($db->f("dateend")=="0000-00-00 00:00:00") { $timemgmt_select .= 'timemgmt=0 '; }
} else if ($db->f("dateend")<=$Now && $db->f("dateend")!="0000-00-00 00:00:00" && $db->f("online")==1 && $db->f("time_move_cat")==0) { $timemgmt_select .= 'online=0, timemgmt=0 '; }
else if ($db->f("dateend")<=$Now && $db->f("dateend")!="0000-00-00 00:00:00" && $db->f("online")==1 && $db->f("time_move_cat")==1 && $db->f("time_online_move")==0) { $timemgmt_select .= 'online=0, timemgmt=0 '; }
$timemgmt_select .= 'WHERE idartlang="'.Contenido_Security::toInteger($db->f("idartlang")).'"';
$db2->query($timemgmt_select);
//-- Übernahme der Funktion aus conMoveArticles
if ($db->f("time_move_cat")==1) {
$sql = "UPDATE ".$cfg["tab"]["cat_art"]." SET idcat = '" . Contenido_Security::toInteger($db->f("time_target_cat")) . "', createcode = '1' WHERE idart = '" . Contenido_Security::toInteger($db->f("idart")) . "'";
$db2->query($sql);
// execute CEC hook
$record = CEC_Hook::execute('Contenido.Article.conMoveArticles_Loop', $db->Record);
}
}
}
Code: Alles auswählen
conTimeMgmtKK();
/*
conFlagOnOffline();
conMoveArticles();
*/