Merge branch 'saas-dev' into soundcloud
Conflicts: airtime_mvc/application/configs/constants.php
This commit is contained in:
commit
5cc8774e56
30 changed files with 194 additions and 182 deletions
|
@ -15,7 +15,7 @@ class Application_Common_DateHelper
|
||||||
*/
|
*/
|
||||||
function getTimestamp()
|
function getTimestamp()
|
||||||
{
|
{
|
||||||
return date("Y-m-d H:i:s", $this->_dateTime);
|
return date(DEFAULT_TIMESTAMP_FORMAT, $this->_dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ class Application_Common_DateHelper
|
||||||
*/
|
*/
|
||||||
function getUtcTimestamp()
|
function getUtcTimestamp()
|
||||||
{
|
{
|
||||||
return gmdate("Y-m-d H:i:s", $this->_dateTime);
|
return gmdate(DEFAULT_TIMESTAMP_FORMAT, $this->_dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,7 +249,7 @@ class Application_Common_DateHelper
|
||||||
*
|
*
|
||||||
* @return string in $format default Y-m-d H:i:s in station timezone
|
* @return string in $format default Y-m-d H:i:s in station timezone
|
||||||
*/
|
*/
|
||||||
public static function UTCStringToStationTimezoneString($datetime, $format="Y-m-d H:i:s") {
|
public static function UTCStringToStationTimezoneString($datetime, $format=DEFAULT_TIMESTAMP_FORMAT) {
|
||||||
$stationTimezone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone());
|
$stationTimezone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone());
|
||||||
$utcTimezone = new DateTimeZone("UTC");
|
$utcTimezone = new DateTimeZone("UTC");
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ class Application_Common_DateHelper
|
||||||
*
|
*
|
||||||
* @return string Y-m-d H:i:s in user's timezone
|
* @return string Y-m-d H:i:s in user's timezone
|
||||||
*/
|
*/
|
||||||
public static function UTCStringToUserTimezoneString($datetime, $format="Y-m-d H:i:s") {
|
public static function UTCStringToUserTimezoneString($datetime, $format=DEFAULT_TIMESTAMP_FORMAT) {
|
||||||
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
||||||
$utcTimezone = new DateTimeZone("UTC");
|
$utcTimezone = new DateTimeZone("UTC");
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ class Application_Common_DateHelper
|
||||||
*
|
*
|
||||||
* @return string Y-m-d H:i:s in UTC timezone
|
* @return string Y-m-d H:i:s in UTC timezone
|
||||||
*/
|
*/
|
||||||
public static function UserTimezoneStringToUTCString($datetime, $format="Y-m-d H:i:s") {
|
public static function UserTimezoneStringToUTCString($datetime, $format=DEFAULT_TIMESTAMP_FORMAT) {
|
||||||
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
||||||
$utcTimezone = new DateTimeZone("UTC");
|
$utcTimezone = new DateTimeZone("UTC");
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ class Application_Common_DateHelper
|
||||||
* @param string $timezone convert to the given timezone.
|
* @param string $timezone convert to the given timezone.
|
||||||
* @param string $format time format to convert to
|
* @param string $format time format to convert to
|
||||||
*/
|
*/
|
||||||
public static function convertTimestampsToTimezone(&$rows, $columnsToConvert, $timezone, $format="Y-m-d H:i:s")
|
public static function convertTimestampsToTimezone(&$rows, $columnsToConvert, $timezone, $format=DEFAULT_TIMESTAMP_FORMAT)
|
||||||
{
|
{
|
||||||
$timezone = strtolower($timezone);
|
$timezone = strtolower($timezone);
|
||||||
// Check that the timezone is valid and rows is an array
|
// Check that the timezone is valid and rows is an array
|
||||||
|
@ -370,7 +370,7 @@ class Application_Common_DateHelper
|
||||||
* @param unknown $timezone the timezone to convert to
|
* @param unknown $timezone the timezone to convert to
|
||||||
* @param string $format the formatted string
|
* @param string $format the formatted string
|
||||||
*/
|
*/
|
||||||
public static function UTCStringToTimezoneString($datetime, $timezone, $format="Y-m-d H:i:s") {
|
public static function UTCStringToTimezoneString($datetime, $timezone, $format=DEFAULT_TIMESTAMP_FORMAT) {
|
||||||
$d = new DateTime($datetime, new DateTimeZone("UTC"));
|
$d = new DateTime($datetime, new DateTimeZone("UTC"));
|
||||||
$timezone = strtolower($timezone);
|
$timezone = strtolower($timezone);
|
||||||
$newTimezone = new DateTimeZone($timezone);
|
$newTimezone = new DateTimeZone($timezone);
|
||||||
|
|
|
@ -25,7 +25,7 @@ class WidgetHelper
|
||||||
$utcTimezone = new DateTimeZone("UTC");
|
$utcTimezone = new DateTimeZone("UTC");
|
||||||
|
|
||||||
$weekStartDateTime->setTimezone($utcTimezone);
|
$weekStartDateTime->setTimezone($utcTimezone);
|
||||||
$utcDayStart = $weekStartDateTime->format("Y-m-d H:i:s");
|
$utcDayStart = $weekStartDateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
for ($i = 0; $i < 14; $i++) {
|
for ($i = 0; $i < 14; $i++) {
|
||||||
//have to be in station timezone when adding 1 day for daylight savings.
|
//have to be in station timezone when adding 1 day for daylight savings.
|
||||||
$weekStartDateTime->setTimezone(new DateTimeZone($timezone));
|
$weekStartDateTime->setTimezone(new DateTimeZone($timezone));
|
||||||
|
@ -34,7 +34,7 @@ class WidgetHelper
|
||||||
//convert back to UTC to get the actual timestamp used for search.
|
//convert back to UTC to get the actual timestamp used for search.
|
||||||
$weekStartDateTime->setTimezone($utcTimezone);
|
$weekStartDateTime->setTimezone($utcTimezone);
|
||||||
|
|
||||||
$utcDayEnd = $weekStartDateTime->format("Y-m-d H:i:s");
|
$utcDayEnd = $weekStartDateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "ALL", $utcDayEnd);
|
$shows = Application_Model_Show::getNextShows($utcDayStart, "ALL", $utcDayEnd);
|
||||||
$utcDayStart = $utcDayEnd;
|
$utcDayStart = $utcDayEnd;
|
||||||
|
|
||||||
|
@ -84,11 +84,11 @@ class WidgetHelper
|
||||||
// a time of "00:00". $utcDayStart is used below when querying for shows.
|
// a time of "00:00". $utcDayStart is used below when querying for shows.
|
||||||
$utcDayStartDT = clone $weekStartDateTime;
|
$utcDayStartDT = clone $weekStartDateTime;
|
||||||
$utcDayStartDT->setTime(0, 0, 0);
|
$utcDayStartDT->setTime(0, 0, 0);
|
||||||
$utcDayStart = $utcDayStartDT->format("Y-m-d H:i:s");
|
$utcDayStart = $utcDayStartDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$weekCounter = 0;
|
$weekCounter = 0;
|
||||||
while ($weekCounter < $maxNumOFWeeks) {
|
while ($weekCounter < $maxNumOFWeeks) {
|
||||||
for ($dayOfWeekCounter = 0; $dayOfWeekCounter < DAYS_PER_WEEK; $dayOfWeekCounter++) {
|
for ($dayOfWeekCounter = 0; $dayOfWeekCounter < DAYS_PER_WEEK; $dayOfWeekCounter++) {
|
||||||
$dateParse = date_parse($weekStartDateTime->format("Y-m-d H:i:s"));
|
$dateParse = date_parse($weekStartDateTime->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
|
|
||||||
$result[$weekCounter][$dayOfWeekCounter]["dayOfMonth"] = $dateParse["day"];
|
$result[$weekCounter][$dayOfWeekCounter]["dayOfMonth"] = $dateParse["day"];
|
||||||
$result[$weekCounter][$dayOfWeekCounter]["dayOfWeek"] = strtoupper(date("D", $weekStartDateTime->getTimestamp()));
|
$result[$weekCounter][$dayOfWeekCounter]["dayOfWeek"] = strtoupper(date("D", $weekStartDateTime->getTimestamp()));
|
||||||
|
@ -104,7 +104,7 @@ class WidgetHelper
|
||||||
// a time of "00:00".
|
// a time of "00:00".
|
||||||
$utcDayEndDT = clone $weekStartDateTime;
|
$utcDayEndDT = clone $weekStartDateTime;
|
||||||
$utcDayEndDT->setTime(0, 0, 0);
|
$utcDayEndDT->setTime(0, 0, 0);
|
||||||
$utcDayEnd = $utcDayEndDT->format("Y-m-d H:i:s");
|
$utcDayEnd = $utcDayEndDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "ALL", $utcDayEnd);
|
$shows = Application_Model_Show::getNextShows($utcDayStart, "ALL", $utcDayEnd);
|
||||||
$utcDayStart = $utcDayEnd;
|
$utcDayStart = $utcDayEnd;
|
||||||
|
|
||||||
|
|
|
@ -10,15 +10,18 @@ define('COMPANY_SUFFIX' , 'z.ú.');
|
||||||
define('COMPANY_SITE' , 'Sourcefabric.org');
|
define('COMPANY_SITE' , 'Sourcefabric.org');
|
||||||
define('COMPANY_SITE_URL' , 'http://sourcefabric.org/');
|
define('COMPANY_SITE_URL' , 'http://sourcefabric.org/');
|
||||||
|
|
||||||
|
define('HELP_URL' , 'http://help.sourcefabric.org/');
|
||||||
|
define('FAQ_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/sections/200994309-Airtime-FAQ');
|
||||||
define('WHOS_USING_URL' , 'http://sourcefabric.org/en/airtime/whosusing');
|
define('WHOS_USING_URL' , 'http://sourcefabric.org/en/airtime/whosusing');
|
||||||
define('TERMS_AND_CONDITIONS_URL' , 'http://www.sourcefabric.org/en/about/policy/');
|
define('TERMS_AND_CONDITIONS_URL' , 'http://www.sourcefabric.org/en/about/policy/');
|
||||||
define('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
|
define('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
|
||||||
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters');
|
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters');
|
||||||
|
define('AIRTIME_TRANSIFEX_URL' , 'https://www.transifex.com/projects/p/airtime/');
|
||||||
|
|
||||||
define('LICENSE_VERSION' , 'GNU AGPL v.3');
|
define('LICENSE_VERSION' , 'GNU AGPL v.3');
|
||||||
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');
|
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');
|
||||||
|
|
||||||
define('AIRTIME_COPYRIGHT_DATE' , '2010-2012');
|
define('AIRTIME_COPYRIGHT_DATE' , '2010-2015');
|
||||||
define('AIRTIME_REST_VERSION' , '1.1');
|
define('AIRTIME_REST_VERSION' , '1.1');
|
||||||
define('AIRTIME_API_VERSION' , '1.1');
|
define('AIRTIME_API_VERSION' , '1.1');
|
||||||
define('AIRTIME_CODE_VERSION' , '2.5.13');
|
define('AIRTIME_CODE_VERSION' , '2.5.13');
|
||||||
|
@ -27,6 +30,7 @@ define('AIRTIME_CODE_VERSION' , '2.5.13');
|
||||||
define('DEFAULT_LOGO_PLACEHOLDER', 1);
|
define('DEFAULT_LOGO_PLACEHOLDER', 1);
|
||||||
define('DEFAULT_LOGO_FILE', 'images/airtime_logo.png');
|
define('DEFAULT_LOGO_FILE', 'images/airtime_logo.png');
|
||||||
define('DEFAULT_TIMESTAMP_FORMAT', 'Y-m-d H:i:s');
|
define('DEFAULT_TIMESTAMP_FORMAT', 'Y-m-d H:i:s');
|
||||||
|
define('DEFAULT_MICROTIME_FORMAT', 'Y-m-d H:i:s.u');
|
||||||
|
|
||||||
// Metadata Keys for files
|
// Metadata Keys for files
|
||||||
define('MDATA_KEY_FILEPATH' , 'filepath');
|
define('MDATA_KEY_FILEPATH' , 'filepath');
|
||||||
|
|
|
@ -123,7 +123,7 @@ $pages = array(
|
||||||
'pages' => array(
|
'pages' => array(
|
||||||
array(
|
array(
|
||||||
'label' => _('Help Center'),
|
'label' => _('Help Center'),
|
||||||
'uri' => "http://help.sourcefabric.org/",
|
'uri' => HELP_URL,
|
||||||
'target' => "_blank"
|
'target' => "_blank"
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -135,12 +135,12 @@ $pages = array(
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => _('FAQ'),
|
'label' => _('FAQ'),
|
||||||
'uri' => "https://sourcefabricberlin.zendesk.com/hc/en-us/sections/200994309-Airtime-FAQ",
|
'uri' => FAQ_URL,
|
||||||
'target' => "_blank"
|
'target' => "_blank"
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => _('User Manual'),
|
'label' => _('User Manual'),
|
||||||
'uri' => "http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters",
|
'uri' => USER_MANUAL_URL,
|
||||||
'target' => "_blank"
|
'target' => "_blank"
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -149,6 +149,11 @@ $pages = array(
|
||||||
'controller' => 'dashboard',
|
'controller' => 'dashboard',
|
||||||
'action' => 'about',
|
'action' => 'about',
|
||||||
'resource' => 'dashboard'
|
'resource' => 'dashboard'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'label' => _(sprintf("Help Translate %s", PRODUCT_NAME)),
|
||||||
|
'uri' => AIRTIME_TRANSIFEX_URL,
|
||||||
|
'target' => "_blank"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
|
@ -170,7 +170,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$utcTimeNow = gmdate("Y-m-d H:i:s");
|
$utcTimeNow = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$utcTimeEnd = ""; // if empty, getNextShows will use interval instead of end of day
|
$utcTimeEnd = ""; // if empty, getNextShows will use interval instead of end of day
|
||||||
|
|
||||||
// default to the station timezone
|
// default to the station timezone
|
||||||
|
@ -192,7 +192,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
// make getNextShows use end of day
|
// make getNextShows use end of day
|
||||||
$end = Application_Common_DateHelper::getTodayStationEndDateTime();
|
$end = Application_Common_DateHelper::getTodayStationEndDateTime();
|
||||||
$end->setTimezone(new DateTimeZone("UTC"));
|
$end->setTimezone(new DateTimeZone("UTC"));
|
||||||
$utcTimeEnd = $end->format("Y-m-d H:i:s");
|
$utcTimeEnd = $end->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
"env" => APPLICATION_ENV,
|
"env" => APPLICATION_ENV,
|
||||||
|
|
|
@ -57,7 +57,8 @@ class ListenerstatController extends Zend_Controller_Action
|
||||||
public function getDataAction(){
|
public function getDataAction(){
|
||||||
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($this->getRequest());
|
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($this->getRequest());
|
||||||
|
|
||||||
$data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format("Y-m-d H:i:s"), $endsDT->format("Y-m-d H:i:s"));
|
$data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
|
$endsDT->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
$this->_helper->json->sendJson($data);
|
$this->_helper->json->sendJson($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ class PluploadController extends Zend_Controller_Action
|
||||||
//TODO: $this->sanitizeResponse($upload));
|
//TODO: $this->sanitizeResponse($upload));
|
||||||
$upload['utime'] = new DateTime($upload['utime'], $utcTimezone);
|
$upload['utime'] = new DateTime($upload['utime'], $utcTimezone);
|
||||||
$upload['utime']->setTimeZone($displayTimezone);
|
$upload['utime']->setTimeZone($displayTimezone);
|
||||||
$upload['utime'] = $upload['utime']->format('Y-m-d H:i:s');
|
$upload['utime'] = $upload['utime']->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
//TODO: Invoke sanitization here (MediaController's removeBlacklist stuff)
|
//TODO: Invoke sanitization here (MediaController's removeBlacklist stuff)
|
||||||
array_push($uploadsArray, $upload);
|
array_push($uploadsArray, $upload);
|
||||||
|
|
|
@ -500,7 +500,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$utcTimezone = new DateTimeZone("UTC");
|
$utcTimezone = new DateTimeZone("UTC");
|
||||||
$nowDateTime = new DateTime("now", $utcTimezone);
|
$nowDateTime = new DateTime("now", $utcTimezone);
|
||||||
$scheduleItems = CcScheduleQuery::create()
|
$scheduleItems = CcScheduleQuery::create()
|
||||||
->filterByDbEnds($nowDateTime->format("Y-m-d H:i:s"), Criteria::GREATER_THAN)
|
->filterByDbEnds($nowDateTime->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN)
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
// Delete all the schedule items
|
// Delete all the schedule items
|
||||||
|
|
|
@ -236,8 +236,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$end->setTimezone($displayTimeZone);
|
$end->setTimezone($displayTimeZone);
|
||||||
|
|
||||||
$show_name = $instance->getCcShow()->getDbName();
|
$show_name = $instance->getCcShow()->getDbName();
|
||||||
$start_time = $start->format("Y-m-d H:i:s");
|
$start_time = $start->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$end_time = $end->format("Y-m-d H:i:s");
|
$end_time = $end->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$this->view->title = "{$show_name}: {$start_time} - {$end_time}";
|
$this->view->title = "{$show_name}: {$start_time} - {$end_time}";
|
||||||
$this->view->start = $start_time;
|
$this->view->start = $start_time;
|
||||||
|
|
|
@ -107,10 +107,17 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
{
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
if ($element->getType() != 'Zend_Form_Element_Hidden'
|
||||||
|
// We should still be able to remove the show logo
|
||||||
|
&& $element->getName() != 'add_show_logo_current_remove') {
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hideShowLogo() {
|
||||||
|
$this->removeElement('add_show_logo');
|
||||||
|
$this->removeElement('add_show_logo_preview');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,10 @@ class Application_Form_EditUser extends Zend_Form
|
||||||
array('ViewScript', array('viewScript' => 'form/edit-user.phtml', "currentUser" => $currentUser->getLogin()))));
|
array('ViewScript', array('viewScript' => 'form/edit-user.phtml', "currentUser" => $currentUser->getLogin()))));
|
||||||
$this->setAttrib('id', 'current-user-form');
|
$this->setAttrib('id', 'current-user-form');
|
||||||
|
|
||||||
$this->addElement('hash', 'csrf', array(
|
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
||||||
'salt' => 'unique'
|
$csrf_element = new Zend_Form_Element_Hidden('csrf');
|
||||||
));
|
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
|
||||||
|
$this->addElement($csrf_element);
|
||||||
|
|
||||||
$hidden = new Zend_Form_Element_Hidden('cu_user_id');
|
$hidden = new Zend_Form_Element_Hidden('cu_user_id');
|
||||||
$hidden->setDecorators(array('ViewHelper'));
|
$hidden->setDecorators(array('ViewHelper'));
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Application_Model_Auth
|
||||||
$info->setDbUserId($user_id);
|
$info->setDbUserId($user_id);
|
||||||
$info->setDbAction($action);
|
$info->setDbAction($action);
|
||||||
$info->setDbToken(sha1($token.$salt));
|
$info->setDbToken(sha1($token.$salt));
|
||||||
$info->setDbCreated(gmdate('Y-m-d H:i:s'));
|
$info->setDbCreated(gmdate(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
$info->save();
|
$info->save();
|
||||||
|
|
||||||
Logging::debug("generated token {$token}");
|
Logging::debug("generated token {$token}");
|
||||||
|
|
|
@ -44,7 +44,7 @@ SQL;
|
||||||
$t = new DateTime($r['timestamp'], $utcTimezone);
|
$t = new DateTime($r['timestamp'], $utcTimezone);
|
||||||
$t->setTimezone($displayTimezone);
|
$t->setTimezone($displayTimezone);
|
||||||
// tricking javascript so it thinks the server timezone is in UTC
|
// tricking javascript so it thinks the server timezone is in UTC
|
||||||
$dt = new DateTime($t->format("Y-m-d H:i:s"), $utcTimezone);
|
$dt = new DateTime($t->format(DEFAULT_TIMESTAMP_FORMAT), $utcTimezone);
|
||||||
|
|
||||||
$r['timestamp'] = $dt->format("U");
|
$r['timestamp'] = $dt->format("U");
|
||||||
$out[$r['mount_name']][] = $r;
|
$out[$r['mount_name']][] = $r;
|
||||||
|
|
|
@ -275,7 +275,7 @@ class Application_Model_LiveLog
|
||||||
if ($log['end_time'] == null) {
|
if ($log['end_time'] == null) {
|
||||||
$current_time = new DateTime("now", new DateTimeZone('UTC'));
|
$current_time = new DateTime("now", new DateTimeZone('UTC'));
|
||||||
$log['end_time'] = $current_time;
|
$log['end_time'] = $current_time;
|
||||||
$log['end_time'] = $log['end_time']->format("Y-m-d H:i:s");
|
$log['end_time'] = $log['end_time']->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
self::SetEndTime($log['state'], $current_time, true);
|
self::SetEndTime($log['state'], $current_time, true);
|
||||||
self::SetNewLogTime($log['state'], $current_time);
|
self::SetNewLogTime($log['state'], $current_time);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ class Application_Model_LiveLog
|
||||||
." VALUES (:state, :start)";
|
." VALUES (:state, :start)";
|
||||||
$params = array(
|
$params = array(
|
||||||
':state'=>$state,
|
':state'=>$state,
|
||||||
':start'=>$dateTime->format("Y-m-d H:i:s")
|
':start'=>$dateTime->format(DEFAULT_TIMESTAMP_FORMAT)
|
||||||
);
|
);
|
||||||
Application_Common_Database::prepareAndExecute($sql_insert, $params,
|
Application_Common_Database::prepareAndExecute($sql_insert, $params,
|
||||||
Application_Common_Database::EXECUTE);
|
Application_Common_Database::EXECUTE);
|
||||||
|
@ -346,7 +346,7 @@ class Application_Model_LiveLog
|
||||||
." SET end_time = :end"
|
." SET end_time = :end"
|
||||||
." WHERE id = :id";
|
." WHERE id = :id";
|
||||||
$params = array(
|
$params = array(
|
||||||
':end'=>$dateTime->format("Y-m-d H:i:s"),
|
':end'=>$dateTime->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':id'=>$row['id']
|
':id'=>$row['id']
|
||||||
);
|
);
|
||||||
Application_Common_Database::prepareAndExecute($update_sql, $params,
|
Application_Common_Database::prepareAndExecute($update_sql, $params,
|
||||||
|
|
|
@ -211,7 +211,7 @@ class Application_Model_Preference
|
||||||
public static function SetShowsPopulatedUntil($dateTime)
|
public static function SetShowsPopulatedUntil($dateTime)
|
||||||
{
|
{
|
||||||
$dateTime->setTimezone(new DateTimeZone("UTC"));
|
$dateTime->setTimezone(new DateTimeZone("UTC"));
|
||||||
self::setValue("shows_populated_until", $dateTime->format("Y-m-d H:i:s"));
|
self::setValue("shows_populated_until", $dateTime->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -625,7 +625,7 @@ class Application_Model_Preference
|
||||||
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
|
$outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount();
|
||||||
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
|
$outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount();
|
||||||
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();
|
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Application_Model_Schedule::getSchduledPlaylistCount();
|
||||||
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(gmdate("Y-m-d H:i:s"));
|
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(gmdate(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
$outputArray['UNIQUE_ID'] = self::GetUniqueId();
|
$outputArray['UNIQUE_ID'] = self::GetUniqueId();
|
||||||
$outputArray['SAAS'] = self::GetPlanLevel();
|
$outputArray['SAAS'] = self::GetPlanLevel();
|
||||||
$outputArray['TRIAL_END_DATE'] = self::GetTrialEndingDate();
|
$outputArray['TRIAL_END_DATE'] = self::GetTrialEndingDate();
|
||||||
|
|
|
@ -98,7 +98,7 @@ SQL;
|
||||||
$end = new DateTime();
|
$end = new DateTime();
|
||||||
$end->add(new DateInterval("P2D")); // Add 2 days
|
$end->add(new DateInterval("P2D")); // Add 2 days
|
||||||
$end->setTimezone(new DateTimeZone("UTC"));
|
$end->setTimezone(new DateTimeZone("UTC"));
|
||||||
$utcTimeEnd = $end->format("Y-m-d H:i:s");
|
$utcTimeEnd = $end->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
$utcNow = new DateTime("now", new DateTimeZone("UTC"));
|
$utcNow = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
|
@ -111,7 +111,7 @@ SQL;
|
||||||
$range = array(
|
$range = array(
|
||||||
"station" => array (
|
"station" => array (
|
||||||
"env" => APPLICATION_ENV,
|
"env" => APPLICATION_ENV,
|
||||||
"schedulerTime" => $utcNow->format("Y-m-d H:i:s"),
|
"schedulerTime" => $utcNow->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
"source_enabled" => $source
|
"source_enabled" => $source
|
||||||
),
|
),
|
||||||
//Previous, current, next songs!
|
//Previous, current, next songs!
|
||||||
|
@ -148,7 +148,7 @@ SQL;
|
||||||
|
|
||||||
$range = array(
|
$range = array(
|
||||||
"env" => APPLICATION_ENV,
|
"env" => APPLICATION_ENV,
|
||||||
"schedulerTime" => $utcNow->format("Y-m-d H:i:s"),
|
"schedulerTime" => $utcNow->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
//Previous, current, next songs!
|
//Previous, current, next songs!
|
||||||
"previous"=>$results['previous'] !=null?$results['previous']:(count($shows['previousShow'])>0?$shows['previousShow'][0]:null),
|
"previous"=>$results['previous'] !=null?$results['previous']:(count($shows['previousShow'])>0?$shows['previousShow'][0]:null),
|
||||||
"current"=>$results['current'] !=null?$results['current']:((count($shows['currentShow'])>0 && $shows['currentShow'][0]['record'] == 1)?$shows['currentShow'][0]:null),
|
"current"=>$results['current'] !=null?$results['current']:((count($shows['currentShow'])>0 && $shows['currentShow'][0]['record'] == 1)?$shows['currentShow'][0]:null),
|
||||||
|
@ -410,13 +410,13 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows, $p_show_instances)
|
public static function GetScheduleDetailItems($p_start, $p_end, $p_shows, $p_show_instances)
|
||||||
{
|
{
|
||||||
$p_start_str = $p_start->format("Y-m-d H:i:s");
|
$p_start_str = $p_start->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$p_end_str = $p_end->format("Y-m-d H:i:s");
|
$p_end_str = $p_end->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
//We need to search 48 hours before and after the show times so that that we
|
//We need to search 48 hours before and after the show times so that that we
|
||||||
//capture all of the show's contents.
|
//capture all of the show's contents.
|
||||||
$p_track_start= $p_start->sub(new DateInterval("PT48H"))->format("Y-m-d H:i:s");
|
$p_track_start= $p_start->sub(new DateInterval("PT48H"))->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$p_track_end = $p_end->add(new DateInterval("PT48H"))->format("Y-m-d H:i:s");
|
$p_track_end = $p_end->add(new DateInterval("PT48H"))->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$templateSql = <<<SQL
|
$templateSql = <<<SQL
|
||||||
SELECT DISTINCT sched.starts AS sched_starts,
|
SELECT DISTINCT sched.starts AS sched_starts,
|
||||||
|
@ -600,7 +600,7 @@ SQL;
|
||||||
|
|
||||||
public static function UpdateBrodcastedStatus($dateTime, $value)
|
public static function UpdateBrodcastedStatus($dateTime, $value)
|
||||||
{
|
{
|
||||||
$now = $dateTime->format("Y-m-d H:i:s");
|
$now = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
UPDATE cc_schedule
|
UPDATE cc_schedule
|
||||||
|
@ -762,7 +762,7 @@ SQL;
|
||||||
if (count($rows) < 3) {
|
if (count($rows) < 3) {
|
||||||
$dt = new DateTime("@".time());
|
$dt = new DateTime("@".time());
|
||||||
$dt->add(new DateInterval("PT24H"));
|
$dt->add(new DateInterval("PT24H"));
|
||||||
$range_end = $dt->format("Y-m-d H:i:s");
|
$range_end = $dt->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$predicates = <<<SQL
|
$predicates = <<<SQL
|
||||||
WHERE st.ends > :startTime1
|
WHERE st.ends > :startTime1
|
||||||
|
@ -814,7 +814,7 @@ SQL;
|
||||||
$transition_time = intval($temp[0]);
|
$transition_time = intval($temp[0]);
|
||||||
$switchOffDataTime = new DateTime($kick_time, $utcTimeZone);
|
$switchOffDataTime = new DateTime($kick_time, $utcTimeZone);
|
||||||
$switch_off_time = $switchOffDataTime->sub(new DateInterval('PT'.$transition_time.'S'));
|
$switch_off_time = $switchOffDataTime->sub(new DateInterval('PT'.$transition_time.'S'));
|
||||||
$switch_off_time = $switch_off_time->format("Y-m-d H:i:s");
|
$switch_off_time = $switch_off_time->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$kick_start = self::AirtimeTimeToPypoTime($kick_time);
|
$kick_start = self::AirtimeTimeToPypoTime($kick_time);
|
||||||
$data["media"][$kick_start]['start'] = $kick_start;
|
$data["media"][$kick_start]['start'] = $kick_start;
|
||||||
|
@ -900,7 +900,7 @@ SQL;
|
||||||
$buffer_start = new DateTime($item["start"], new DateTimeZone('UTC'));
|
$buffer_start = new DateTime($item["start"], new DateTimeZone('UTC'));
|
||||||
$buffer_start->sub(new DateInterval("PT5S"));
|
$buffer_start->sub(new DateInterval("PT5S"));
|
||||||
|
|
||||||
$stream_buffer_start = self::AirtimeTimeToPypoTime($buffer_start->format("Y-m-d H:i:s"));
|
$stream_buffer_start = self::AirtimeTimeToPypoTime($buffer_start->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
|
|
||||||
$schedule_item = array(
|
$schedule_item = array(
|
||||||
'start' => $stream_buffer_start,
|
'start' => $stream_buffer_start,
|
||||||
|
@ -930,7 +930,7 @@ SQL;
|
||||||
$dt = new DateTime($item["end"], new DateTimeZone('UTC'));
|
$dt = new DateTime($item["end"], new DateTimeZone('UTC'));
|
||||||
$dt->sub(new DateInterval("PT1S"));
|
$dt->sub(new DateInterval("PT1S"));
|
||||||
|
|
||||||
$stream_end = self::AirtimeTimeToPypoTime($dt->format("Y-m-d H:i:s"));
|
$stream_end = self::AirtimeTimeToPypoTime($dt->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
|
|
||||||
$schedule_item = array(
|
$schedule_item = array(
|
||||||
'start' => $stream_end,
|
'start' => $stream_end,
|
||||||
|
@ -962,7 +962,7 @@ SQL;
|
||||||
then set range * from "now" to "now + 24 hours". */
|
then set range * from "now" to "now + 24 hours". */
|
||||||
if (is_null($p_fromDateTime)) {
|
if (is_null($p_fromDateTime)) {
|
||||||
$t1 = new DateTime("@".time(), $utcTimeZone);
|
$t1 = new DateTime("@".time(), $utcTimeZone);
|
||||||
$range_start = $t1->format("Y-m-d H:i:s");
|
$range_start = $t1->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
} else {
|
} else {
|
||||||
$range_start = Application_Model_Schedule::PypoTimeToAirtimeTime($p_fromDateTime);
|
$range_start = Application_Model_Schedule::PypoTimeToAirtimeTime($p_fromDateTime);
|
||||||
}
|
}
|
||||||
|
@ -979,7 +979,7 @@ SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$t2->add(new DateInterval("PT".$cache_ahead_hours."H"));
|
$t2->add(new DateInterval("PT".$cache_ahead_hours."H"));
|
||||||
$range_end = $t2->format("Y-m-d H:i:s");
|
$range_end = $t2->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
} else {
|
} else {
|
||||||
$range_end = Application_Model_Schedule::PypoTimeToAirtimeTime($p_toDateTime);
|
$range_end = Application_Model_Schedule::PypoTimeToAirtimeTime($p_toDateTime);
|
||||||
}
|
}
|
||||||
|
@ -1008,7 +1008,7 @@ SQL;
|
||||||
$di = $trackStartDateTime->diff($showEndDateTime);
|
$di = $trackStartDateTime->diff($showEndDateTime);
|
||||||
|
|
||||||
$item["cue_out"] = $di->format("%H:%i:%s").".000";
|
$item["cue_out"] = $di->format("%H:%i:%s").".000";
|
||||||
$item["end"] = $showEndDateTime->format("Y-m-d H:i:s");
|
$item["end"] = $showEndDateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($item['file_id'])) {
|
if (!is_null($item['file_id'])) {
|
||||||
|
@ -1138,7 +1138,7 @@ SQL;
|
||||||
if (!is_null($showId)) {
|
if (!is_null($showId)) {
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()
|
$ccShowInstance = CcShowInstancesQuery::create()
|
||||||
->filterByDbShowId($showId)
|
->filterByDbShowId($showId)
|
||||||
->filterByDbStarts($show_start->format("Y-m-d H:i:s"))
|
->filterByDbStarts($show_start->format(DEFAULT_TIMESTAMP_FORMAT))
|
||||||
->findOne();
|
->findOne();
|
||||||
} elseif (!is_null($instanceId)) {
|
} elseif (!is_null($instanceId)) {
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()
|
$ccShowInstance = CcShowInstancesQuery::create()
|
||||||
|
@ -1152,9 +1152,9 @@ SQL;
|
||||||
$overlapping = false;
|
$overlapping = false;
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':show_end1' => $show_end->format('Y-m-d H:i:s'),
|
':show_end1' => $show_end->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':show_end2' => $show_end->format('Y-m-d H:i:s'),
|
':show_end2' => $show_end->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':show_end3' => $show_end->format('Y-m-d H:i:s')
|
':show_end3' => $show_end->format(DEFAULT_TIMESTAMP_FORMAT)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1201,9 +1201,9 @@ ORDER BY ends
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$rows = Application_Common_Database::prepareAndExecute($sql, array(
|
$rows = Application_Common_Database::prepareAndExecute($sql, array(
|
||||||
':show_end1' => $show_end->format('Y-m-d H:i:s'),
|
':show_end1' => $show_end->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':show_end2' => $show_end->format('Y-m-d H:i:s'),
|
':show_end2' => $show_end->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':show_end3' => $show_end->format('Y-m-d H:i:s')), 'all');
|
':show_end3' => $show_end->format(DEFAULT_TIMESTAMP_FORMAT)), 'all');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
|
|
@ -170,7 +170,7 @@ class Application_Model_Scheduler
|
||||||
//get all the linked shows instances and check if
|
//get all the linked shows instances and check if
|
||||||
//any of them are currently playing
|
//any of them are currently playing
|
||||||
$ccShowInstances = $ccShow->getCcShowInstancess();
|
$ccShowInstances = $ccShow->getCcShowInstancess();
|
||||||
$timeNowUTC = gmdate("Y-m-d H:i:s");
|
$timeNowUTC = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
foreach ($ccShowInstances as $ccShowInstance) {
|
foreach ($ccShowInstances as $ccShowInstance) {
|
||||||
|
|
||||||
if ($ccShowInstance->getDbStarts() <= $timeNowUTC &&
|
if ($ccShowInstance->getDbStarts() <= $timeNowUTC &&
|
||||||
|
@ -472,8 +472,8 @@ class Application_Model_Scheduler
|
||||||
$itemEndDT = $this->findEndTime($itemStartDT, $item["clip_length"]);
|
$itemEndDT = $this->findEndTime($itemStartDT, $item["clip_length"]);
|
||||||
|
|
||||||
$update_sql = "UPDATE cc_schedule SET ".
|
$update_sql = "UPDATE cc_schedule SET ".
|
||||||
"starts = '{$itemStartDT->format("Y-m-d H:i:s.u")}', ".
|
"starts = '{$itemStartDT->format(DEFAULT_MICROTIME_FORMAT)}', ".
|
||||||
"ends = '{$itemEndDT->format("Y-m-d H:i:s.u")}' ".
|
"ends = '{$itemEndDT->format(DEFAULT_MICROTIME_FORMAT)}' ".
|
||||||
"WHERE id = {$item["id"]}";
|
"WHERE id = {$item["id"]}";
|
||||||
Application_Common_Database::prepareAndExecute(
|
Application_Common_Database::prepareAndExecute(
|
||||||
$update_sql, array(), Application_Common_Database::EXECUTE);
|
$update_sql, array(), Application_Common_Database::EXECUTE);
|
||||||
|
@ -608,7 +608,7 @@ class Application_Model_Scheduler
|
||||||
if ($linked) {
|
if ($linked) {
|
||||||
$instances = CcShowInstancesQuery::create()
|
$instances = CcShowInstancesQuery::create()
|
||||||
->filterByDbShowId($ccShow["id"])
|
->filterByDbShowId($ccShow["id"])
|
||||||
->filterByDbStarts(gmdate("Y-m-d H:i:s"), Criteria::GREATER_THAN)
|
->filterByDbStarts(gmdate(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN)
|
||||||
->find();
|
->find();
|
||||||
} else {
|
} else {
|
||||||
$instances = CcShowInstancesQuery::create()
|
$instances = CcShowInstancesQuery::create()
|
||||||
|
@ -807,8 +807,8 @@ class Application_Model_Scheduler
|
||||||
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
|
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
|
||||||
if ($doInsert) {
|
if ($doInsert) {
|
||||||
$values[] = "(".
|
$values[] = "(".
|
||||||
"'{$nextStartDT->format("Y-m-d H:i:s.u")}', ".
|
"'{$nextStartDT->format(DEFAULT_MICROTIME_FORMAT)}', ".
|
||||||
"'{$endTimeDT->format("Y-m-d H:i:s.u")}', ".
|
"'{$endTimeDT->format(DEFAULT_MICROTIME_FORMAT)}', ".
|
||||||
"'{$file["cuein"]}', ".
|
"'{$file["cuein"]}', ".
|
||||||
"'{$file["cueout"]}', ".
|
"'{$file["cueout"]}', ".
|
||||||
"'{$file["fadein"]}', ".
|
"'{$file["fadein"]}', ".
|
||||||
|
@ -821,8 +821,8 @@ class Application_Model_Scheduler
|
||||||
|
|
||||||
} elseif ($doUpdate) {
|
} elseif ($doUpdate) {
|
||||||
$update_sql = "UPDATE cc_schedule SET ".
|
$update_sql = "UPDATE cc_schedule SET ".
|
||||||
"starts = '{$nextStartDT->format("Y-m-d H:i:s.u")}', ".
|
"starts = '{$nextStartDT->format(DEFAULT_MICROTIME_FORMAT)}', ".
|
||||||
"ends = '{$endTimeDT->format("Y-m-d H:i:s.u")}', ".
|
"ends = '{$endTimeDT->format(DEFAULT_MICROTIME_FORMAT)}', ".
|
||||||
"cue_in = '{$file["cuein"]}', ".
|
"cue_in = '{$file["cuein"]}', ".
|
||||||
"cue_out = '{$file["cueout"]}', ".
|
"cue_out = '{$file["cueout"]}', ".
|
||||||
"fade_in = '{$file["fadein"]}', ".
|
"fade_in = '{$file["fadein"]}', ".
|
||||||
|
@ -871,7 +871,7 @@ class Application_Model_Scheduler
|
||||||
if ($adjustSched === true) {
|
if ($adjustSched === true) {
|
||||||
|
|
||||||
$followingItems_sql = "SELECT * FROM cc_schedule ".
|
$followingItems_sql = "SELECT * FROM cc_schedule ".
|
||||||
"WHERE starts >= '{$initalStartDT->format("Y-m-d H:i:s.u")}' ".
|
"WHERE starts >= '{$initalStartDT->format(DEFAULT_MICROTIME_FORMAT)}' ".
|
||||||
"AND instance_id = {$instanceId} ";
|
"AND instance_id = {$instanceId} ";
|
||||||
if (count($excludeIds) > 0) {
|
if (count($excludeIds) > 0) {
|
||||||
$followingItems_sql .= "AND id NOT IN (". implode($excludeIds, ",").") ";
|
$followingItems_sql .= "AND id NOT IN (". implode($excludeIds, ",").") ";
|
||||||
|
@ -887,8 +887,8 @@ class Application_Model_Scheduler
|
||||||
$endTimeDT = $this->findEndTime($nextStartDT, $item["clip_length"]);
|
$endTimeDT = $this->findEndTime($nextStartDT, $item["clip_length"]);
|
||||||
$endTimeDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration);
|
$endTimeDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration);
|
||||||
$update_sql = "UPDATE cc_schedule SET ".
|
$update_sql = "UPDATE cc_schedule SET ".
|
||||||
"starts = '{$nextStartDT->format("Y-m-d H:i:s.u")}', ".
|
"starts = '{$nextStartDT->format(DEFAULT_MICROTIME_FORMAT)}', ".
|
||||||
"ends = '{$endTimeDT->format("Y-m-d H:i:s.u")}', ".
|
"ends = '{$endTimeDT->format(DEFAULT_MICROTIME_FORMAT)}', ".
|
||||||
"position = {$pos} ".
|
"position = {$pos} ".
|
||||||
"WHERE id = {$item["id"]}";
|
"WHERE id = {$item["id"]}";
|
||||||
Application_Common_Database::prepareAndExecute(
|
Application_Common_Database::prepareAndExecute(
|
||||||
|
|
|
@ -305,7 +305,7 @@ SQL;
|
||||||
array(
|
array(
|
||||||
':deltaDay1' => "$deltaDay days",
|
':deltaDay1' => "$deltaDay days",
|
||||||
':interval1' => "$hours:$mins",
|
':interval1' => "$hours:$mins",
|
||||||
':current_timestamp1' => $nowDateTime->format("Y-m-d H:i:s"),
|
':current_timestamp1' => $nowDateTime->format(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':deltaDay2' => "$deltaDay days",
|
':deltaDay2' => "$deltaDay days",
|
||||||
':interval2' => "$hours:$mins"
|
':interval2' => "$hours:$mins"
|
||||||
), "execute");
|
), "execute");
|
||||||
|
@ -336,7 +336,7 @@ SQL;
|
||||||
CcShowInstancesPeer::clearInstancePool();
|
CcShowInstancesPeer::clearInstancePool();
|
||||||
|
|
||||||
$instances = CcShowInstancesQuery::create()
|
$instances = CcShowInstancesQuery::create()
|
||||||
->filterByDbEnds($nowDateTime->format("Y-m-d H:i:s"), Criteria::GREATER_THAN)
|
->filterByDbEnds($nowDateTime->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN)
|
||||||
->filterByDbId($instanceIds, Criteria::IN)
|
->filterByDbId($instanceIds, Criteria::IN)
|
||||||
->find($con);
|
->find($con);
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ WHERE starts > :timestamp::TIMESTAMP
|
||||||
AND show_id = :showId
|
AND show_id = :showId
|
||||||
SQL;
|
SQL;
|
||||||
Application_Common_Database::prepareAndExecute( $sql,
|
Application_Common_Database::prepareAndExecute( $sql,
|
||||||
array( ':timestamp' => gmdate("Y-m-d H:i:s"),
|
array( ':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':showId' => $this->getId()), 'execute');
|
':showId' => $this->getId()), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +544,7 @@ WHERE starts > :timestamp::TIMESTAMP
|
||||||
SQL;
|
SQL;
|
||||||
Application_Common_Database::prepareAndExecute( $sql,
|
Application_Common_Database::prepareAndExecute( $sql,
|
||||||
array( ':showId' => $this->getId(),
|
array( ':showId' => $this->getId(),
|
||||||
':timestamp' => gmdate("Y-m-d H:i:s")), 'execute');
|
':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT)), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -658,7 +658,7 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function isStartDateTimeInPast()
|
public function isStartDateTimeInPast()
|
||||||
{
|
{
|
||||||
return (gmdate("Y-m-d H:i:s") > ($this->getStartDate()." ".$this->getStartTime()));
|
return (gmdate(DEFAULT_TIMESTAMP_FORMAT) > ($this->getStartDate()." ".$this->getStartTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -679,7 +679,7 @@ WHERE show_id = :showId
|
||||||
SQL;
|
SQL;
|
||||||
$rows = Application_Common_Database::prepareAndExecute($sql,
|
$rows = Application_Common_Database::prepareAndExecute($sql,
|
||||||
array( ':showId' => $this->getId(),
|
array( ':showId' => $this->getId(),
|
||||||
':timestamp' => gmdate("Y-m-d H:i:s")), "all");
|
':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT)), "all");
|
||||||
|
|
||||||
$res = array();
|
$res = array();
|
||||||
foreach ($rows as $r) {
|
foreach ($rows as $r) {
|
||||||
|
@ -699,7 +699,7 @@ SQL;
|
||||||
{
|
{
|
||||||
//need to update cc_show_instances, cc_show_days
|
//need to update cc_show_instances, cc_show_days
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$timestamp = gmdate("Y-m-d H:i:s");
|
$timestamp = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$stmt = $con->prepare("UPDATE cc_show_days "
|
$stmt = $con->prepare("UPDATE cc_show_days "
|
||||||
."SET duration = :add_show_duration "
|
."SET duration = :add_show_duration "
|
||||||
|
@ -811,7 +811,7 @@ SQL;
|
||||||
* row in the cc_show_instances table. */
|
* row in the cc_show_instances table. */
|
||||||
public function getInstanceOnDate($p_dateTime)
|
public function getInstanceOnDate($p_dateTime)
|
||||||
{
|
{
|
||||||
$timestamp = $p_dateTime->format("Y-m-d H:i:s");
|
$timestamp = $p_dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM cc_show_instances
|
FROM cc_show_instances
|
||||||
|
@ -898,8 +898,8 @@ LEFT JOIN cc_files AS f ON f.id = si1.file_id
|
||||||
WHERE si1.modified_instance = FALSE
|
WHERE si1.modified_instance = FALSE
|
||||||
SQL;
|
SQL;
|
||||||
//only want shows that are starting at the time or later.
|
//only want shows that are starting at the time or later.
|
||||||
$start_string = $start_timestamp->format("Y-m-d H:i:s");
|
$start_string = $start_timestamp->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$end_string = $end_timestamp->format("Y-m-d H:i:s");
|
$end_string = $end_timestamp->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
|
@ -1012,8 +1012,8 @@ SQL;
|
||||||
|
|
||||||
$event["id"] = intval($show["instance_id"]);
|
$event["id"] = intval($show["instance_id"]);
|
||||||
$event["title"] = $show["name"];
|
$event["title"] = $show["name"];
|
||||||
$event["start"] = $startsDT->format("Y-m-d H:i:s");
|
$event["start"] = $startsDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$event["end"] = $endsDT->format("Y-m-d H:i:s");
|
$event["end"] = $endsDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$event["allDay"] = false;
|
$event["allDay"] = false;
|
||||||
$event["showId"] = intval($show["show_id"]);
|
$event["showId"] = intval($show["show_id"]);
|
||||||
$event["linked"] = intval($show["linked"]);
|
$event["linked"] = intval($show["linked"]);
|
||||||
|
@ -1080,7 +1080,7 @@ SQL;
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
if ($timeNow == null) {
|
if ($timeNow == null) {
|
||||||
$timeNow = gmdate("Y-m-d H:i:s");
|
$timeNow = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
}
|
}
|
||||||
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
|
@ -1169,7 +1169,7 @@ SQL;
|
||||||
|
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
|
|
||||||
$utcNowStr = $utcNow->format("Y-m-d H:i:s");
|
$utcNowStr = $utcNow->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$stmt->bindValue(':timeNow', $utcNowStr);
|
$stmt->bindValue(':timeNow', $utcNowStr);
|
||||||
$stmt->bindValue(':timeEnd', $utcEndStr);
|
$stmt->bindValue(':timeEnd', $utcEndStr);
|
||||||
$stmt->bindValue(':lim', $showsToRetrieve);
|
$stmt->bindValue(':lim', $showsToRetrieve);
|
||||||
|
@ -1250,7 +1250,7 @@ SQL;
|
||||||
|
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
|
|
||||||
$utcNowStr = $utcNow->format("Y-m-d H:i:s");
|
$utcNowStr = $utcNow->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$stmt->bindValue(':timeNow1', $utcNowStr);
|
$stmt->bindValue(':timeNow1', $utcNowStr);
|
||||||
$stmt->bindValue(':timeNow2', $utcNowStr);
|
$stmt->bindValue(':timeNow2', $utcNowStr);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Application_Model_ShowInstance
|
||||||
|
|
||||||
public function deleteRebroadcasts()
|
public function deleteRebroadcasts()
|
||||||
{
|
{
|
||||||
$timestamp = gmdate("Y-m-d H:i:s");
|
$timestamp = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$instance_id = $this->getShowInstanceId();
|
$instance_id = $this->getShowInstanceId();
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
DELETE FROM cc_show_instances
|
DELETE FROM cc_show_instances
|
||||||
|
@ -86,18 +86,18 @@ SQL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the start time of the Show (UTC time)
|
* Return the start time of the Show (UTC time)
|
||||||
* @return string in format "Y-m-d H:i:s" (PHP time notation)
|
* @return string in format DEFAULT_TIMESTAMP_FORMAT (PHP time notation)
|
||||||
*/
|
*/
|
||||||
public function getShowInstanceStart($format="Y-m-d H:i:s")
|
public function getShowInstanceStart($format=DEFAULT_TIMESTAMP_FORMAT)
|
||||||
{
|
{
|
||||||
return $this->_showInstance->getDbStarts($format);
|
return $this->_showInstance->getDbStarts($format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the end time of the Show (UTC time)
|
* Return the end time of the Show (UTC time)
|
||||||
* @return string in format "Y-m-d H:i:s" (PHP time notation)
|
* @return string in format DEFAULT_TIMESTAMP_FORMAT (PHP time notation)
|
||||||
*/
|
*/
|
||||||
public function getShowInstanceEnd($format="Y-m-d H:i:s")
|
public function getShowInstanceEnd($format=DEFAULT_TIMESTAMP_FORMAT)
|
||||||
{
|
{
|
||||||
return $this->_showInstance->getDbEnds($format);
|
return $this->_showInstance->getDbEnds($format);
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ SQL;
|
||||||
|
|
||||||
$show = $this->getShow();
|
$show = $this->getShow();
|
||||||
|
|
||||||
$current_timestamp = gmdate("Y-m-d H:i:s");
|
$current_timestamp = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
if ($current_timestamp <= $this->getShowInstanceEnd()) {
|
if ($current_timestamp <= $this->getShowInstanceEnd()) {
|
||||||
if ($show->isRepeating()) {
|
if ($show->isRepeating()) {
|
||||||
|
@ -610,7 +610,7 @@ SQL;
|
||||||
|
|
||||||
$dt = new DateTime($row["starts"], $utcTimezone);
|
$dt = new DateTime($row["starts"], $utcTimezone);
|
||||||
$dt->setTimezone($displayTimezone);
|
$dt->setTimezone($displayTimezone);
|
||||||
$row["starts"] = $dt->format("Y-m-d H:i:s");
|
$row["starts"] = $dt->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
if (isset($row['length'])) {
|
if (isset($row['length'])) {
|
||||||
$formatter = new LengthFormatter($row["length"]);
|
$formatter = new LengthFormatter($row["length"]);
|
||||||
|
|
|
@ -924,16 +924,16 @@ SQL;
|
||||||
//convert mtime and utime to localtime
|
//convert mtime and utime to localtime
|
||||||
$row['mtime'] = new DateTime($row['mtime'], $utcTimezone);
|
$row['mtime'] = new DateTime($row['mtime'], $utcTimezone);
|
||||||
$row['mtime']->setTimeZone($displayTimezone);
|
$row['mtime']->setTimeZone($displayTimezone);
|
||||||
$row['mtime'] = $row['mtime']->format('Y-m-d H:i:s');
|
$row['mtime'] = $row['mtime']->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$row['utime'] = new DateTime($row['utime'], $utcTimezone);
|
$row['utime'] = new DateTime($row['utime'], $utcTimezone);
|
||||||
$row['utime']->setTimeZone($displayTimezone);
|
$row['utime']->setTimeZone($displayTimezone);
|
||||||
$row['utime'] = $row['utime']->format('Y-m-d H:i:s');
|
$row['utime'] = $row['utime']->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
//need to convert last played to localtime if it exists.
|
//need to convert last played to localtime if it exists.
|
||||||
if (isset($row['lptime'])) {
|
if (isset($row['lptime'])) {
|
||||||
$row['lptime'] = new DateTime($row['lptime'], $utcTimezone);
|
$row['lptime'] = new DateTime($row['lptime'], $utcTimezone);
|
||||||
$row['lptime']->setTimeZone($displayTimezone);
|
$row['lptime']->setTimeZone($displayTimezone);
|
||||||
$row['lptime'] = $row['lptime']->format('Y-m-d H:i:s');
|
$row['lptime'] = $row['lptime']->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to initalize the checkbox and image row because we do not retrieve
|
// we need to initalize the checkbox and image row because we do not retrieve
|
||||||
|
@ -1213,7 +1213,7 @@ SQL;
|
||||||
$futureScheduledFilesSelectCriteria = new Criteria();
|
$futureScheduledFilesSelectCriteria = new Criteria();
|
||||||
$futureScheduledFilesSelectCriteria->addSelectColumn(CcSchedulePeer::FILE_ID);
|
$futureScheduledFilesSelectCriteria->addSelectColumn(CcSchedulePeer::FILE_ID);
|
||||||
$futureScheduledFilesSelectCriteria->setDistinct();
|
$futureScheduledFilesSelectCriteria->setDistinct();
|
||||||
$futureScheduledFilesSelectCriteria->add(CcSchedulePeer::ENDS, gmdate("Y-m-d H:i:s"), Criteria::GREATER_THAN);
|
$futureScheduledFilesSelectCriteria->add(CcSchedulePeer::ENDS, gmdate(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN);
|
||||||
$stmt = CcSchedulePeer::doSelectStmt($futureScheduledFilesSelectCriteria);
|
$stmt = CcSchedulePeer::doSelectStmt($futureScheduledFilesSelectCriteria);
|
||||||
$filesScheduledInFuture = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
|
$filesScheduledInFuture = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ class Application_Service_CalendarService
|
||||||
//check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts.
|
//check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts.
|
||||||
$rebroadcasts = CcShowInstancesQuery::create()
|
$rebroadcasts = CcShowInstancesQuery::create()
|
||||||
->filterByDbOriginalShow($this->ccShow->getDbId())
|
->filterByDbOriginalShow($this->ccShow->getDbId())
|
||||||
->filterByDbStarts($minRebroadcastStart->format('Y-m-d H:i:s'), Criteria::LESS_THAN)
|
->filterByDbStarts($minRebroadcastStart->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::LESS_THAN)
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
if (count($rebroadcasts) > 0) {
|
if (count($rebroadcasts) > 0) {
|
||||||
|
|
|
@ -28,8 +28,8 @@ class Application_Service_HistoryService
|
||||||
$paramMap = array();
|
$paramMap = array();
|
||||||
$sqlTypes = $this->getSqlTypes();
|
$sqlTypes = $this->getSqlTypes();
|
||||||
|
|
||||||
$start = $startDT->format("Y-m-d H:i:s");
|
$start = $startDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$end = $endDT->format("Y-m-d H:i:s");
|
$end = $endDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$template = $this->getConfiguredItemTemplate();
|
$template = $this->getConfiguredItemTemplate();
|
||||||
$fields = $template["fields"];
|
$fields = $template["fields"];
|
||||||
|
@ -292,13 +292,13 @@ class Application_Service_HistoryService
|
||||||
//need to display the results in the station's timezone.
|
//need to display the results in the station's timezone.
|
||||||
$dateTime = new DateTime($result["starts"], $timezoneUTC);
|
$dateTime = new DateTime($result["starts"], $timezoneUTC);
|
||||||
$dateTime->setTimezone($timezoneLocal);
|
$dateTime->setTimezone($timezoneLocal);
|
||||||
$result["starts"] = $dateTime->format("Y-m-d H:i:s");
|
$result["starts"] = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
//if ends is null we don't want it to default to "now"
|
//if ends is null we don't want it to default to "now"
|
||||||
if (isset($result["ends"])) {
|
if (isset($result["ends"])) {
|
||||||
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
||||||
$dateTime->setTimezone($timezoneLocal);
|
$dateTime->setTimezone($timezoneLocal);
|
||||||
$result["ends"] = $dateTime->format("Y-m-d H:i:s");
|
$result["ends"] = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($result[MDATA_KEY_DURATION])) {
|
if (isset($result[MDATA_KEY_DURATION])) {
|
||||||
|
@ -334,8 +334,8 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
$mainSqlQuery = "";
|
$mainSqlQuery = "";
|
||||||
$paramMap = array();
|
$paramMap = array();
|
||||||
$start = $startDT->format("Y-m-d H:i:s");
|
$start = $startDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$end = $endDT->format("Y-m-d H:i:s");
|
$end = $endDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$paramMap["starts"] = $start;
|
$paramMap["starts"] = $start;
|
||||||
$paramMap["ends"] = $end;
|
$paramMap["ends"] = $end;
|
||||||
|
@ -458,8 +458,8 @@ class Application_Service_HistoryService
|
||||||
}
|
}
|
||||||
$shows = Application_Model_Show::getShows($startDT, $endDT);
|
$shows = Application_Model_Show::getShows($startDT, $endDT);
|
||||||
|
|
||||||
Logging::info($startDT->format("Y-m-d H:i:s"));
|
Logging::info($startDT->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
Logging::info($endDT->format("Y-m-d H:i:s"));
|
Logging::info($endDT->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
|
|
||||||
Logging::info($shows);
|
Logging::info($shows);
|
||||||
|
|
||||||
|
@ -508,11 +508,11 @@ class Application_Service_HistoryService
|
||||||
//need to display the results in the station's timezone.
|
//need to display the results in the station's timezone.
|
||||||
$dateTime = new DateTime($result["starts"], $timezoneUTC);
|
$dateTime = new DateTime($result["starts"], $timezoneUTC);
|
||||||
$dateTime->setTimezone($timezoneLocal);
|
$dateTime->setTimezone($timezoneLocal);
|
||||||
$result["starts"] = $dateTime->format("Y-m-d H:i:s");
|
$result["starts"] = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
||||||
$dateTime->setTimezone($timezoneLocal);
|
$dateTime->setTimezone($timezoneLocal);
|
||||||
$result["ends"] = $dateTime->format("Y-m-d H:i:s");
|
$result["ends"] = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
$dateTime = new DateTime($value, $timezoneUTC);
|
$dateTime = new DateTime($value, $timezoneUTC);
|
||||||
$dateTime->setTimezone($timezoneLocal);
|
$dateTime->setTimezone($timezoneLocal);
|
||||||
$value = $dateTime->format("Y-m-d H:i:s");
|
$value = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
$formValues["$prefix{$key}"] = $value;
|
$formValues["$prefix{$key}"] = $value;
|
||||||
|
@ -795,11 +795,11 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
$dateTime = new DateTime($values[$prefix."starts"], $timezoneLocal);
|
$dateTime = new DateTime($values[$prefix."starts"], $timezoneLocal);
|
||||||
$dateTime->setTimezone($timezoneUTC);
|
$dateTime->setTimezone($timezoneUTC);
|
||||||
$historyRecord->setDbStarts($dateTime->format("Y-m-d H:i:s"));
|
$historyRecord->setDbStarts($dateTime->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
|
|
||||||
$dateTime = new DateTime($values[$prefix."ends"], $timezoneLocal);
|
$dateTime = new DateTime($values[$prefix."ends"], $timezoneLocal);
|
||||||
$dateTime->setTimezone($timezoneUTC);
|
$dateTime->setTimezone($timezoneUTC);
|
||||||
$historyRecord->setDbEnds($dateTime->format("Y-m-d H:i:s"));
|
$historyRecord->setDbEnds($dateTime->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
|
|
||||||
$templateValues = $values[$prefix."template"];
|
$templateValues = $values[$prefix."template"];
|
||||||
|
|
||||||
|
@ -1157,7 +1157,7 @@ class Application_Service_HistoryService
|
||||||
$fields[] = array("name" => MDATA_KEY_TITLE, "label"=> _("Title"), "type" => TEMPLATE_STRING, "isFileMd" => true); //these fields can be populated from an associated file.
|
$fields[] = array("name" => MDATA_KEY_TITLE, "label"=> _("Title"), "type" => TEMPLATE_STRING, "isFileMd" => true); //these fields can be populated from an associated file.
|
||||||
$fields[] = array("name" => MDATA_KEY_CREATOR, "label"=> _("Creator"), "type" => TEMPLATE_STRING, "isFileMd" => true);
|
$fields[] = array("name" => MDATA_KEY_CREATOR, "label"=> _("Creator"), "type" => TEMPLATE_STRING, "isFileMd" => true);
|
||||||
|
|
||||||
$template["name"] = "Log Sheet ".date("Y-m-d H:i:s")." Template";
|
$template["name"] = "Log Sheet ".date(DEFAULT_TIMESTAMP_FORMAT)." Template";
|
||||||
$template["fields"] = $fields;
|
$template["fields"] = $fields;
|
||||||
|
|
||||||
return $template;
|
return $template;
|
||||||
|
@ -1178,7 +1178,7 @@ class Application_Service_HistoryService
|
||||||
$fields[] = array("name" => MDATA_KEY_COMPOSER, "label"=> _("Composer"), "type" => TEMPLATE_STRING, "isFileMd" => true);
|
$fields[] = array("name" => MDATA_KEY_COMPOSER, "label"=> _("Composer"), "type" => TEMPLATE_STRING, "isFileMd" => true);
|
||||||
$fields[] = array("name" => MDATA_KEY_COPYRIGHT, "label"=> _("Copyright"), "type" => TEMPLATE_STRING, "isFileMd" => true);
|
$fields[] = array("name" => MDATA_KEY_COPYRIGHT, "label"=> _("Copyright"), "type" => TEMPLATE_STRING, "isFileMd" => true);
|
||||||
|
|
||||||
$template["name"] = "File Summary ".date("Y-m-d H:i:s")." Template";
|
$template["name"] = "File Summary ".date(DEFAULT_TIMESTAMP_FORMAT)." Template";
|
||||||
$template["fields"] = $fields;
|
$template["fields"] = $fields;
|
||||||
|
|
||||||
return $template;
|
return $template;
|
||||||
|
|
|
@ -177,7 +177,7 @@ class Application_Service_SchedulerService
|
||||||
|
|
||||||
$showInstanceWithMostRecentSchedule = CcShowInstancesQuery::create()
|
$showInstanceWithMostRecentSchedule = CcShowInstancesQuery::create()
|
||||||
->filterByDbShowId($showId)
|
->filterByDbShowId($showId)
|
||||||
->filterByDbStarts($showsPopulatedUntil->format("Y-m-d H:i:s"), Criteria::LESS_THAN)
|
->filterByDbStarts($showsPopulatedUntil->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::LESS_THAN)
|
||||||
->filterByDbId($instancsIdsToFill, Criteria::NOT_IN)
|
->filterByDbId($instancsIdsToFill, Criteria::NOT_IN)
|
||||||
->orderByDbStarts(Criteria::DESC)
|
->orderByDbStarts(Criteria::DESC)
|
||||||
->limit(1)
|
->limit(1)
|
||||||
|
@ -266,8 +266,8 @@ class Application_Service_SchedulerService
|
||||||
$item["stream_id"] = "null";
|
$item["stream_id"] = "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
$values[] = "(" . "'{$nextStartDT->format("Y-m-d H:i:s")}', " .
|
$values[] = "(" . "'{$nextStartDT->format(DEFAULT_TIMESTAMP_FORMAT)}', " .
|
||||||
"'{$endTimeDT->format("Y-m-d H:i:s")}', " .
|
"'{$endTimeDT->format(DEFAULT_TIMESTAMP_FORMAT)}', " .
|
||||||
"'{$item["clip_length"]}', " .
|
"'{$item["clip_length"]}', " .
|
||||||
"'{$item["fade_in"]}', " . "'{$item["fade_out"]}', " .
|
"'{$item["fade_in"]}', " . "'{$item["fade_out"]}', " .
|
||||||
"'{$item["cue_in"]}', " . "'{$item["cue_out"]}', " .
|
"'{$item["cue_in"]}', " . "'{$item["cue_out"]}', " .
|
||||||
|
@ -293,7 +293,7 @@ class Application_Service_SchedulerService
|
||||||
} //foreach linked instance
|
} //foreach linked instance
|
||||||
|
|
||||||
//update time_filled and last_scheduled in cc_show_instances
|
//update time_filled and last_scheduled in cc_show_instances
|
||||||
$now = gmdate("Y-m-d H:i:s");
|
$now = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$whereClause = new Criteria();
|
$whereClause = new Criteria();
|
||||||
$whereClause->add(CcShowInstancesPeer::ID, $instanceIdsToFill, Criteria::IN);
|
$whereClause->add(CcShowInstancesPeer::ID, $instanceIdsToFill, Criteria::IN);
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ class Application_Service_SchedulerService
|
||||||
|
|
||||||
$ccShowInstance
|
$ccShowInstance
|
||||||
->setDbTimeFilled($timeFilled)
|
->setDbTimeFilled($timeFilled)
|
||||||
->setDbLastScheduled(gmdate("Y-m-d H:i:s"))
|
->setDbLastScheduled(gmdate(DEFAULT_TIMESTAMP_FORMAT))
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,8 @@ class Application_Service_ShowFormService
|
||||||
$forms["repeats"]->disable();
|
$forms["repeats"]->disable();
|
||||||
$forms["who"]->disable();
|
$forms["who"]->disable();
|
||||||
$forms["style"]->disable();
|
$forms["style"]->disable();
|
||||||
|
// Hide the show logo fields when users are editing a single instance
|
||||||
|
$forms["style"]->hideShowLogo();
|
||||||
$forms["live"]->disable();
|
$forms["live"]->disable();
|
||||||
$forms["record"]->disable();
|
$forms["record"]->disable();
|
||||||
$forms["rebroadcast"]->disable();
|
$forms["rebroadcast"]->disable();
|
||||||
|
@ -208,7 +210,7 @@ class Application_Service_ShowFormService
|
||||||
'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"),
|
'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"),
|
||||||
'add_show_end_time' => $showEnd->format("H:i"),
|
'add_show_end_time' => $showEnd->format("H:i"),
|
||||||
'add_show_duration' => $this->calculateDuration(
|
'add_show_duration' => $this->calculateDuration(
|
||||||
$showStart->format("Y-m-d H:i:s"), $showEnd->format("Y-m-d H:i:s"), $timezone),
|
$showStart->format(DEFAULT_TIMESTAMP_FORMAT), $showEnd->format(DEFAULT_TIMESTAMP_FORMAT), $timezone),
|
||||||
'add_show_timezone' => $timezone,
|
'add_show_timezone' => $timezone,
|
||||||
'add_show_repeats' => 0));
|
'add_show_repeats' => 0));
|
||||||
|
|
||||||
|
|
|
@ -405,12 +405,12 @@ class Application_Service_ShowService
|
||||||
|
|
||||||
private function getShowDaysInRange($start, $end)
|
private function getShowDaysInRange($start, $end)
|
||||||
{
|
{
|
||||||
$endTimeString = $end->format("Y-m-d H:i:s");
|
$endTimeString = $end->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
if (!is_null($start)) {
|
if (!is_null($start)) {
|
||||||
$startTimeString = $start->format("Y-m-d H:i:s");
|
$startTimeString = $start->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
} else {
|
} else {
|
||||||
$today_timestamp = new DateTime("now", new DateTimeZone("UTC"));
|
$today_timestamp = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
$startTimeString = $today_timestamp->format("Y-m-d H:i:s");
|
$startTimeString = $today_timestamp->format(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
$c = new Criteria();
|
$c = new Criteria();
|
||||||
|
@ -462,7 +462,7 @@ AND rebroadcast = 1;
|
||||||
SQL;
|
SQL;
|
||||||
Application_Common_Database::prepareAndExecute( $sql, array(
|
Application_Common_Database::prepareAndExecute( $sql, array(
|
||||||
':showId' => $this->ccShow->getDbId(),
|
':showId' => $this->ccShow->getDbId(),
|
||||||
':timestamp' => gmdate("Y-m-d H:i:s")), 'execute');
|
':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT)), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function deleteAllShowDays($showId)
|
private function deleteAllShowDays($showId)
|
||||||
|
@ -678,7 +678,7 @@ WHERE date(starts) >= :endDate::DATE
|
||||||
AND show_id = :showId
|
AND show_id = :showId
|
||||||
SQL;
|
SQL;
|
||||||
Application_Common_Database::prepareAndExecute($sql, array(
|
Application_Common_Database::prepareAndExecute($sql, array(
|
||||||
':endDate' => $endDate, ':timestamp' => gmdate("Y-m-d H:i:s"),
|
':endDate' => $endDate, ':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':showId' => $showId), 'execute');
|
':showId' => $showId), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +693,7 @@ WHERE date(starts) < :newStartDate::DATE
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
Application_Common_Database::prepareAndExecute($sql, array(
|
Application_Common_Database::prepareAndExecute($sql, array(
|
||||||
":newStartDate" => $newStartDate, ":timestamp" => gmdate("Y-m-d H:i:s"),
|
":newStartDate" => $newStartDate, ":timestamp" => gmdate(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
":showId" => $showId), "execute");
|
":showId" => $showId), "execute");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ WHERE EXTRACT(DOW FROM starts) IN ($uncheckedDays)
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
Application_Common_Database::prepareAndExecute( $sql, array(
|
Application_Common_Database::prepareAndExecute( $sql, array(
|
||||||
":timestamp" => gmdate("Y-m-d H:i:s"), ":showId" => $showId),
|
":timestamp" => gmdate(DEFAULT_TIMESTAMP_FORMAT), ":showId" => $showId),
|
||||||
"execute");
|
"execute");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -777,7 +777,7 @@ SQL;
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gmdate("Y-m-d H:i:s") <= $ccShowInstance->getDbEnds()) {
|
if (gmdate(DEFAULT_TIMESTAMP_FORMAT) <= $ccShowInstance->getDbEnds()) {
|
||||||
$this->deleteShowInstances($ccShowInstances, $showId);
|
$this->deleteShowInstances($ccShowInstances, $showId);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Cannot delete a show instance in the past");
|
throw new Exception("Cannot delete a show instance in the past");
|
||||||
|
@ -925,7 +925,7 @@ WHERE starts > :timestamp::TIMESTAMP
|
||||||
AND show_id = :showId
|
AND show_id = :showId
|
||||||
SQL;
|
SQL;
|
||||||
Application_Common_Database::prepareAndExecute( $sql,
|
Application_Common_Database::prepareAndExecute( $sql,
|
||||||
array( ':timestamp' => gmdate("Y-m-d H:i:s"),
|
array( ':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':showId' => $showId), 'execute');
|
':showId' => $showId), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,9 +941,9 @@ WHERE starts > :timestamp::TIMESTAMP
|
||||||
AND starts != :firstShow
|
AND starts != :firstShow
|
||||||
SQL;
|
SQL;
|
||||||
Application_Common_Database::prepareAndExecute( $sql,
|
Application_Common_Database::prepareAndExecute( $sql,
|
||||||
array( ':timestamp' => gmdate("Y-m-d H:i:s"),
|
array( ':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT),
|
||||||
':showId' => $showId,
|
':showId' => $showId,
|
||||||
':firstShow' => $firstShow->format("Y-m-d H:i:s")), 'execute');
|
':firstShow' => $firstShow->format(DEFAULT_TIMESTAMP_FORMAT)), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1027,7 +1027,7 @@ SQL;
|
||||||
|
|
||||||
Application_Common_Database::prepareAndExecute($sql,
|
Application_Common_Database::prepareAndExecute($sql,
|
||||||
array(':diff1' => $diff, ':diff2' => $diff,
|
array(':diff1' => $diff, ':diff2' => $diff,
|
||||||
':showId' => $this->ccShow->getDbId(), ':timestamp' => gmdate("Y-m-d H:i:s")),
|
':showId' => $this->ccShow->getDbId(), ':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT)),
|
||||||
'execute');
|
'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1040,7 +1040,7 @@ SQL;
|
||||||
*/
|
*/
|
||||||
private function createRebroadcastInstances($showDay, $showStartDate, $instanceId)
|
private function createRebroadcastInstances($showDay, $showStartDate, $instanceId)
|
||||||
{
|
{
|
||||||
$currentUtcTimestamp = gmdate("Y-m-d H:i:s");
|
$currentUtcTimestamp = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
||||||
$showId = $this->ccShow->getDbId();
|
$showId = $this->ccShow->getDbId();
|
||||||
|
|
||||||
$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id=:show_id";
|
$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id=:show_id";
|
||||||
|
@ -1055,7 +1055,7 @@ SQL;
|
||||||
list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime(
|
list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime(
|
||||||
$showStartDate, $showDay->getDbDuration(), $offset);
|
$showStartDate, $showDay->getDbDuration(), $offset);
|
||||||
|
|
||||||
if ($utcStartDateTime->format("Y-m-d H:i:s") > $currentUtcTimestamp) {
|
if ($utcStartDateTime->format(DEFAULT_TIMESTAMP_FORMAT) > $currentUtcTimestamp) {
|
||||||
$ccShowInstance = new CcShowInstances();
|
$ccShowInstance = new CcShowInstances();
|
||||||
$ccShowInstance->setDbShowId($showId);
|
$ccShowInstance->setDbShowId($showId);
|
||||||
$ccShowInstance->setDbStarts($utcStartDateTime);
|
$ccShowInstance->setDbStarts($utcStartDateTime);
|
||||||
|
@ -1093,7 +1093,7 @@ SQL;
|
||||||
$origStartDateTime->setTimezone(new DateTimeZone("UTC"));
|
$origStartDateTime->setTimezone(new DateTimeZone("UTC"));
|
||||||
$ccShowInstance = $this->getInstance($origStartDateTime);
|
$ccShowInstance = $this->getInstance($origStartDateTime);
|
||||||
if (!$ccShowInstance) {
|
if (!$ccShowInstance) {
|
||||||
throw new Exception("Could not find show instance with start time: ".$origStartDateTime->format("Y-m-d H:i:s"));
|
throw new Exception("Could not find show instance with start time: ".$origStartDateTime->format(DEFAULT_TIMESTAMP_FORMAT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1182,7 +1182,7 @@ SQL;
|
||||||
/* When editing the start/end time of a repeating show, we don't want to
|
/* When editing the start/end time of a repeating show, we don't want to
|
||||||
* change shows that are in the past so we check the end time.
|
* change shows that are in the past so we check the end time.
|
||||||
*/
|
*/
|
||||||
if ($newInstance || $ccShowInstance->getDbEnds() > gmdate("Y-m-d H:i:s")) {
|
if ($newInstance || $ccShowInstance->getDbEnds() > gmdate(DEFAULT_TIMESTAMP_FORMAT)) {
|
||||||
$ccShowInstance->setDbShowId($show_id);
|
$ccShowInstance->setDbShowId($show_id);
|
||||||
$ccShowInstance->setDbStarts($utcStartDateTime);
|
$ccShowInstance->setDbStarts($utcStartDateTime);
|
||||||
$ccShowInstance->setDbEnds($utcEndDateTime);
|
$ccShowInstance->setDbEnds($utcEndDateTime);
|
||||||
|
@ -1277,7 +1277,7 @@ SQL;
|
||||||
/* When editing the start/end time of a repeating show, we don't want to
|
/* When editing the start/end time of a repeating show, we don't want to
|
||||||
* change shows that started in the past. So check the start time.
|
* change shows that started in the past. So check the start time.
|
||||||
*/
|
*/
|
||||||
if ($newInstance || $ccShowInstance->getDbStarts() > gmdate("Y-m-d H:i:s")) {
|
if ($newInstance || $ccShowInstance->getDbStarts() > gmdate(DEFAULT_TIMESTAMP_FORMAT)) {
|
||||||
$ccShowInstance->setDbShowId($show_id);
|
$ccShowInstance->setDbShowId($show_id);
|
||||||
$ccShowInstance->setDbStarts($utcStartDateTime);
|
$ccShowInstance->setDbStarts($utcStartDateTime);
|
||||||
$ccShowInstance->setDbEnds($utcEndDateTime);
|
$ccShowInstance->setDbEnds($utcEndDateTime);
|
||||||
|
@ -1481,7 +1481,7 @@ SQL;
|
||||||
$temp->setTimezone(new DateTimeZone("UTC"));
|
$temp->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()
|
$ccShowInstance = CcShowInstancesQuery::create()
|
||||||
->filterByDbStarts($temp->format("Y-m-d H:i:s"), Criteria::EQUAL)
|
->filterByDbStarts($temp->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::EQUAL)
|
||||||
->filterByDbShowId($this->ccShow->getDbId(), Criteria::EQUAL)
|
->filterByDbShowId($this->ccShow->getDbId(), Criteria::EQUAL)
|
||||||
//->filterByDbModifiedInstance(false, Criteria::EQUAL)
|
//->filterByDbModifiedInstance(false, Criteria::EQUAL)
|
||||||
->filterByDbRebroadcast(0, Criteria::EQUAL)
|
->filterByDbRebroadcast(0, Criteria::EQUAL)
|
||||||
|
|
|
@ -536,6 +536,12 @@ input[type="text"]:focus, input[type="password"]:focus, textarea:focus, .input_t
|
||||||
width: 150px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** Show Builder *****/
|
||||||
|
|
||||||
|
#show_builder {
|
||||||
|
min-width: 470px;
|
||||||
|
}
|
||||||
|
|
||||||
/***** LIBRARY QTIP METADATA SPECIFIC STYLES BEGIN *****/
|
/***** LIBRARY QTIP METADATA SPECIFIC STYLES BEGIN *****/
|
||||||
table.library-track-md{
|
table.library-track-md{
|
||||||
width: 280px;
|
width: 280px;
|
||||||
|
@ -1243,11 +1249,14 @@ input[type="checkbox"] {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dataTables_scrolling {
|
||||||
|
min-height: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
.ui-dialog #schedule_playlist_dialog.ui-dialog-content {
|
.ui-dialog #schedule_playlist_dialog.ui-dialog-content {
|
||||||
padding:0;
|
padding:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#schedule_playlist_dialog > div {
|
#schedule_playlist_dialog > div {
|
||||||
background: none repeat scroll 0 0 transparent;
|
background: none repeat scroll 0 0 transparent;
|
||||||
border: 1px solid #8f8f8f;
|
border: 1px solid #8f8f8f;
|
||||||
|
|
|
@ -10,7 +10,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
mod.checkAddButton = function() {
|
mod.checkAddButton = function() {
|
||||||
var selected = mod.getChosenItemsLength(), $cursor = $('tr.sb-selected'), check = false,
|
var selected = mod.getChosenItemsLength(), $cursor = $('tr.sb-selected'), check = false,
|
||||||
shows = $('tr.sb-header'), current = $('tr.sb-current-show'),
|
shows = $('tr.sb-header'), current = $('tr.sb-current-show'),
|
||||||
cursorText = $.i18n._('Add to next show');
|
// TODO: this is an ugly way of doing this... we should find a more robust way of checking which view we're in.
|
||||||
|
cursorText = (window.location.href.toLowerCase().includes("schedule")) ? $.i18n._('Add to show') : $.i18n._('Add to next show');
|
||||||
|
|
||||||
// make sure library items are selected and a cursor is selected.
|
// make sure library items are selected and a cursor is selected.
|
||||||
if (selected !== 0) {
|
if (selected !== 0) {
|
||||||
|
|
|
@ -135,11 +135,14 @@ var AIRTIME = (function(AIRTIME){
|
||||||
mod.checkDeleteButton = function() {
|
mod.checkDeleteButton = function() {
|
||||||
var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked");
|
var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked");
|
||||||
|
|
||||||
|
var button = $("#show_builder").find(".icon-trash").parent(),
|
||||||
|
DISABLED_CLASS = 'ui-state-disabled';
|
||||||
if ($selected.length !== 0) {
|
if ($selected.length !== 0) {
|
||||||
AIRTIME.button.enableButton("icon-trash", true);
|
button.removeClass(DISABLED_CLASS);
|
||||||
}
|
button.removeAttr('disabled');
|
||||||
else {
|
} else {
|
||||||
AIRTIME.button.disableButton("icon-trash", true);
|
button.addClass(DISABLED_CLASS);
|
||||||
|
button.attr('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import time
|
||||||
from kombu.connection import BrokerConnection
|
from kombu.connection import BrokerConnection
|
||||||
from kombu.messaging import Exchange, Queue
|
from kombu.messaging import Exchange, Queue
|
||||||
from kombu.simple import SimpleQueue
|
from kombu.simple import SimpleQueue
|
||||||
from amqplib.client_0_8.exceptions import AMQPConnectionException
|
from amqp.exceptions import AMQPError
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from std_err_override import LogWriter
|
from std_err_override import LogWriter
|
||||||
|
@ -29,21 +29,21 @@ class PypoMessageHandler(Thread):
|
||||||
|
|
||||||
def init_rabbit_mq(self):
|
def init_rabbit_mq(self):
|
||||||
self.logger.info("Initializing RabbitMQ stuff")
|
self.logger.info("Initializing RabbitMQ stuff")
|
||||||
|
simple_queue = None
|
||||||
try:
|
try:
|
||||||
schedule_exchange = Exchange("airtime-pypo", "direct", durable=True, auto_delete=True)
|
schedule_exchange = Exchange("airtime-pypo", "direct", durable=True, auto_delete=True)
|
||||||
schedule_queue = Queue("pypo-fetch", exchange=schedule_exchange, key="foo")
|
schedule_queue = Queue("pypo-fetch", exchange=schedule_exchange, key="foo")
|
||||||
connection = BrokerConnection(self.config["host"], \
|
connection = BrokerConnection(self.config["host"],
|
||||||
self.config["user"], \
|
self.config["user"],
|
||||||
self.config["password"], \
|
self.config["password"],
|
||||||
self.config["vhost"])
|
self.config["vhost"])
|
||||||
|
|
||||||
channel = connection.channel()
|
channel = connection.channel()
|
||||||
self.simple_queue = SimpleQueue(channel, schedule_queue)
|
simple_queue = SimpleQueue(channel, schedule_queue)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error(e)
|
self.logger.error(e)
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
return simple_queue
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Handle a message from RabbitMQ, put it into our yucky global var.
|
Handle a message from RabbitMQ, put it into our yucky global var.
|
||||||
|
@ -91,39 +91,18 @@ class PypoMessageHandler(Thread):
|
||||||
self.logger.error("Exception in handling RabbitMQ message: %s", e)
|
self.logger.error("Exception in handling RabbitMQ message: %s", e)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
while not self.init_rabbit_mq():
|
|
||||||
self.logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds")
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
loops = 1
|
|
||||||
while True:
|
|
||||||
self.logger.info("Loop #%s", loops)
|
|
||||||
try:
|
try:
|
||||||
message = self.simple_queue.get(block=True)
|
with self.init_rabbit_mq() as queue:
|
||||||
|
while True:
|
||||||
|
message = queue.get(block=True)
|
||||||
self.handle_message(message.payload)
|
self.handle_message(message.payload)
|
||||||
# ACK the message to take it off the queue
|
# ACK the message to take it off the queue
|
||||||
message.ack()
|
message.ack()
|
||||||
except (IOError, AttributeError, AMQPConnectionException), e:
|
except Exception, e:
|
||||||
self.logger.error('Exception: %s', e)
|
self.logger.error('Exception: %s', e)
|
||||||
self.logger.error("traceback: %s", traceback.format_exc())
|
self.logger.error("traceback: %s", traceback.format_exc())
|
||||||
while not self.init_rabbit_mq():
|
|
||||||
self.logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds")
|
self.logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
except Exception, e:
|
|
||||||
"""
|
|
||||||
sleep 5 seconds so that we don't spin inside this
|
|
||||||
while loop and eat all the CPU
|
|
||||||
"""
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
"""
|
|
||||||
There is a problem with the RabbitMq messenger service. Let's
|
|
||||||
log the error and get the schedule via HTTP polling
|
|
||||||
"""
|
|
||||||
self.logger.error('Exception: %s', e)
|
|
||||||
self.logger.error("traceback: %s", traceback.format_exc())
|
|
||||||
|
|
||||||
loops += 1
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Main loop of the thread:
|
Main loop of the thread:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue