diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php index 9a30348a2..ddef27cbe 100644 --- a/airtime_mvc/application/controllers/DashboardController.php +++ b/airtime_mvc/application/controllers/DashboardController.php @@ -50,10 +50,9 @@ class DashboardController extends Zend_Controller_Action $user = new Application_Model_User($userInfo->id); $show = Application_Model_Show::GetCurrentShow(); - $show_id = isset($show['id'])?$show['id']:0; + $show_id = isset($show[0]['id'])?$show[0]['id']:0; $source_connected = Application_Model_Preference::GetSourceStatus($sourcename); - if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play')){ $change_status_to = "on"; diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index ef5c3b475..00ecbfea3 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -213,6 +213,12 @@ 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"]; + + 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"]); @@ -232,9 +238,9 @@ class PreferenceController extends Zend_Controller_Action Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data); $this->view->statusMsg = "
Stream Setting Updated.
"; } - $live_stream_subform->updateConnectionURLs(); } + $live_stream_subform->updateVariables(); $this->view->confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings)."; $this->view->num_stream = $num_of_stream; diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index b0fd1f011..58938f654 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -89,12 +89,12 @@ class ScheduleController extends Zend_Controller_Action Application_Model_Schedule::createNewFormSections($this->view); - $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new Application_Model_User($userInfo->id); - if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){ + $user = Application_Model_User::GetCurrentUser(); + + if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){ $this->view->preloadShowForm = true; } - + $this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";"); } @@ -227,7 +227,7 @@ class ScheduleController extends Zend_Controller_Action $showStartLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart()); $showEndLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd()); - if ($epochNow < $showStartLocalDT->getTimestamp()) { + if ($epochNow < $showEndLocalDT->getTimestamp()) { if ( ($isAdminOrPM || $isDJ) && !$instance->isRecorded() @@ -586,7 +586,13 @@ class ScheduleController extends Zend_Controller_Action 'add_show_repeats' => $show->isRepeating() ? 1 : 0)); if ($show->isStartDateTimeInPast()){ - $formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true)); + // for a non-repeating show, we should never allow user to change the start time. + // for the repeating show, we should allow because the form works as repeating template form + if(!$showInstance->getShow()->isRepeating()){ + $formWhen->disableStartDateAndTime(); + }else{ + $formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true)); + } } //need to get the days of the week in the php timezone (for the front end). @@ -684,7 +690,7 @@ class ScheduleController extends Zend_Controller_Action $user = Application_Model_User::GetCurrentUser(); - if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){ + if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){ Application_Model_Schedule::createNewFormSections($this->view); $this->view->form = $this->view->render('schedule/add-show-form.phtml'); } @@ -765,7 +771,9 @@ class ScheduleController extends Zend_Controller_Action //array key does not exist. We need to repopulate this entry from the db. //The start date will be returned in UTC time, so lets convert it to local time. $dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDate()); + $startTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartTime()); $data['add_show_start_date'] = $dt->format("Y-m-d"); + $data['add_show_start_time'] = $startTime->format("H:i"); $validateStartDate = false; } diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index ed10c89a9..d62dff3c3 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -131,5 +131,16 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $element->setAttrib('disabled','disabled'); } } + + public function disableStartDateAndTime(){ + $elements = array($this->getElement('add_show_start_date'), $this->getElement('add_show_start_time')); + foreach ($elements as $element) + { + if ($element->getType() != 'Zend_Form_Element_Hidden') + { + $element->setAttrib('disabled','disabled'); + } + } + } } diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php index d97530c2a..7d22f6383 100644 --- a/airtime_mvc/application/forms/LiveStreamingPreferences.php +++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php @@ -78,26 +78,9 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) ->setDecorators(array('ViewHelper')); $this->addElement($live_dj_mount); - - $master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL(); - $live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL(); - - $master_dj_connection_url = ($master_dj_connection_url == "")?("http://".$_SERVER['SERVER_NAME'].":".$m_port."/".$m_mount):$master_dj_connection_url; - $live_dj_connection_url = ($live_dj_connection_url == "")?"http://".$_SERVER['SERVER_NAME'].":".$l_port."/".$l_mount:$live_dj_connection_url; - - if($m_port=="" || $m_mount==""){ - $master_dj_connection_url = "N/A"; - } - if($l_port=="" || $l_mount==""){ - $live_dj_connection_url = "N/A"; - } - - $this->setDecorators(array( - array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url,)) - )); } - public function updateConnectionURLs(){ + public function updateVariables(){ $m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort(); $m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint(); $l_port = Application_Model_StreamSetting::GetDJLiveSteamPort(); @@ -116,8 +99,10 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm $live_dj_connection_url = "N/A"; } + $overrideDescription = "If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. For more detail, please read the Airtime manual."; + $this->setDecorators(array( - array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url,)) + array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url,'overrideDescription' => $overrideDescription)) )); } diff --git a/airtime_mvc/application/logging/Logging.php b/airtime_mvc/application/logging/Logging.php index a98b932d7..5c25b831f 100644 --- a/airtime_mvc/application/logging/Logging.php +++ b/airtime_mvc/application/logging/Logging.php @@ -18,7 +18,7 @@ class Logging { } public static function toString($p_msg){ - if (is_array($p_msg)){ + if (is_array($p_msg) || is_object($p_msg)){ return print_r($p_msg, true); } else { return $p_msg; diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 7e21d1376..ea7ef121b 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -569,8 +569,10 @@ class Application_Model_ShowInstance { $time = $this->_showInstance->getDbTimeFilled(); if ($time != "00:00:00") { - $milliseconds = substr(round(substr($time, 8), 2), 1); - $time = substr($time, 0, 8) . $milliseconds; + $time_arr = explode(".", $time); + $time_arr[1] = "." . $time_arr[1]; + $milliseconds = number_format(round($time_arr[1], 2), 2); + $time = $time_arr[0] . substr($milliseconds, 1); } else { $time = "00:00:00.00"; } diff --git a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml index 37459635b..9e48cb6ff 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml @@ -77,11 +77,11 @@
master_dj_connection_url ?> override   - - - This is the URL used by remote sources to connect to Airtime. If Airtime is behind a router or firewall, you may need to configure port forwarding. For details, please read the Airtime manual. - -
+ + + overrideDescription ?> + +
@@ -117,7 +117,12 @@
- live_dj_connection_url ?> override + live_dj_connection_url ?> override   + + + overrideDescription?> + +