diff --git a/CREDITS b/CREDITS index f0e45a381..5bf6bb12f 100644 --- a/CREDITS +++ b/CREDITS @@ -1,3 +1,33 @@ +======= +CREDITS +======= +Version 2.1.0 +------------- +Martin Konecny (martin.konecny@sourcefabric.org) + Role: Developer Team Lead + +Naomi Aro (naomi.aro@sourcefabric.org) + Role: Software Developer + +James Moon (james.moon@sourcefabric.org) + Role: Software Developer + +Denise Rigato (denise.rigato@sourcefabric.org) + Role: Software Developer + +Cliff Wang (cliff.wang@sourcefabric.org) + Role: QA + +Mikayel Karapetian (michael.karapetian@sourcefabric.org) + Role: QA + +Daniel James (daniel.james@sourcefabric.org) + Role: Documentor & QA + +Paul Baranowski (paul.baranowski@sourcefabric.org) + Role: Project Manager + + ======= CREDITS ======= diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index f512da0d4..f2ae6fe86 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -89,9 +89,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $userType = ""; } $view->headScript()->appendScript("var userType = '$userType';"); - if (Application_Model_Preference::GetPlanLevel() != "disabled" - && ($_SERVER['REQUEST_URI'] != '/Dashboard/stream-player' || $_SERVER['REQUEST_URI'] != '/audiopreview/audio-preview-player')) { + && !($_SERVER['REQUEST_URI'] == '/Dashboard/stream-player' || $_SERVER['REQUEST_URI'] == '/audiopreview/audio-preview-player')) { $client_id = Application_Model_Preference::GetClientId(); $view->headScript()->appendScript("var livechat_client_id = '$client_id';"); $view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php index 91167dd93..a8e6b2adc 100644 --- a/airtime_mvc/application/configs/ACL.php +++ b/airtime_mvc/application/configs/ACL.php @@ -34,11 +34,11 @@ $ccAcl->allow('G', 'index') ->allow('G', 'api') ->allow('G', 'schedule') ->allow('G', 'dashboard') + ->allow('G', 'audiopreview') ->allow('H', 'usersettings') ->allow('H', 'plupload') ->allow('H', 'library') ->allow('H', 'playlist') - ->allow('H', 'audiopreview') ->allow('A', 'playouthistory') ->allow('A', 'user') ->allow('A', 'systemstatus') diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 7f8e13a3a..49c31af07 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -6,7 +6,7 @@ class PreferenceController extends Zend_Controller_Action public function init() { /* Initialize action controller here */ - $ajaxContext = $this->_helper->getHelper('AjaxContext'); + $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('server-browse', 'json') ->addActionContext('change-stor-directory', 'json') ->addActionContext('reload-watch-directory', 'json') @@ -143,6 +143,8 @@ class PreferenceController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + + $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; // get current settings $temp = Application_Model_StreamSetting::getStreamSetting(); @@ -197,13 +199,12 @@ class PreferenceController extends Zend_Controller_Action $values = $post_data; if($form->isValid($post_data)){ - if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ + if (!$isSaas) { $values['output_sound_device'] = $form->getValue('output_sound_device'); + $values['output_sound_device_type'] = $form->getValue('output_sound_device_type'); } - $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); - $values['output_sound_device_type'] = $form->getValue('output_sound_device_type'); $values['streamFormat'] = $form->getValue('streamFormat'); Application_Model_StreamSetting::setStreamSetting($values); @@ -214,17 +215,19 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]); Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]); - $master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"]; - $live_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["dj_harbor_input_port"]."/".$values["dj_harbor_input_mount_point"]; + if (!$isSaas) { + $master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"]; + $live_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["dj_harbor_input_port"]."/".$values["dj_harbor_input_mount_point"]; - Application_Model_Preference::SetMasterDJSourceConnectionURL($master_connection_url); - Application_Model_Preference::SetLiveDJSourceConnectionURL($live_connection_url); + Application_Model_Preference::SetMasterDJSourceConnectionURL($master_connection_url); + Application_Model_Preference::SetLiveDJSourceConnectionURL($live_connection_url); - // extra info that goes into cc_stream_setting - Application_Model_StreamSetting::SetMasterLiveSteamPort($values["master_harbor_input_port"]); - Application_Model_StreamSetting::SetMasterLiveSteamMountPoint($values["master_harbor_input_mount_point"]); - Application_Model_StreamSetting::SetDJLiveSteamPort($values["dj_harbor_input_port"]); - Application_Model_StreamSetting::SetDJLiveSteamMountPoint($values["dj_harbor_input_mount_point"]); + // extra info that goes into cc_stream_setting + Application_Model_StreamSetting::SetMasterLiveSteamPort($values["master_harbor_input_port"]); + Application_Model_StreamSetting::SetMasterLiveSteamMountPoint($values["master_harbor_input_mount_point"]); + Application_Model_StreamSetting::SetDJLiveSteamPort($values["dj_harbor_input_port"]); + Application_Model_StreamSetting::SetDJLiveSteamMountPoint($values["dj_harbor_input_mount_point"]); + } // store stream update timestamp Application_Model_Preference::SetStreamUpdateTimestamp(); diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index f98c06f33..755cbc7f3 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -272,47 +272,25 @@ class ScheduleController extends Zend_Controller_Action } if ($showStartLocalDT->getTimestamp() <= $epochNow && - $epochNow < $showEndLocalDT->getTimestamp() && - ($isAdminOrPM || $isDJ)) { + $epochNow < $showEndLocalDT->getTimestamp() && $isAdminOrPM) { if ($instance->isRecorded()) { - if($isAdminOrPM){ - $menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete"); - } - } else { - if($instance->isRepeating()){ - /*$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array()); - $menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/populate-show-instance-form"); - $menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/populate-show-form");*/ + $menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete"); + } + else { + + if (!$instance->isRebroadcast()) { $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form"); - }else{ - if($instance->isRebroadcast()){ - $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"rebroadcast", "url" => "/Schedule/populate-show-form"); - }else{ - $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form"); - } - } - if($isAdminOrPM){ - $menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete"); } + + $menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete"); } } if ($epochNow < $showStartLocalDT->getTimestamp()) { - if ($isAdminOrPM || $isDJ) { - - if($instance->isRepeating()){ - /*$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array()); - $menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/populate-show-instance-form"); - $menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/populate-show-form");*/ + if (!$instance->isRebroadcast() && $isAdminOrPM) { $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form"); - }else{ - if($instance->isRebroadcast()){ - $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"rebroadcast", "url" => "/Schedule/populate-show-form"); - }else{ - $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form"); - } } if ($instance->getShow()->isRepeating() && $isAdminOrPM) { @@ -324,11 +302,10 @@ class ScheduleController extends Zend_Controller_Action $menu["del"]["items"]["following"] = array("name"=> "Delete This Instance and All Following", "icon" => "delete", "url" => "/schedule/cancel-show"); } - else if($isAdminOrPM){ - //window["scheduleRefetchEvents"]' - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show"); + else if ($isAdminOrPM){ + + $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show"); } - } } $this->view->items = $menu; diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index d3e5b5400..b16717bde 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -22,6 +22,10 @@ class ShowbuilderController extends Zend_Controller_Action $request = $this->getRequest(); $baseUrl = $request->getBaseUrl(); + $user = Application_Model_User::GetCurrentUser(); + + $userType = $user->getType(); + $this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );"); $data = Application_Model_Preference::GetValue("library_datatable", true); if ($data != "") { @@ -60,8 +64,7 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript'); - - $user = Application_Model_User::GetCurrentUser(); + $refer_sses = new Zend_Session_Namespace('referrer'); if ($request->isPost()) { diff --git a/airtime_mvc/application/forms/AddShowLiveStream.php b/airtime_mvc/application/forms/AddShowLiveStream.php index cc90cf6d6..680de4645 100644 --- a/airtime_mvc/application/forms/AddShowLiveStream.php +++ b/airtime_mvc/application/forms/AddShowLiveStream.php @@ -14,7 +14,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm ->setDecorators(array('ViewHelper')); $this->addElement($cb_airtime_auth); - $description2 = "Specify custom authentication which will work for only for this show."; + $description2 = "Specify custom authentication which will work only for this show."; $cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth"); $cb_custom_auth ->setLabel("Use Custom Authentication:") ->setDescription($description2) diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php index 54e934284..b922bc8fe 100644 --- a/airtime_mvc/application/forms/LiveStreamingPreferences.php +++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php @@ -2,9 +2,10 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm { - + public function init() { + $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $defaultFade = Application_Model_Preference::GetDefaultTransitionFade(); if($defaultFade == ""){ $defaultFade = '00.000000'; @@ -42,42 +43,44 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm $this->addElement($master_password); //liquidsoap harbor.input port - $m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort(); - $master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port'); - $master_dj_port->setLabel("Master Source Port") - ->setValue($m_port) - ->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151)))) - ->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.'))) - ->setDecorators(array('ViewHelper')); - $this->addElement($master_dj_port); - - $m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint(); - $master_dj_mount = new Zend_Form_Element_Text('master_harbor_input_mount_point'); - $master_dj_mount->setLabel("Master Source Mount Point") - ->setValue($m_mount) - ->setValidators(array( - array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) - ->setDecorators(array('ViewHelper')); - $this->addElement($master_dj_mount); - - //liquidsoap harbor.input port - $l_port = Application_Model_StreamSetting::GetDJLiveSteamPort(); - $live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port'); - $live_dj_port->setLabel("Show Source Port") - ->setValue($l_port) - ->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151)))) - ->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.'))) - ->setDecorators(array('ViewHelper')); - $this->addElement($live_dj_port); - - $l_mount = Application_Model_StreamSetting::GetDJLiveSteamMountPoint(); - $live_dj_mount = new Zend_Form_Element_Text('dj_harbor_input_mount_point'); - $live_dj_mount->setLabel("Show Source Mount Point") - ->setValue($l_mount) - ->setValidators(array( - array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) - ->setDecorators(array('ViewHelper')); - $this->addElement($live_dj_mount); + if (!$isSaas) { + $m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort(); + $master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port'); + $master_dj_port->setLabel("Master Source Port") + ->setValue($m_port) + ->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151)))) + ->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.'))) + ->setDecorators(array('ViewHelper')); + $this->addElement($master_dj_port); + + $m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint(); + $master_dj_mount = new Zend_Form_Element_Text('master_harbor_input_mount_point'); + $master_dj_mount->setLabel("Master Source Mount Point") + ->setValue($m_mount) + ->setValidators(array( + array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) + ->setDecorators(array('ViewHelper')); + $this->addElement($master_dj_mount); + + //liquidsoap harbor.input port + $l_port = Application_Model_StreamSetting::GetDJLiveSteamPort(); + $live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port'); + $live_dj_port->setLabel("Show Source Port") + ->setValue($l_port) + ->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151)))) + ->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.'))) + ->setDecorators(array('ViewHelper')); + $this->addElement($live_dj_port); + + $l_mount = Application_Model_StreamSetting::GetDJLiveSteamMountPoint(); + $live_dj_mount = new Zend_Form_Element_Text('dj_harbor_input_mount_point'); + $live_dj_mount->setLabel("Show Source Mount Point") + ->setValue($l_mount) + ->setValidators(array( + array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) + ->setDecorators(array('ViewHelper')); + $this->addElement($live_dj_mount); + } } public function updateVariables(){ @@ -106,45 +109,47 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm } public function isValid($data){ + $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $isValid = parent::isValid($data); - - $master_harbor_input_port = $data['master_harbor_input_port']; - $dj_harbor_input_port = $data['dj_harbor_input_port']; - - if($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != ""){ - $element = $this->getElement("dj_harbor_input_port"); - $element->addError("You cannot use same port as Master DJ port."); - } - if($master_harbor_input_port != ""){ - if(is_numeric($master_harbor_input_port)){ - if($master_harbor_input_port != Application_Model_StreamSetting::GetMasterLiveSteamPort()){ - $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - $res = socket_bind($sock, 0, $master_harbor_input_port); - if(!$res){ - $element = $this->getElement("master_harbor_input_port"); - $element->addError("Port '$master_harbor_input_port' is not available."); - $isValid = false; - } - socket_close($sock); - } - }else{ - $isValid = false; + if (!$isSaas) { + $master_harbor_input_port = $data['master_harbor_input_port']; + $dj_harbor_input_port = $data['dj_harbor_input_port']; + + if($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != ""){ + $element = $this->getElement("dj_harbor_input_port"); + $element->addError("You cannot use same port as Master DJ port."); } - } - if($dj_harbor_input_port != ""){ - if(is_numeric($dj_harbor_input_port)){ - if($dj_harbor_input_port != Application_Model_StreamSetting::GetDJLiveSteamPort()){ - $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - $res = socket_bind($sock, 0, $dj_harbor_input_port); - if(!$res){ - $element = $this->getElement("dj_harbor_input_port"); - $element->addError("Port '$dj_harbor_input_port' is not available."); - $isValid = false; + if($master_harbor_input_port != ""){ + if(is_numeric($master_harbor_input_port)){ + if($master_harbor_input_port != Application_Model_StreamSetting::GetMasterLiveSteamPort()){ + $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + $res = socket_bind($sock, 0, $master_harbor_input_port); + if(!$res){ + $element = $this->getElement("master_harbor_input_port"); + $element->addError("Port '$master_harbor_input_port' is not available."); + $isValid = false; + } + socket_close($sock); } - socket_close($sock); + }else{ + $isValid = false; + } + } + if($dj_harbor_input_port != ""){ + if(is_numeric($dj_harbor_input_port)){ + if($dj_harbor_input_port != Application_Model_StreamSetting::GetDJLiveSteamPort()){ + $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + $res = socket_bind($sock, 0, $dj_harbor_input_port); + if(!$res){ + $element = $this->getElement("dj_harbor_input_port"); + $element->addError("Port '$dj_harbor_input_port' is not available."); + $isValid = false; + } + socket_close($sock); + } + }else{ + $isValid = false; } - }else{ - $isValid = false; } } return $isValid; diff --git a/airtime_mvc/application/models/LiveLog.php b/airtime_mvc/application/models/LiveLog.php index dc3090239..b641ef6ef 100644 --- a/airtime_mvc/application/models/LiveLog.php +++ b/airtime_mvc/application/models/LiveLog.php @@ -237,8 +237,9 @@ class Application_Model_LiveLog public static function SetNewLogTime($state, $dateTime){ try { $con = Propel::getConnection(); - - if ($state == 'L') { + + $scheduled = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play'); + if ($state == 'L' && $scheduled == 'on') { self::SetEndTime('S', $dateTime); } @@ -253,6 +254,10 @@ class Application_Model_LiveLog $sql_insert = "INSERT INTO CC_LIVE_LOG (state, start_time)" ." VALUES ('$state', '{$dateTime->format("Y-m-d H:i:s")}')"; $con->exec($sql_insert); + if($state == "S"){ + // if scheduled play source is getting broadcasted + Application_Model_Schedule::UpdateBrodcastedStatus($dateTime, 1); + } } } catch (Exception $e) { @@ -298,4 +303,4 @@ class Application_Model_LiveLog } } -} \ No newline at end of file +} diff --git a/airtime_mvc/application/models/PlayoutHistory.php b/airtime_mvc/application/models/PlayoutHistory.php index 8e453f2ba..a5e4b9fb1 100644 --- a/airtime_mvc/application/models/PlayoutHistory.php +++ b/airtime_mvc/application/models/PlayoutHistory.php @@ -66,7 +66,7 @@ class Application_Model_PlayoutHistory { select count(schedule.file_id) as played, schedule.file_id as file_id from cc_schedule as schedule where schedule.starts >= '{$start}' and schedule.starts < '{$end}' - and schedule.playout_status > 0 and schedule.media_item_played != FALSE + and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1 group by schedule.file_id ) AS playout left join cc_files as file on (file.id = playout.file_id)"; diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 2505a563f..62eb62ee0 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -412,7 +412,13 @@ class Application_Model_Preference $key == 'FREE_RAM' || $key == 'AIRTIME_VERSION' || $key == 'KERNAL_VERSION' || $key == 'MACHINE_ARCHITECTURE' || $key == 'TOTAL_MEMORY_MBYTES' || $key == 'TOTAL_SWAP_MBYTES' || $key == 'PLAYOUT_ENGINE_CPU_PERC' ) { - $systemInfoArray[$key] = $info[1]; + if($key == 'AIRTIME_VERSION'){ + // remove hash tag on the version string + $version = explode('+', $info[1]); + $systemInfoArray[$key] = $version[0]; + }else{ + $systemInfoArray[$key] = $info[1]; + } } } } @@ -481,6 +487,10 @@ class Application_Model_Preference } else if (!$out) { $outputString .= $key." : FALSE\n"; } + }else if ($key == "SAAS") { + if (strcmp($out, 'disabled')!=0) { + $outputString .= $key.' : '.$out."\n"; + } }else{ $outputString .= $key.' : '.$out."\n"; } diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 0c6180176..05b527ee0 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -48,7 +48,8 @@ class Application_Model_Schedule { $range = array("env"=>APPLICATION_ENV, "schedulerTime"=>$timeNow, "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]: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]:null), "next"=> $results['next'] !=null?$results['next']:(count($shows['nextShow'])>0?$shows['nextShow'][0]:null), "currentShow"=>$shows['currentShow'], "nextShow"=>$shows['nextShow'], @@ -290,8 +291,30 @@ class Application_Model_Schedule { global $CC_CONFIG; $con = Propel::getConnection(); $sql = "UPDATE ".$CC_CONFIG['scheduleTable'] - ." SET media_item_played=TRUE" - ." WHERE id=$p_id"; + ." SET media_item_played=TRUE"; + // we need to update 'broadcasted' column as well + // check the current switch status + $live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'?true:false; + $master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'?true:false; + $scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'?true:false; + + if(!$live_dj && !$master_dj && $scheduled_play){ + $sql .= ", broadcasted=1"; + } + + $sql .= " WHERE id=$p_id"; + + $retVal = $con->exec($sql); + return $retVal; + } + + public static function UpdateBrodcastedStatus($dateTime, $value){ + global $CC_CONFIG; + $con = Propel::getConnection(); + $now = $dateTime->format("Y-m-d H:i:s"); + $sql = "UPDATE ".$CC_CONFIG['scheduleTable'] + ." SET broadcasted=$value" + ." WHERE starts <= '$now' AND ends >= '$now'"; $retVal = $con->exec($sql); return $retVal; } diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 8c3d8d60c..57c505713 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -848,7 +848,7 @@ class Application_Model_Show { $showId = $this->getId(); $sql = "SELECT id FROM cc_show_instances" ." WHERE date(starts) = date(TIMESTAMP '$timestamp') " - ." AND show_id = $showId"; + ." AND show_id = $showId AND rebroadcast = 0"; $query = $con->query($sql); $row = ($query !== false) ? $query->fetchColumn(0) : null; @@ -1484,32 +1484,34 @@ class Application_Model_Show { Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp); } - $sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name, - color, background_color, file_id, cc_show_instances.id AS instance_id, - created, last_scheduled, time_filled - FROM cc_show_instances - LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id - WHERE cc_show_instances.modified_instance = FALSE"; + $sql = "SELECT si1.starts AS starts, si1.ends AS ends, si1.record AS record, si1.rebroadcast AS rebroadcast, si2.starts AS parent_starts, + si1.instance_id AS record_id, si1.show_id AS show_id, show.name AS name, + show.color AS color, show.background_color AS background_color, si1.file_id AS file_id, si1.id AS instance_id, + si1.created AS created, si1.last_scheduled AS last_scheduled, si1.time_filled AS time_filled + FROM cc_show_instances AS si1 + LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id + LEFT JOIN cc_show AS show ON show.id = si1.show_id + WHERE si1.modified_instance = FALSE"; //only want shows that are starting at the time or later. $start_string = $start_timestamp->format("Y-m-d H:i:s"); $end_string = $end_timestamp->format("Y-m-d H:i:s"); if ($onlyRecord) { - $sql = $sql." AND (starts >= '{$start_string}' AND starts < timestamp '{$end_string}')"; - $sql = $sql." AND (record = 1)"; + $sql = $sql." AND (si1.starts >= '{$start_string}' AND si1.starts < timestamp '{$end_string}')"; + $sql = $sql." AND (si1.record = 1)"; } else { - $sql = $sql." AND ((starts >= '{$start_string}' AND starts < '{$end_string}') - OR (ends > '{$start_string}' AND ends <= '{$end_string}') - OR (starts <= '{$start_string}' AND ends >= '{$end_string}'))"; + $sql = $sql." AND ((si1.starts >= '{$start_string}' AND si1.starts < '{$end_string}') + OR (si1.ends > '{$start_string}' AND si1.ends <= '{$end_string}') + OR (si1.starts <= '{$start_string}' AND si1.ends >= '{$end_string}'))"; } if (isset($excludeInstance)) { foreach($excludeInstance as $instance) { - $sql_exclude[] = "cc_show_instances.id != {$instance}"; + $sql_exclude[] = "si1.id != {$instance}"; } $exclude = join(" OR ", $sql_exclude); @@ -1517,8 +1519,6 @@ class Application_Model_Show { $sql = $sql." AND ({$exclude})"; } - //Logging::log("getShows"); - //Logging::log($sql); $result = $con->query($sql)->fetchAll(); return $result; } @@ -1594,15 +1594,22 @@ class Application_Model_Show { $options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]); } + if (isset($show["parent_starts"])) { + $parentStartsDT = new DateTime($show["parent_starts"], new DateTimeZone("UTC")); + $parentStartsEpoch = intval($parentStartsDT->format("U")); + } $startsDT = new DateTime($show["starts"], new DateTimeZone("UTC")); $endsDT = new DateTime($show["ends"], new DateTimeZone("UTC")); $startsEpoch = intval($startsDT->format("U")); $endsEpoch = intval($endsDT->format("U")); - if ($p_editable && $show["record"] && $nowEpoch < $endsEpoch) { + if ($p_editable && $show["record"] && $nowEpoch > $startsEpoch) { $options["editable"] = false; } + else if ($p_editable && $show["rebroadcast"] && $nowEpoch > $parentStartsEpoch) { + $options["editable"] = false; + } else if ($p_editable && $nowEpoch < $endsEpoch) { $options["editable"] = true; } @@ -1764,7 +1771,7 @@ class Application_Model_Show { for( $i = 0; $i < $numberOfRows; ++$i ){ //Find the show that is within the current time. - if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) >= $timeNowAsMillis)){ + if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) > $timeNowAsMillis)){ if ( $i - 1 >= 0){ $results['previousShow'][0] = array( "id"=>$rows[$i-1]['id'], diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 3bf081cb4..650734e2d 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -59,6 +59,22 @@ class Application_Model_ShowBuilder { $this->epoch_now = floatval(microtime(true)); $this->currentShow = false; } + + private function getUsersShows() { + + $shows = array(); + + $host_shows = CcShowHostsQuery::create() + ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) + ->filterByDbHost($this->user->getId()) + ->find(); + + foreach ($host_shows as $host_show) { + $shows[] = $host_show->getDbShow(); + } + + return $shows; + } //check to see if this row should be editable by the user. private function isAllowed($p_item, &$row) { @@ -333,27 +349,43 @@ class Application_Model_ShowBuilder { public function hasBeenUpdatedSince($timestamp, $instances) { $outdated = false; $shows = Application_Model_Show::getShows($this->startDT, $this->endDT); + + if ($this->opts["showFilter"] !== 0) { + $include[] = $this->opts["showFilter"]; + } + else if ($this->opts["myShows"] === 1) { + + $include = $this->getUsersShows(); + } + + $currentInstances = array(); foreach ($shows as $show) { - $currentInstances[] = $show["instance_id"]; - - if (isset($show["last_scheduled"])) { - $dt = new DateTime($show["last_scheduled"], new DateTimeZone("UTC")); - } - else { - $dt = new DateTime($show["created"], new DateTimeZone("UTC")); - } - //check if any of the shows have a more recent timestamp. - if ($timestamp < intval($dt->format("U"))) { - $outdated = true; - break; + if (empty($include) || in_array($show["show_id"], $include)) { + $currentInstances[] = $show["instance_id"]; + + if (isset($show["last_scheduled"])) { + $dt = new DateTime($show["last_scheduled"], new DateTimeZone("UTC")); + } + else { + $dt = new DateTime($show["created"], new DateTimeZone("UTC")); + } + + //check if any of the shows have a more recent timestamp. + $showTimeStamp = intval($dt->format("U")); + if ($timestamp < $showTimeStamp) { + Logging::debug("timestamp is {$timestamp} show timestamp is {$showTimeStamp}"); + $outdated = true; + break; + } } } //see if the displayed show instances have changed. (deleted, empty schedule etc) if ($outdated === false && count($instances) !== count($currentInstances)) { + Logging::debug("show instances have changed."); $outdated = true; } @@ -368,14 +400,7 @@ class Application_Model_ShowBuilder { $shows = array(); if ($this->opts["myShows"] === 1) { - $host_shows = CcShowHostsQuery::create() - ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) - ->filterByDbHost($this->user->getId()) - ->find(); - - foreach ($host_shows as $host_show) { - $shows[] = $host_show->getDbShow(); - } + $shows = $this->getUsersShows(); } else if ($this->opts["showFilter"] !== 0) { $shows[] = $this->opts["showFilter"]; diff --git a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php index dd3189d10..64e9b2609 100644 --- a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php @@ -50,6 +50,7 @@ class CcScheduleTableMap extends TableMap { $this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false); $this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null); $this->addColumn('PLAYOUT_STATUS', 'DbPlayoutStatus', 'SMALLINT', true, null, 1); + $this->addColumn('BROADCASTED', 'DbBroadcasted', 'SMALLINT', true, null, 0); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php index dea91b5f7..9556499bb 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php @@ -103,6 +103,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent */ protected $playout_status; + /** + * The value for the broadcasted field. + * Note: this column has a database default value of: 0 + * @var int + */ + protected $broadcasted; + /** * @var CcShowInstances */ @@ -142,6 +149,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->cue_out = '00:00:00'; $this->media_item_played = false; $this->playout_status = 1; + $this->broadcasted = 0; } /** @@ -366,6 +374,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return $this->playout_status; } + /** + * Get the [broadcasted] column value. + * + * @return int + */ + public function getDbBroadcasted() + { + return $this->broadcasted; + } + /** * Set the value of [id] column. * @@ -732,6 +750,26 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return $this; } // setDbPlayoutStatus() + /** + * Set the value of [broadcasted] column. + * + * @param int $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbBroadcasted($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->broadcasted !== $v || $this->isNew()) { + $this->broadcasted = $v; + $this->modifiedColumns[] = CcSchedulePeer::BROADCASTED; + } + + return $this; + } // setDbBroadcasted() + /** * Indicates whether the columns in this object are only set to default values. * @@ -770,6 +808,10 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return false; } + if ($this->broadcasted !== 0) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -804,6 +846,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->media_item_played = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; $this->instance_id = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null; $this->playout_status = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null; + $this->broadcasted = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null; $this->resetModified(); $this->setNew(false); @@ -812,7 +855,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 12; // 12 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 13; // 13 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcSchedule object", $e); @@ -1192,6 +1235,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent case 11: return $this->getDbPlayoutStatus(); break; + case 12: + return $this->getDbBroadcasted(); + break; default: return null; break; @@ -1228,6 +1274,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $keys[9] => $this->getDbMediaItemPlayed(), $keys[10] => $this->getDbInstanceId(), $keys[11] => $this->getDbPlayoutStatus(), + $keys[12] => $this->getDbBroadcasted(), ); if ($includeForeignObjects) { if (null !== $this->aCcShowInstances) { @@ -1303,6 +1350,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent case 11: $this->setDbPlayoutStatus($value); break; + case 12: + $this->setDbBroadcasted($value); + break; } // switch() } @@ -1339,6 +1389,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent if (array_key_exists($keys[9], $arr)) $this->setDbMediaItemPlayed($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setDbInstanceId($arr[$keys[10]]); if (array_key_exists($keys[11], $arr)) $this->setDbPlayoutStatus($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setDbBroadcasted($arr[$keys[12]]); } /** @@ -1362,6 +1413,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played); if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id); if ($this->isColumnModified(CcSchedulePeer::PLAYOUT_STATUS)) $criteria->add(CcSchedulePeer::PLAYOUT_STATUS, $this->playout_status); + if ($this->isColumnModified(CcSchedulePeer::BROADCASTED)) $criteria->add(CcSchedulePeer::BROADCASTED, $this->broadcasted); return $criteria; } @@ -1434,6 +1486,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $copyObj->setDbMediaItemPlayed($this->media_item_played); $copyObj->setDbInstanceId($this->instance_id); $copyObj->setDbPlayoutStatus($this->playout_status); + $copyObj->setDbBroadcasted($this->broadcasted); $copyObj->setNew(true); $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value @@ -1592,6 +1645,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->media_item_played = null; $this->instance_id = null; $this->playout_status = null; + $this->broadcasted = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->clearAllReferences(); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php index 86f529929..c73ee915d 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php @@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer { const TM_CLASS = 'CcScheduleTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 12; + const NUM_COLUMNS = 13; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -67,6 +67,9 @@ abstract class BaseCcSchedulePeer { /** the column name for the PLAYOUT_STATUS field */ const PLAYOUT_STATUS = 'cc_schedule.PLAYOUT_STATUS'; + /** the column name for the BROADCASTED field */ + const BROADCASTED = 'cc_schedule.BROADCASTED'; + /** * An identiy map to hold any loaded instances of CcSchedule objects. * This must be public so that other peer classes can access this when hydrating from JOIN @@ -83,12 +86,12 @@ abstract class BaseCcSchedulePeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, self::BROADCASTED, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) ); /** @@ -98,12 +101,12 @@ abstract class BaseCcSchedulePeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, 'DbPlayoutStatus' => 11, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, 'dbPlayoutStatus' => 11, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, self::PLAYOUT_STATUS => 11, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, 'PLAYOUT_STATUS' => 11, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, 'playout_status' => 11, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, 'DbPlayoutStatus' => 11, 'DbBroadcasted' => 12, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, 'dbPlayoutStatus' => 11, 'dbBroadcasted' => 12, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, self::PLAYOUT_STATUS => 11, self::BROADCASTED => 12, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, 'PLAYOUT_STATUS' => 11, 'BROADCASTED' => 12, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, 'playout_status' => 11, 'broadcasted' => 12, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) ); /** @@ -187,6 +190,7 @@ abstract class BaseCcSchedulePeer { $criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED); $criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID); $criteria->addSelectColumn(CcSchedulePeer::PLAYOUT_STATUS); + $criteria->addSelectColumn(CcSchedulePeer::BROADCASTED); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.STARTS'); @@ -200,6 +204,7 @@ abstract class BaseCcSchedulePeer { $criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED'); $criteria->addSelectColumn($alias . '.INSTANCE_ID'); $criteria->addSelectColumn($alias . '.PLAYOUT_STATUS'); + $criteria->addSelectColumn($alias . '.BROADCASTED'); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php index 424e7f6f3..236e3cb26 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php @@ -18,6 +18,7 @@ * @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column * @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column * @method CcScheduleQuery orderByDbPlayoutStatus($order = Criteria::ASC) Order by the playout_status column + * @method CcScheduleQuery orderByDbBroadcasted($order = Criteria::ASC) Order by the broadcasted column * * @method CcScheduleQuery groupByDbId() Group by the id column * @method CcScheduleQuery groupByDbStarts() Group by the starts column @@ -31,6 +32,7 @@ * @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column * @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column * @method CcScheduleQuery groupByDbPlayoutStatus() Group by the playout_status column + * @method CcScheduleQuery groupByDbBroadcasted() Group by the broadcasted column * * @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -59,6 +61,7 @@ * @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column * @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column * @method CcSchedule findOneByDbPlayoutStatus(int $playout_status) Return the first CcSchedule filtered by the playout_status column + * @method CcSchedule findOneByDbBroadcasted(int $broadcasted) Return the first CcSchedule filtered by the broadcasted column * * @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column * @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column @@ -72,6 +75,7 @@ * @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column * @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column * @method array findByDbPlayoutStatus(int $playout_status) Return CcSchedule objects filtered by the playout_status column + * @method array findByDbBroadcasted(int $broadcasted) Return CcSchedule objects filtered by the broadcasted column * * @package propel.generator.airtime.om */ @@ -498,6 +502,37 @@ abstract class BaseCcScheduleQuery extends ModelCriteria return $this->addUsingAlias(CcSchedulePeer::PLAYOUT_STATUS, $dbPlayoutStatus, $comparison); } + /** + * Filter the query on the broadcasted column + * + * @param int|array $dbBroadcasted The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbBroadcasted($dbBroadcasted = null, $comparison = null) + { + if (is_array($dbBroadcasted)) { + $useMinMax = false; + if (isset($dbBroadcasted['min'])) { + $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbBroadcasted['max'])) { + $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted, $comparison); + } + /** * Filter the query by a related CcShowInstances object * diff --git a/airtime_mvc/application/views/scripts/form/login.phtml b/airtime_mvc/application/views/scripts/form/login.phtml index f34f5d6b7..87510201a 100644 --- a/airtime_mvc/application/views/scripts/form/login.phtml +++ b/airtime_mvc/application/views/scripts/form/login.phtml @@ -25,7 +25,7 @@ Reset password - + element->getElement('captcha') ?>
 
element->getElement('submit') ?> diff --git a/airtime_mvc/application/views/scripts/form/showbuilder.phtml b/airtime_mvc/application/views/scripts/form/showbuilder.phtml index 68173ba41..ddca06770 100644 --- a/airtime_mvc/application/views/scripts/form/showbuilder.phtml +++ b/airtime_mvc/application/views/scripts/form/showbuilder.phtml @@ -1,14 +1,9 @@ -
-
- -
- element->getElement('sb_date_start') ?> - element->getElement('sb_time_start') ?> - element->getElement('sb_date_end') ?> - element->getElement('sb_time_end') ?> -
- -
+element->getElement('sb_date_start'); ?> +element->getElement('sb_time_start'); ?> +element->getElement('sb_date_end'); ?> +element->getElement('sb_time_end'); ?> +
+
diff --git a/airtime_mvc/application/views/scripts/showbuilder/index.phtml b/airtime_mvc/application/views/scripts/showbuilder/index.phtml index 84d3db653..6e708004c 100644 --- a/airtime_mvc/application/views/scripts/showbuilder/index.phtml +++ b/airtime_mvc/application/views/scripts/showbuilder/index.phtml @@ -9,7 +9,14 @@
+
+ disableLib && !$this->showLib):?> +
+ +
+ sb_form; ?> +
diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 36e81a2b9..61a2f783d 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -281,6 +281,7 @@ +