CC-2833: Use ClassLoaders for PHP Files

-autoload DateHelper class
This commit is contained in:
martin 2011-09-26 15:29:12 -04:00
parent b8838a5bda
commit 9e6a1ebf44
7 changed files with 29 additions and 29 deletions

View File

@ -20,7 +20,7 @@ require_once 'DB.php';
//require_once 'Shows.php';
//require_once 'User.php';
//require_once 'RabbitMq.php';
require_once 'DateHelper.php';
//require_once 'DateHelper.php';
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
global $CC_CONFIG, $CC_DBC;

View File

@ -158,7 +158,7 @@ class ApiController extends Zend_Controller_Action
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timeNow = $date->getTimestamp();
$result = array("env"=>APPLICATION_ENV,
"schedulerTime"=>gmdate("Y-m-d H:i:s"),

View File

@ -152,8 +152,8 @@ class ScheduleController extends Zend_Controller_Action
$params = '/format/json/id/#id#';
$showStartDateHelper = DateHelper::ConvertToLocalDateTime($show->getShowStart());
$showEndDateHelper = DateHelper::ConvertToLocalDateTime($show->getShowEnd());
$showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowStart());
$showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowEnd());
if ($epochNow < $showStartDateHelper->getTimestamp()) {
@ -461,7 +461,7 @@ class ScheduleController extends Zend_Controller_Action
$i = 1;
foreach ($rebroadcastsRelative as $rebroadcast){
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = Application_Model_DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$i++;
}
$formRebroadcast->populate($rebroadcastFormValues);
@ -471,7 +471,7 @@ class ScheduleController extends Zend_Controller_Action
$i = 1;
foreach ($rebroadcastsAbsolute as $rebroadcast){
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = Application_Model_DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$i++;
}
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);

View File

@ -1,6 +1,6 @@
<?php
class DateHelper
class Application_Model_DateHelper
{
private $_dateTime;

View File

@ -14,10 +14,10 @@ class Application_Model_Nowplaying
foreach ($p_dbRows as $dbRow){
$showStartDateTime = DateHelper::ConvertToLocalDateTime($dbRow['show_starts']);
$showEndDateTime = DateHelper::ConvertToLocalDateTime($dbRow['show_ends']);
$itemStartDateTime = DateHelper::ConvertToLocalDateTime($dbRow['item_starts']);
$itemEndDateTime = DateHelper::ConvertToLocalDateTime($dbRow['item_ends']);
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_starts']);
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_ends']);
$itemStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_starts']);
$itemEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_ends']);
$showStarts = $showStartDateTime->format("Y-m-d H:i:s");
$showEnds = $showEndDateTime->format("Y-m-d H:i:s");
@ -61,7 +61,7 @@ class Application_Model_Nowplaying
$startCutoff = 60;
$endCutoff = 86400; //60*60*24 - seconds in a day
} else {
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$time = $date->getTime();
$date->setDate($dateString." ".$time);
$timeNow = $date->getUtcTimestamp();
@ -81,8 +81,8 @@ class Application_Model_Nowplaying
$showId = $si->getShowId();
$show = new Application_Model_Show($showId);
$showStartDateTime = DateHelper::ConvertToLocalDateTime($si->getShowStart());
$showEndDateTime = DateHelper::ConvertToLocalDateTime($si->getShowEnd());
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowStart());
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowEnd());
//append show header row
$data[] = self::CreateHeaderRow($show->getName(), $showStartDateTime->format("Y-m-d H:i:s"), $showEndDateTime->format("Y-m-d H:i:s"));

View File

@ -143,7 +143,7 @@ class Application_Model_Schedule {
global $CC_CONFIG;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timeNow = $date->getUtcTimestamp();
return array("env"=>APPLICATION_ENV,
"schedulerTime"=>$timeNow,
@ -499,8 +499,8 @@ class Application_Model_Schedule {
'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),
'fade_out' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_out"]),
'fade_cross' => 0,
'cue_in' => DateHelper::CalculateLengthInSeconds($item["cue_in"]),
'cue_out' => DateHelper::CalculateLengthInSeconds($item["cue_out"]),
'cue_in' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_in"]),
'cue_out' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_out"]),
'export_source' => 'scheduler',
'start' => $starts,
'end' => Application_Model_Schedule::AirtimeTimeToPypoTime($item["ends"])

View File

@ -137,7 +137,7 @@ class Application_Model_Show {
$uncheckedDaysImploded = implode(",", $p_uncheckedDays);
$showId = $this->getId();
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$sql = "DELETE FROM cc_show_instances"
@ -302,7 +302,7 @@ class Application_Model_Show {
public function deleteAllInstances(){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
@ -321,7 +321,7 @@ class Application_Model_Show {
public function deleteAllRebroadcasts(){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
@ -343,11 +343,11 @@ class Application_Model_Show {
public function removeAllInstancesFromDate($p_date=null){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
if(is_null($p_date)) {
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$p_date = $date->getDate();
}
@ -377,7 +377,7 @@ class Application_Model_Show {
public function removeAllInstancesBeforeDate($p_date){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
@ -481,7 +481,7 @@ class Application_Model_Show {
* true if the StartDate is in the past, false otherwise
*/
public function isStartDateTimeInPast(){
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$current_timestamp = $date->getTimestamp();
return ($current_timestamp > $this->getStartDate()." ".$this->getStartTime());
}
@ -495,7 +495,7 @@ class Application_Model_Show {
public function getAllFutureInstanceIds(){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
@ -517,7 +517,7 @@ class Application_Model_Show {
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$sql = "UPDATE cc_show_days "
@ -538,7 +538,7 @@ class Application_Model_Show {
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$sql = "UPDATE cc_show_days "
@ -955,7 +955,7 @@ class Application_Model_Show {
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
$end = $CC_DBC->GetOne($sql);
$date = new DateHelper();
$date = new Application_Model_DateHelper();
$currentTimestamp = $date->getTimestamp();
$show = new Application_Model_Show($show_id);
@ -1028,7 +1028,7 @@ class Application_Model_Show {
$rebroadcasts = $CC_DBC->GetAll($sql);
$show = new Application_Model_Show($show_id);
$date = new DateHelper();
$date = new Application_Model_DateHelper();
$currentTimestamp = $date->getTimestamp();
while(strtotime($next_date) <= strtotime($end_timestamp) && (strtotime($last_show) > strtotime($next_date) || is_null($last_show))) {