From d745201afe2950ccded7f98fb01a94aa0e96ece2 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 28 Mar 2011 18:23:57 -0400 Subject: [PATCH] CC-2098: Only push playlists that havent ended yet -re-added ability to specify to/from time ranges --- application/models/Schedule.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/application/models/Schedule.php b/application/models/Schedule.php index d2cb8e801..d336546a5 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -653,17 +653,24 @@ class Schedule { * @param string $p_toDateTime * In the format "YYYY-MM-DD-HH-mm-SS" */ - public static function GetScheduledPlaylists() + public static function GetScheduledPlaylists($p_fromDateTime = null, $p_toDateTime = null) { global $CC_CONFIG, $CC_DBC; - $t1 = new DateTime(); - $range_start = $t1->format("Y-m-d H:i:s"); - - $t2 = new DateTime(); - $t2->add(new DateInterval("PT24H")); - $range_end = $t2->format("Y-m-d H:i:s"); - + if (is_null($p_fromDateTime)) { + $t1 = new DateTime(); + $range_start = $t1->format("Y-m-d H:i:s"); + } else { + $range_start = Schedule::PypoTimeToAirtimeTime($p_fromDateTime); + } + if (is_null($p_fromDateTime)) { + $t2 = new DateTime(); + $t2->add(new DateInterval("PT24H")); + $range_end = $t2->format("Y-m-d H:i:s"); + } else { + $range_end = Schedule::PypoTimeToAirtimeTime($p_toDateTime); + } + // Scheduler wants everything in a playlist $data = Schedule::GetItems($range_start, $range_end, true); $playlists = array();