示例#1
0
文件: Show.php 项目: nidzix/Airtime
 private static function createRebroadcastInstances($p_rebroadcasts, $p_currentUtcTimestamp, $p_showId, $p_showInstanceId, $p_startTime, $p_duration, $p_timezone = null)
 {
     //Y-m-d
     //use only the date part of the show start time stamp for the offsets to work properly.
     $date = explode(" ", $p_startTime);
     $start_date = $date[0];
     foreach ($p_rebroadcasts as $rebroadcast) {
         $days = explode(" ", $rebroadcast["day_offset"]);
         $time = explode(":", $rebroadcast["start_time"]);
         $offset = array("days" => $days[0], "hours" => $time[0], "mins" => $time[1]);
         list($utcStartDateTime, $utcEndDateTime) = Application_Model_Show::createUTCStartEndDateTime($start_date, $p_duration, $p_timezone, $offset);
         if ($utcStartDateTime->format("Y-m-d H:i:s") > $p_currentUtcTimestamp) {
             $newRebroadcastInstance = new CcShowInstances();
             $newRebroadcastInstance->setDbShowId($p_showId);
             $newRebroadcastInstance->setDbStarts($utcStartDateTime);
             $newRebroadcastInstance->setDbEnds($utcEndDateTime);
             $newRebroadcastInstance->setDbRecord(0);
             $newRebroadcastInstance->setDbRebroadcast(1);
             $newRebroadcastInstance->setDbOriginalShow($p_showInstanceId);
             $newRebroadcastInstance->save();
         }
     }
 }