Ejemplo n.º 1
0
 private static function getRangeStartAndEnd($p_fromDateTime, $p_toDateTime)
 {
     global $CC_CONFIG;
     /* if $p_fromDateTime and $p_toDateTime function parameters are null,
        then set range * from "now" to "now + 24 hours". */
     if (is_null($p_fromDateTime)) {
         $t1 = new DateTime("@" . time());
         $range_start = $t1->format("Y-m-d H:i:s");
     } else {
         $range_start = Application_Model_Schedule::PypoTimeToAirtimeTime($p_fromDateTime);
     }
     if (is_null($p_fromDateTime)) {
         $t2 = new DateTime("@" . time());
         $cache_ahead_hours = $CC_CONFIG["cache_ahead_hours"];
         if (is_numeric($cache_ahead_hours)) {
             //make sure we are not dealing with a float
             $cache_ahead_hours = intval($cache_ahead_hours);
         } else {
             $cache_ahead_hours = 1;
         }
         $t2->add(new DateInterval("PT" . $cache_ahead_hours . "H"));
         $range_end = $t2->format("Y-m-d H:i:s");
     } else {
         $range_end = Application_Model_Schedule::PypoTimeToAirtimeTime($p_toDateTime);
     }
     return array($range_start, $range_end);
 }