Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
14a9225b97
3248 changed files with 71436 additions and 782760 deletions
|
@ -56,6 +56,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
|
||||
$view = $this->getResource('view');
|
||||
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']);
|
||||
$view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
@ -69,6 +70,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
|
||||
$view = $this->getResource('view');
|
||||
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$view->headScript()->appendFile('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');
|
||||
$view->headScript()->appendFile('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js');
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[production]
|
||||
phpSettings.display_startup_errors = 0
|
||||
phpSettings.display_errors = 0
|
||||
includePaths.library = APPLICATION_PATH "/../library"
|
||||
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
|
||||
bootstrap.class = "Bootstrap"
|
||||
appnamespace = "Application"
|
||||
|
|
|
@ -17,9 +17,7 @@ $CC_CONFIG = array(
|
|||
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
|
||||
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
|
||||
|
||||
"rootDir" => __DIR__."/../..",
|
||||
'pearPath' => dirname(__FILE__).'/../../library/pear',
|
||||
'zendPath' => dirname(__FILE__).'/../../library/Zend'
|
||||
"rootDir" => __DIR__."/../.."
|
||||
);
|
||||
|
||||
|
||||
|
@ -50,12 +48,6 @@ $CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'].'_id';
|
|||
$CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id';
|
||||
$CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id';
|
||||
|
||||
// Add libs to the PHP path
|
||||
$old_include_path = get_include_path();
|
||||
set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath']
|
||||
.PATH_SEPARATOR.$CC_CONFIG['zendPath']
|
||||
.PATH_SEPARATOR.$old_include_path);
|
||||
|
||||
class Config {
|
||||
public static function loadConfig($p_path) {
|
||||
global $CC_CONFIG;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
|
||||
define('AIRTIME_REST_VERSION', '1.1');
|
||||
define('AIRTIME_API_VERSION', '1.0');
|
||||
|
||||
// Metadata Keys for files
|
||||
define('MDATA_KEY_FILEPATH', 'filepath');
|
||||
|
|
|
@ -217,7 +217,8 @@ class ApiController extends Zend_Controller_Action
|
|||
"currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow),
|
||||
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, $limit, $utcTimeEnd),
|
||||
"timezone"=> date("T"),
|
||||
"timezoneOffset"=> date("Z"));
|
||||
"timezoneOffset"=> date("Z"),
|
||||
"AIRTIME_API_VERSION"=>AIRTIME_API_VERSION); //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
|
||||
//Convert from UTC to localtime for user.
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
@ -256,7 +257,7 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$result[$dow[$i]] = $shows;
|
||||
}
|
||||
|
||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
header("Content-type: text/javascript");
|
||||
echo $_GET['callback'].'('.json_encode($result).')';
|
||||
} else {
|
||||
|
|
|
@ -36,11 +36,11 @@ class LibraryController extends Zend_Controller_Action
|
|||
public function libraryAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
@ -78,6 +78,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$screen = $this->_getParam('screen');
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$menu = array();
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
|
|
@ -38,11 +38,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
|
@ -51,18 +51,18 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker-0.0.6.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
|
||||
|
@ -183,89 +183,89 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function makeContextMenuAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$menu = array();
|
||||
$epochNow = time();
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
try{
|
||||
$show = new Application_Model_ShowInstance($id);
|
||||
$instance = new Application_Model_ShowInstance($id);
|
||||
}catch(Exception $e){
|
||||
$this->view->show_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$showStartLocalDT = Application_Model_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart());
|
||||
$showEndLocalDT = Application_Model_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd());
|
||||
|
||||
$params = '/format/json/id/#id#';
|
||||
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
||||
|
||||
$showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceStart());
|
||||
$showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceEnd());
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST), $instance->getShowId())
|
||||
&& !$instance->isRecorded()
|
||||
&& !$instance->isRebroadcast()) {
|
||||
|
||||
$menu = array();
|
||||
$menu["schedule"] = array("name"=> "Add / Remove Content", "url" => "/showbuilder/index/");
|
||||
|
||||
if ($epochNow < $showStartDateHelper->getTimestamp()) {
|
||||
$menu["clear"] = array("name"=> "Remove All Content", "icon" => "delete", "url" => "/schedule/clear-show");
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()) && !$show->isRecorded() && !$show->isRebroadcast()) {
|
||||
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params,
|
||||
'callback' => 'window["buildScheduleDialog"]'), 'title' => 'Add / Remove Content');
|
||||
/*
|
||||
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/clear-show'.$params,
|
||||
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Remove All Content');
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!$show->isRecorded()) {
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/show-content-dialog'.$params,
|
||||
'callback' => 'window["buildContentDialog"]'), 'title' => 'Show Content');
|
||||
if (!$instance->isRecorded()) {
|
||||
|
||||
$menu["content"] = array("name"=> "Show Content", "url" => "/schedule/show-content-dialog");
|
||||
}
|
||||
|
||||
if ($showEndDateHelper->getTimestamp() <= $epochNow
|
||||
&& $show->isRecorded()
|
||||
if ($showEndLocalDT->getTimestamp() <= $epochNow
|
||||
&& $instance->isRecorded()
|
||||
&& Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
if(is_null($show->getSoundCloudFileId())){
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['uploadToSoundCloud']($id)"),
|
||||
'title' => 'Upload to SoundCloud');
|
||||
}else{
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['uploadToSoundCloud']($id)"),
|
||||
'title' => 'Re-upload to SoundCloud');
|
||||
}
|
||||
|
||||
$text = is_null($instance->getSoundCloudFileId()) ? 'Upload to SoundCloud' : 'Re-upload to SoundCloud';
|
||||
$menu["soundcloud"] = array("name"=> $text, "icon" => "soundcloud");
|
||||
}
|
||||
|
||||
|
||||
if ($showStartDateHelper->getTimestamp() <= $epochNow &&
|
||||
$epochNow < $showEndDateHelper->getTimestamp() &&
|
||||
if ($showStartLocalDT->getTimestamp() <= $epochNow &&
|
||||
$epochNow < $showEndLocalDT->getTimestamp() &&
|
||||
$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
if ($show->isRecorded()) {
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['confirmCancelRecordedShow']($id)"),
|
||||
'title' => 'Cancel Current Show');
|
||||
|
||||
if ($instance->isRecorded()) {
|
||||
|
||||
$menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||
} else {
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['confirmCancelShow']($id)"),
|
||||
'title' => 'Cancel Current Show');
|
||||
|
||||
$menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||
}
|
||||
}
|
||||
|
||||
if ($epochNow < $showStartDateHelper->getTimestamp()) {
|
||||
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/edit-show/format/json/id/'.$id,
|
||||
'callback' => 'window["beginEditShow"]'), 'title' => 'Edit Show');
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params,
|
||||
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance');
|
||||
if ($show->getShow()->isRepeating() || $show->getShow()->isRebroadcast()) {
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/cancel-show'.$params,
|
||||
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance and All Following');
|
||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
|
||||
|
||||
if ($instance->getShow()->isRepeating()) {
|
||||
|
||||
//create delete sub menu.
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "items" => array());
|
||||
|
||||
$menu["del"]["items"]["single"] = array("name"=> "Delete This Instance", "icon" => "delete", "url" => "/schedule/delete-show");
|
||||
|
||||
$menu["del"]["items"]["following"] = array("name"=> "Delete This Instance and All Following", "icon" => "delete", "url" => "/schedule/cancel-show");
|
||||
}
|
||||
else {
|
||||
//window["scheduleRefetchEvents"]'
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//returns format jjmenu is looking for.
|
||||
die(json_encode($menu));
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
||||
public function scheduleShowAction()
|
||||
|
|
|
@ -28,6 +28,20 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$now = time();
|
||||
$from = $request->getParam("from", $now);
|
||||
$to = $request->getParam("to", $now+(24*60*60));
|
||||
|
||||
$start = DateTime::createFromFormat("U", $from, new DateTimeZone("UTC"));
|
||||
$start->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$end = DateTime::createFromFormat("U", $to, new DateTimeZone("UTC"));
|
||||
$end->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
$this->view->start_date = $start->format("Y-m-d");
|
||||
$this->view->start_time = $start->format("H:i");
|
||||
$this->view->end_date = $end->format("Y-m-d");
|
||||
$this->view->end_time = $end->format("H:i");
|
||||
|
||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = ".date("Z")."; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js','text/javascript');
|
||||
|
|
|
@ -4,6 +4,8 @@ class SystemstatusController extends Zend_Controller_Action
|
|||
{
|
||||
public function init()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
|
||||
// Add artist field
|
||||
$this->addElement('text', 'artist_name', array(
|
||||
'label' => 'Artist:',
|
||||
'label' => 'Creator:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
));
|
||||
|
|
|
@ -71,8 +71,10 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
'Africa' => DateTimeZone::AFRICA,
|
||||
'America' => DateTimeZone::AMERICA,
|
||||
'Antarctica' => DateTimeZone::ANTARCTICA,
|
||||
'Arctic' => DateTimeZone::ARCTIC,
|
||||
'Asia' => DateTimeZone::ASIA,
|
||||
'Atlantic' => DateTimeZone::ATLANTIC,
|
||||
'Australia' => DateTimeZone::AUSTRALIA,
|
||||
'Europe' => DateTimeZone::EUROPE,
|
||||
'Indian' => DateTimeZone::INDIAN,
|
||||
'Pacific' => DateTimeZone::PACIFIC
|
||||
|
|
|
@ -39,12 +39,14 @@ class Application_Form_StreamSetting extends Zend_Form
|
|||
}
|
||||
|
||||
# tooltip
|
||||
$description = 'VLC and mplayer have a serious bug when playing an OGG/VORBIS
|
||||
stream that has metadata information enabled (stream metadata is the
|
||||
track title, show name, etc displayed in the audio player): they will
|
||||
disconnect from the stream after every song if this option is enabled.
|
||||
If your listeners do not require support for these audio players,
|
||||
then you should enable this option.';
|
||||
$description = 'This option enables metadata for OGG streams (stream
|
||||
metadata is the track title, artist, and show name that is
|
||||
displayed in an audio player). VLC and mplayer have a
|
||||
serious bug when playing an OGG/VORBIS stream that has
|
||||
metadata information enabled: they will disconnect from the
|
||||
stream after every song. If you are using an OGG stream and
|
||||
your listeners do not require support for these audio
|
||||
players, then feel free to enable this option.';
|
||||
|
||||
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
|
||||
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
|
||||
|
|
|
@ -9,16 +9,16 @@ class Application_Model_Nowplaying
|
|||
|
||||
private static function CreateDatatableRows($p_dbRows){
|
||||
$dataTablesRows = array();
|
||||
|
||||
|
||||
$epochNow = time();
|
||||
|
||||
|
||||
foreach ($p_dbRows as $dbRow){
|
||||
|
||||
|
||||
$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");
|
||||
$itemStarts = $itemStartDateTime->format("Y-m-d H:i:s");
|
||||
|
@ -28,29 +28,29 @@ class Application_Model_Nowplaying
|
|||
$status = ($showEnds < $itemEnds) ? "x" : "";
|
||||
|
||||
$type = "a";
|
||||
$type .= ($itemStartDateTime->getTimestamp() <= $epochNow
|
||||
$type .= ($itemStartDateTime->getTimestamp() <= $epochNow
|
||||
&& $epochNow < $itemEndDateTime->getTimestamp()
|
||||
&& $epochNow < $showEndDateTime->getTimestamp()) ? "c" : "";
|
||||
|
||||
|
||||
// remove millisecond from the time format
|
||||
$itemStart = explode('.', $dbRow['item_starts']);
|
||||
$itemEnd = explode('.', $dbRow['item_ends']);
|
||||
|
||||
|
||||
//format duration
|
||||
$duration = explode('.', $dbRow['clip_length']);
|
||||
$formatted = self::FormatDuration($duration[0]);
|
||||
$dataTablesRows[] = array($type, $showStarts, $itemStarts, $itemEnds,
|
||||
$dataTablesRows[] = array($type, $itemStarts, $itemStarts, $itemEnds,
|
||||
$formatted, $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
||||
$dbRow['playlist_name'], $dbRow['show_name'], $status);
|
||||
}
|
||||
|
||||
return $dataTablesRows;
|
||||
}
|
||||
|
||||
|
||||
private static function CreateGapRow($p_gapTime){
|
||||
return array("g", "", "", "", $p_gapTime, "", "", "", "", "", "");
|
||||
}
|
||||
|
||||
|
||||
private static function CreateRecordingRow($p_showInstance){
|
||||
return array("r", "", "", "", $p_showInstance->getName(), "", "", "", "", "", "");
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class Application_Model_Nowplaying
|
|||
if ($viewType == "now"){
|
||||
$dateTime = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$timeNow = $dateTime->format("Y-m-d H:i:s");
|
||||
|
||||
|
||||
$startCutoff = 60;
|
||||
$endCutoff = 86400; //60*60*24 - seconds in a day
|
||||
} else {
|
||||
|
@ -72,30 +72,30 @@ class Application_Model_Nowplaying
|
|||
$startCutoff = $date->getNowDayStartDiff();
|
||||
$endCutoff = $date->getNowDayEndDiff();
|
||||
}
|
||||
|
||||
|
||||
$data = array();
|
||||
|
||||
$showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
|
||||
foreach ($showIds as $showId){
|
||||
$instanceId = $showId['id'];
|
||||
|
||||
|
||||
$si = new Application_Model_ShowInstance($instanceId);
|
||||
|
||||
|
||||
$showId = $si->getShowId();
|
||||
$show = new Application_Model_Show($showId);
|
||||
|
||||
|
||||
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceStart());
|
||||
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceEnd());
|
||||
|
||||
|
||||
//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"));
|
||||
|
||||
|
||||
$scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff);
|
||||
$dataTablesRows = self::CreateDatatableRows($scheduledItems);
|
||||
|
||||
|
||||
//append show audio item rows
|
||||
$data = array_merge($data, $dataTablesRows);
|
||||
|
||||
|
||||
//append show gap time row
|
||||
$gapTime = self::FormatDuration($si->getShowEndGapTime(), true);
|
||||
if ($si->isRecorded())
|
||||
|
@ -118,7 +118,7 @@ class Application_Model_Nowplaying
|
|||
}
|
||||
/*
|
||||
* default $time format should be in format of 00:00:00
|
||||
* if $inSecond = true, then $time should be in seconds
|
||||
* if $inSecond = true, then $time should be in seconds
|
||||
*/
|
||||
private static function FormatDuration($time, $inSecond=false){
|
||||
if($inSecond == false){
|
||||
|
@ -129,13 +129,13 @@ class Application_Model_Nowplaying
|
|||
$duration[1] = intval(($time/60)%60);
|
||||
$duration[2] = $time%60;
|
||||
}
|
||||
|
||||
|
||||
if($duration[2] == 0){
|
||||
$duration[2] = '';
|
||||
}else{
|
||||
$duration[2] = intval($duration[2],10).'s';
|
||||
}
|
||||
|
||||
|
||||
if($duration[1] == 0){
|
||||
if($duration[2] == ''){
|
||||
$duration[1] = '';
|
||||
|
@ -145,13 +145,13 @@ class Application_Model_Nowplaying
|
|||
}else{
|
||||
$duration[1] = intval($duration[1],10).'m ';
|
||||
}
|
||||
|
||||
|
||||
if($duration[0] == 0){
|
||||
$duration[0] = '';
|
||||
}else{
|
||||
$duration[0] = intval($duration[0],10).'h ';
|
||||
}
|
||||
|
||||
|
||||
$out = $duration[0].$duration[1].$duration[2];
|
||||
return $out;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@ class Application_Model_Preference
|
|||
|
||||
public static function SetHeadTitle($title, $view=null){
|
||||
self::SetValue("station_name", $title);
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
||||
// in case this is called from airtime-saas script
|
||||
if($view !== null){
|
||||
|
@ -111,6 +110,11 @@ class Application_Model_Preference
|
|||
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
|
||||
$view->headTitle(self::GetHeadTitle());
|
||||
}
|
||||
|
||||
$eventType = "update_station_name";
|
||||
$md = array("station_name"=>$title);
|
||||
|
||||
Application_Model_RabbitMq::SendMessageToPypo($eventType, $md);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +157,11 @@ class Application_Model_Preference
|
|||
|
||||
public static function SetStreamLabelFormat($type){
|
||||
self::SetValue("stream_label_format", $type);
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
||||
$eventType = "update_stream_format";
|
||||
$md = array("stream_format"=>$type);
|
||||
|
||||
Application_Model_RabbitMq::SendMessageToPypo($eventType, $md);
|
||||
}
|
||||
|
||||
public static function GetStreamLabelFormat(){
|
||||
|
|
|
@ -46,7 +46,8 @@ class Application_Model_RabbitMq
|
|||
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
||||
$CC_CONFIG["rabbitmq"]["port"],
|
||||
$CC_CONFIG["rabbitmq"]["user"],
|
||||
$CC_CONFIG["rabbitmq"]["password"]);
|
||||
$CC_CONFIG["rabbitmq"]["password"],
|
||||
$CC_CONFIG["rabbitmq"]["vhost"]);
|
||||
$channel = $conn->channel();
|
||||
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
|
||||
|
||||
|
@ -68,7 +69,8 @@ class Application_Model_RabbitMq
|
|||
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
||||
$CC_CONFIG["rabbitmq"]["port"],
|
||||
$CC_CONFIG["rabbitmq"]["user"],
|
||||
$CC_CONFIG["rabbitmq"]["password"]);
|
||||
$CC_CONFIG["rabbitmq"]["password"],
|
||||
$CC_CONFIG["rabbitmq"]["vhost"]);
|
||||
$channel = $conn->channel();
|
||||
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
|
||||
|
||||
|
|
|
@ -326,11 +326,13 @@ class Application_Model_Schedule {
|
|||
JOIN cc_show AS showt ON (showt.id = si.show_id)
|
||||
)
|
||||
|
||||
WHERE si.starts >= '{$p_startDateTime}' AND si.starts <= '{$p_endDateTime}'
|
||||
WHERE si.modified_instance = false AND
|
||||
|
||||
si.starts >= '{$p_startDateTime}' AND si.starts < '{$p_endDateTime}'
|
||||
|
||||
ORDER BY si.starts, sched.starts;";
|
||||
|
||||
//Logging::log($sql);
|
||||
Logging::log($sql);
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
|
|
|
@ -68,7 +68,7 @@ class Application_Model_Scheduler {
|
|||
*
|
||||
* @return DateTime endDT in UTC
|
||||
*/
|
||||
private function findEndTime($p_startDT, $p_duration) {
|
||||
public static function findEndTime($p_startDT, $p_duration) {
|
||||
|
||||
$startEpoch = $p_startDT->format("U.u");
|
||||
$durationSeconds = Application_Model_Playlist::playlistTimeToSeconds($p_duration);
|
||||
|
@ -149,7 +149,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
Logging::log("adding file with id: ".$file["id"]);
|
||||
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
|
||||
$endTimeDT = self::findEndTime($nextStartDT, $file['cliplength']);
|
||||
|
||||
//item existed previously and is being moved.
|
||||
//need to keep same id for resources if we want REST.
|
||||
|
@ -184,7 +184,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
Logging::log("adjusting iterm {$item->getDbId()}");
|
||||
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
||||
$endTimeDT = self::findEndTime($nextStartDT, $item->getDbClipLength());
|
||||
|
||||
$item->setDbStarts($nextStartDT);
|
||||
$item->setDbEnds($endTimeDT);
|
||||
|
@ -223,6 +223,8 @@ class Application_Model_Scheduler {
|
|||
$this->insertAfter($scheduleItems, $schedFiles, $adjustSched);
|
||||
|
||||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
|
@ -277,6 +279,8 @@ class Application_Model_Scheduler {
|
|||
$this->insertAfter($afterItem, array($data), $adjustSched);
|
||||
|
||||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
|
@ -310,6 +314,8 @@ class Application_Model_Scheduler {
|
|||
}
|
||||
|
||||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
|
@ -340,7 +346,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
Logging::log("adjusting item #".$item->getDbId());
|
||||
|
||||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||
$itemEndDT = self::findEndTime($itemStartDT, $item->getDbClipLength());
|
||||
|
||||
$item->setDbStarts($itemStartDT);
|
||||
$item->setDbEnds($itemEndDT);
|
||||
|
|
|
@ -351,13 +351,15 @@ class Application_Model_Show {
|
|||
public function isRepeating()
|
||||
{
|
||||
$showDaysRow = CcShowDaysQuery::create()
|
||||
->filterByDbShowId($this->_showId)
|
||||
->findOne();
|
||||
->filterByDbShowId($this->_showId)
|
||||
->findOne();
|
||||
|
||||
if (!is_null($showDaysRow)){
|
||||
return ($showDaysRow->getDbRepeatType() != -1);
|
||||
} else
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1164,7 +1166,9 @@ class Application_Model_Show {
|
|||
|
||||
Logging::log('$start time of non repeating record '.$start);
|
||||
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
if ($newInstance){
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1392,7 +1396,7 @@ class Application_Model_Show {
|
|||
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
|
||||
}
|
||||
|
||||
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name, description,
|
||||
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name,
|
||||
color, background_color, file_id, cc_show_instances.id AS instance_id
|
||||
FROM cc_show_instances
|
||||
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id
|
||||
|
@ -1455,18 +1459,18 @@ class Application_Model_Show {
|
|||
$endTimeString = $p_endTimestamp->format("Y-m-d H:i:s");
|
||||
if (!is_null($p_startTimestamp)) {
|
||||
$startTimeString = $p_startTimestamp->format("Y-m-d H:i:s");
|
||||
$sql = "SELECT * FROM cc_show_days
|
||||
WHERE last_show IS NULL
|
||||
OR first_show < '{$endTimeString}' AND last_show > '{$startTimeString}'";
|
||||
}
|
||||
else {
|
||||
$today_timestamp = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$today_timestamp_string = $today_timestamp->format("Y-m-d H:i:s");
|
||||
$sql = "SELECT * FROM cc_show_days
|
||||
WHERE last_show IS NULL
|
||||
OR first_show < '{$endTimeString}' AND last_show > '{$today_timestamp_string}'";
|
||||
$startTimeString = $today_timestamp->format("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM cc_show_days
|
||||
WHERE last_show IS NULL
|
||||
OR first_show < '{$endTimeString}' AND last_show > '{$startTimeString}'";
|
||||
|
||||
Logging::log($sql);
|
||||
|
||||
$res = $CC_DBC->GetAll($sql);
|
||||
|
||||
foreach ($res as $row) {
|
||||
|
@ -1527,13 +1531,15 @@ class Application_Model_Show {
|
|||
$endDateTime = new DateTime($show["ends"], new DateTimeZone("UTC"));
|
||||
$endDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
$event["id"] = $show["instance_id"];
|
||||
$event["id"] = intval($show["instance_id"]);
|
||||
$event["title"] = $show["name"];
|
||||
$event["start"] = $startDateTime->format("Y-m-d H:i:s");
|
||||
$event["startUnix"] = $startDateTime->format("U");
|
||||
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
|
||||
$event["endUnix"] = $endDateTime->format("U");
|
||||
$event["allDay"] = false;
|
||||
$event["description"] = $show["description"];
|
||||
$event["showId"] = $show["show_id"];
|
||||
$event["showId"] = intval($show["show_id"]);
|
||||
$event["record"] = intval($show["record"]);
|
||||
$event["rebroadcast"] = intval($show["rebroadcast"]);
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ class Application_Model_ShowBuilder {
|
|||
private $endDT;
|
||||
private $user;
|
||||
|
||||
private $contentDT;
|
||||
|
||||
private $defaultRowArray = array(
|
||||
"header" => false,
|
||||
"footer" => false,
|
||||
|
@ -15,9 +17,7 @@ class Application_Model_ShowBuilder {
|
|||
"id" => 0,
|
||||
"instance" => "",
|
||||
"starts" => "",
|
||||
"startsUnix" => null,
|
||||
"ends" => "",
|
||||
"endsUnix" => null,
|
||||
"runtime" => "",
|
||||
"title" => "",
|
||||
"creator" => "",
|
||||
|
@ -56,11 +56,45 @@ class Application_Model_ShowBuilder {
|
|||
return $runtime;
|
||||
}
|
||||
|
||||
private function makeFooterRow() {
|
||||
private function formatTimeFilled($p_sec) {
|
||||
|
||||
$formatted = "";
|
||||
$sign = ($p_sec < 0) ? "-" : "+";
|
||||
|
||||
$time = Application_Model_Playlist::secondsToPlaylistTime(abs($p_sec));
|
||||
Logging::log("time is: ".$time);
|
||||
$info = explode(":", $time);
|
||||
|
||||
$formatted .= $sign;
|
||||
|
||||
if ($info[0] > 0) {
|
||||
$formatted .= " {$info[0]}h";
|
||||
}
|
||||
|
||||
if ($info[1] > 0) {
|
||||
$formatted .= " {$info[1]}m";
|
||||
}
|
||||
|
||||
if ($info[2] > 0) {
|
||||
$sec = round($info[2], 0);
|
||||
$formatted .= " {$sec}s";
|
||||
}
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
||||
private function makeFooterRow($p_item) {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
$row["footer"] = true;
|
||||
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
$contentDT = $this->contentDT;
|
||||
|
||||
$runtime = bcsub($contentDT->format("U.u"), $showEndDT->format("U.u"), 6);
|
||||
$row["runtime"] = $runtime;
|
||||
$row["fRuntime"] = $this->formatTimeFilled($runtime);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
@ -80,13 +114,19 @@ class Application_Model_ShowBuilder {
|
|||
$row["title"] = $p_item["show_name"];
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
|
||||
$this->contentDT = $showStartDT;
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
private function makeScheduledItemRow($p_item) {
|
||||
$row = $this->defaultRowArray;
|
||||
$epoch_now = time();
|
||||
|
||||
if ($this->user->canSchedule($item["show_id"]) == true) {
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
|
||||
//can only schedule the show if it hasn't started and you are allowed.
|
||||
if ($epoch_now < $showStartDT->format('U') && $this->user->canSchedule($p_item["show_id"]) == true) {
|
||||
$row["checkbox"] = true;
|
||||
}
|
||||
|
||||
|
@ -107,6 +147,8 @@ class Application_Model_ShowBuilder {
|
|||
$row["title"] = $p_item["file_track_title"];
|
||||
$row["creator"] = $p_item["file_artist_name"];
|
||||
$row["album"] = $p_item["file_album_title"];
|
||||
|
||||
$this->contentDT = $schedEndDT;
|
||||
}
|
||||
//show is empty
|
||||
else {
|
||||
|
@ -125,14 +167,17 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT->format("Y-m-d H:i:s"), $this->endDT->format("Y-m-d H:i:s"));
|
||||
|
||||
foreach ($scheduled_items as $item) {
|
||||
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {
|
||||
|
||||
$item = $scheduled_items[$i];
|
||||
|
||||
//make a header row.
|
||||
if ($current_id !== $item["si_id"]) {
|
||||
|
||||
//make a footer row.
|
||||
if ($current_id !== -1) {
|
||||
$display_items[] = $this->makeFooterRow();
|
||||
//pass in the previous row as it's the last row for the previous show.
|
||||
$display_items[] = $this->makeFooterRow($scheduled_items[$i-1]);
|
||||
}
|
||||
|
||||
$display_items[] = $this->makeHeaderRow($item);
|
||||
|
@ -146,7 +191,7 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
//make the last footer if there were any scheduled items.
|
||||
if (count($scheduled_items) > 0) {
|
||||
$display_items[] = $this->makeFooterRow();
|
||||
$display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items)-1]);
|
||||
}
|
||||
|
||||
return $display_items;
|
||||
|
|
|
@ -58,21 +58,19 @@ class Application_Model_ShowInstance {
|
|||
/**
|
||||
* Return the start time of the Show (UTC time)
|
||||
* @return string in format "Y-m-d H:i:s" (PHP time notation)
|
||||
* TODO: make this function return a DateTime object instead.
|
||||
*/
|
||||
public function getShowInstanceStart()
|
||||
public function getShowInstanceStart($format="Y-m-d H:i:s")
|
||||
{
|
||||
return $this->_showInstance->getDbStarts();
|
||||
return $this->_showInstance->getDbStarts($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the end time of the Show (UTC time)
|
||||
* @return string in format "Y-m-d H:i:s" (PHP time notation)
|
||||
* TODO: make this function return a DateTime object instead.
|
||||
*/
|
||||
public function getShowInstanceEnd()
|
||||
public function getShowInstanceEnd($format="Y-m-d H:i:s")
|
||||
{
|
||||
return $this->_showInstance->getDbEnds();
|
||||
return $this->_showInstance->getDbEnds($format);
|
||||
}
|
||||
|
||||
public function getStartDate()
|
||||
|
@ -444,6 +442,81 @@ class Application_Model_ShowInstance {
|
|||
$this->updateScheduledTime();
|
||||
}
|
||||
|
||||
private function checkToDeleteShow($showId)
|
||||
{
|
||||
//UTC DateTime object
|
||||
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||
|
||||
$showDays = CcShowDaysQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->findOne();
|
||||
|
||||
$showEnd = $showDays->getDbLastShow();
|
||||
|
||||
//there will always be more shows populated.
|
||||
if (is_null($showEnd)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$lastShowStartDateTime = new DateTime("{$showEnd} {$showDays->getDbStartTime()}", new DateTimeZone($showDays->getDbTimezone()));
|
||||
//end dates were non inclusive.
|
||||
$lastShowStartDateTime = self::addDeltas($lastShowStartDateTime, -1, 0);
|
||||
|
||||
//there's still some shows left to be populated.
|
||||
if ($lastShowStartDateTime->getTimestamp() > $showsPopUntil->getTimestamp()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if there are any non deleted show instances remaining.
|
||||
$showInstances = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->filterByDbRebroadcast(0)
|
||||
->find();
|
||||
|
||||
if (is_null($showInstances)){
|
||||
return true;
|
||||
}
|
||||
//only 1 show instance left of the show, make it non repeating.
|
||||
else if (count($showInstances) === 1) {
|
||||
$showInstance = $showInstances[0];
|
||||
|
||||
$showDaysOld = CcShowDaysQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->find();
|
||||
|
||||
$tz = $showDaysOld[0]->getDbTimezone();
|
||||
|
||||
$startDate = new DateTime($showInstance->getDbStarts(), new DateTimeZone("UTC"));
|
||||
$startDate->setTimeZone(new DateTimeZone($tz));
|
||||
$endDate = self::addDeltas($startDate, 1, 0);
|
||||
|
||||
//make a new rule for a non repeating show.
|
||||
$showDayNew = new CcShowDays();
|
||||
$showDayNew->setDbFirstShow($startDate->format("Y-m-d"));
|
||||
$showDayNew->setDbLastShow($endDate->format("Y-m-d"));
|
||||
$showDayNew->setDbStartTime($startDate->format("H:i:s"));
|
||||
$showDayNew->setDbTimezone($tz);
|
||||
$showDayNew->setDbDay($startDate->format('w'));
|
||||
$showDayNew->setDbDuration($showDaysOld[0]->getDbDuration());
|
||||
$showDayNew->setDbRepeatType(-1);
|
||||
$showDayNew->setDbShowId($showDaysOld[0]->getDbShowId());
|
||||
$showDayNew->setDbRecord($showDaysOld[0]->getDbRecord());
|
||||
$showDayNew->save();
|
||||
|
||||
//delete the old rules for repeating shows
|
||||
$showDaysOld->delete();
|
||||
|
||||
//remove the old repeating deleted instances.
|
||||
$showInstances = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->filterByDbModifiedInstance(true)
|
||||
->delete();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
@ -465,6 +538,10 @@ class Application_Model_ShowInstance {
|
|||
->setDbModifiedInstance(true)
|
||||
->save();
|
||||
|
||||
if ($this->isRebroadcast()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//delete the rebroadcasts of the removed recorded show.
|
||||
if ($recording) {
|
||||
CcShowInstancesQuery::create()
|
||||
|
@ -477,17 +554,8 @@ class Application_Model_ShowInstance {
|
|||
->filterByDbInstanceId($this->_instanceId)
|
||||
->delete();
|
||||
|
||||
// check if we can safely delete the show
|
||||
$showInstancesRow = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->findOne();
|
||||
|
||||
/* If we didn't find any instances of the show that haven't
|
||||
* been deleted, then just erase everything related to that show.
|
||||
* We can just delete, the show and the foreign key-constraint should
|
||||
* take care of deleting all of its instances. */
|
||||
if(is_null($showInstancesRow)){
|
||||
if ($this->checkToDeleteShow($showId)){
|
||||
CcShowQuery::create()
|
||||
->filterByDbId($showId)
|
||||
->delete();
|
||||
|
@ -537,20 +605,26 @@ class Application_Model_ShowInstance {
|
|||
return $time;
|
||||
}
|
||||
|
||||
|
||||
public function getTimeScheduledSecs()
|
||||
{
|
||||
$time_filled = $this->getTimeScheduled();
|
||||
return Application_Model_Schedule::WallTimeToMillisecs($time_filled) / 1000;
|
||||
}
|
||||
|
||||
public function getDurationSecs()
|
||||
{
|
||||
$ends = $this->getShowInstanceEnd(null);
|
||||
$starts = $this->getShowInstanceStart(null);
|
||||
return $ends->format('U') - $starts->format('U');
|
||||
}
|
||||
|
||||
public function getPercentScheduled()
|
||||
{
|
||||
$start_timestamp = $this->getShowInstanceStart();
|
||||
$end_timestamp = $this->getShowInstanceEnd();
|
||||
$time_filled = $this->getTimeScheduled();
|
||||
$durationSeconds = $this->getDurationSecs();
|
||||
$timeSeconds = $this->getTimeScheduledSecs();
|
||||
|
||||
$s_epoch = strtotime($start_timestamp);
|
||||
$e_epoch = strtotime($end_timestamp);
|
||||
$i_epoch = Application_Model_Schedule::WallTimeToMillisecs($time_filled) / 1000;
|
||||
|
||||
$percent = ceil(($i_epoch / ($e_epoch - $s_epoch)) * 100);
|
||||
|
||||
if ($percent > 100)
|
||||
$percent = 100;
|
||||
$percent = ceil(($timeSeconds / $durationSeconds) * 100);
|
||||
|
||||
return $percent;
|
||||
}
|
||||
|
@ -714,6 +788,7 @@ class Application_Model_ShowInstance {
|
|||
$sql = "SELECT si.id"
|
||||
." FROM $CC_CONFIG[showInstances] si"
|
||||
." WHERE si.ends < TIMESTAMP '$p_timeNow'"
|
||||
." AND si.modified_instance = 'f'"
|
||||
." ORDER BY si.ends DESC"
|
||||
." LIMIT 1";
|
||||
|
||||
|
@ -728,10 +803,18 @@ class Application_Model_ShowInstance {
|
|||
public static function GetCurrentShowInstance($p_timeNow){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
/* Orderby si.starts descending, because in some cases
|
||||
* we can have multiple shows overlapping each other. In
|
||||
* this case, the show that started later is the one that
|
||||
* is actually playing, and so this is the one we want.
|
||||
*/
|
||||
|
||||
$sql = "SELECT si.id"
|
||||
." FROM $CC_CONFIG[showInstances] si"
|
||||
." WHERE si.starts <= TIMESTAMP '$p_timeNow'"
|
||||
." AND si.ends > TIMESTAMP '$p_timeNow'"
|
||||
." AND si.modified_instance = 'f'"
|
||||
." ORDER BY si.starts DESC"
|
||||
." LIMIT 1";
|
||||
|
||||
$id = $CC_DBC->GetOne($sql);
|
||||
|
@ -748,6 +831,7 @@ class Application_Model_ShowInstance {
|
|||
$sql = "SELECT si.id"
|
||||
." FROM $CC_CONFIG[showInstances] si"
|
||||
." WHERE si.starts > TIMESTAMP '$p_timeNow'"
|
||||
." AND si.modified_instance = 'f'"
|
||||
." ORDER BY si.starts"
|
||||
." LIMIT 1";
|
||||
|
||||
|
|
|
@ -83,8 +83,12 @@ class Application_Model_StreamSetting {
|
|||
$CC_DBC->query($sql);
|
||||
} else if ($key == "output_sound_device_type") {
|
||||
$sql = "UPDATE cc_stream_setting SET value='$d' WHERE keyname='$key'";
|
||||
$CC_DBC->query($sql);
|
||||
} else {
|
||||
$CC_DBC->query($sql);
|
||||
} else if ($key == "streamFormat"){
|
||||
// this goes into cc_pref table
|
||||
Logging::log("Insert stream label format $d");
|
||||
Application_Model_Preference::SetStreamLabelFormat($d);
|
||||
} else if (is_array($d)) {
|
||||
$temp = explode('_', $key);
|
||||
$prefix = $temp[0];
|
||||
foreach ($d as $k=>$v) {
|
||||
|
@ -96,6 +100,8 @@ class Application_Model_StreamSetting {
|
|||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
||||
$CC_DBC->query($sql);
|
||||
}
|
||||
} else {
|
||||
Logging::log("Warning unexpected value: ".$key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,23 +120,31 @@ class Application_Model_Systemstatus
|
|||
public static function GetPypoStatus(){
|
||||
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
|
||||
if (is_null($component)){
|
||||
return null;
|
||||
} else {
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
|
||||
|
||||
return $data;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetLiquidsoapStatus(){
|
||||
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
|
||||
if (is_null($component)){
|
||||
return null;
|
||||
} else {
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
|
||||
|
||||
return $data;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetShowRecorderStatus(){
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
$path = dirname(__FILE__).'/../../../library/pear';
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
|
||||
$WHITE_SCREEN_OF_DEATH = false;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<input type="text" id="show_builder_datepicker_start" class="input_text"></input>
|
||||
<input type="text" id="show_builder_timepicker_start" class="input_text"></input>
|
||||
<input type="text" id="show_builder_datepicker_end" class="input_text"></input>
|
||||
<input type="text" id="show_builder_timepicker_end" class="input_text"></input>
|
||||
<input type="text" id="show_builder_datepicker_start" class="input_text" value="<?php echo $this->start_date?>"></input>
|
||||
<input type="text" id="show_builder_timepicker_start" class="input_text" value="<?php echo $this->start_time?>"></input>
|
||||
<input type="text" id="show_builder_datepicker_end" class="input_text" value="<?php echo $this->end_date?>"></input>
|
||||
<input type="text" id="show_builder_timepicker_end" class="input_text" value="<?php echo $this->end_time?>"></input>
|
||||
<input type="button" id="show_builder_timerange_button" class="ui-button ui-state-default" value="GO"></input>
|
||||
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue