From c21cbeb73bcbc13ee6c520ade7893d8dec6ac73f Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Fri, 25 Nov 2011 16:07:03 +0100 Subject: [PATCH 1/3] CC-3102 : Show Editing, how it uses day of the week --- airtime_mvc/application/models/Show.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 1f90d15c5..f7bfd060c 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -178,13 +178,27 @@ class Application_Model_Show { * Sunday are removed. * * @param array p_uncheckedDays - * An array specifying which days should be removed. + * An array specifying which days should be removed. (in the local timezone) */ public function removeUncheckedDaysInstances($p_uncheckedDays) { global $CC_DBC; - - $uncheckedDaysImploded = implode(",", $p_uncheckedDays); + + //need to convert local doftw to UTC doftw (change made for 2.0 since shows are stored in UTC) + $daysRemovedUTC = array(); + + $showDays = CcShowDaysQuery::create() + ->filterByDbShowId($this->getId()) + ->find(); + foreach($showDays as $showDay) { + if (in_array($showDay->getDbDay(), $p_uncheckedDays)) { + $startDay = new DateTime("{$showDay->getDbFirstShow()} {$showDay->getDbStartTime()}", new DateTimeZone($showDay->getDbTimezone())); + $startDay->setTimezone(new DateTimeZone("UTC")); + $daysRemovedUTC[] = $startDay->format("w"); + } + } + + $uncheckedDaysImploded = implode(",", $daysRemovedUTC); $showId = $this->getId(); $timestamp = gmdate("Y-m-d H:i:s"); @@ -194,9 +208,6 @@ class Application_Model_Show { ." AND starts > TIMESTAMP '$timestamp'" ." AND show_id = $showId"; - Logging::log("sql for removing unchecked days"); - Logging::log($sql); - $CC_DBC->query($sql); } @@ -797,6 +808,7 @@ class Application_Model_Show { $daysRemoved = array_diff($showDaysArray, $p_data['add_show_day_check']); if (count($daysRemoved) > 0){ + $this->removeUncheckedDaysInstances($daysRemoved); } } From c9644d4a73453825a03543c59a614d0d5fd3114a Mon Sep 17 00:00:00 2001 From: James Date: Fri, 25 Nov 2011 15:38:29 -0500 Subject: [PATCH 2/3] CC-3077: Preference/stream-setting page has no Vorbis metadata option - cleaning up some code --- airtime_mvc/application/controllers/PreferenceController.php | 1 - airtime_mvc/application/forms/StreamSetting.php | 2 +- airtime_mvc/application/models/StreamSetting.php | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index bf81e44af..ec846c52e 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -199,7 +199,6 @@ class PreferenceController extends Zend_Controller_Action $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); } - var_dump($form->getValue('icecast_vorbis_metadata')); if(!$error){ Application_Model_StreamSetting::setStreamSetting($values); $data = array(); diff --git a/airtime_mvc/application/forms/StreamSetting.php b/airtime_mvc/application/forms/StreamSetting.php index fc07544a5..857e4e3a8 100644 --- a/airtime_mvc/application/forms/StreamSetting.php +++ b/airtime_mvc/application/forms/StreamSetting.php @@ -28,7 +28,7 @@ class Application_Form_StreamSetting extends Zend_Form } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); - $icecast_vorbis_metadata->setLabel('Icecast Vorbis Meatadata') + $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata') ->setRequired(false) ->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0) ->setDecorators(array('ViewHelper')); diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index 577bab05c..a3c416ed4 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -66,7 +66,6 @@ class Application_Model_StreamSetting { $CC_DBC->query($sql); } else{ - var_dump($key); $temp = explode('_', $key); $prefix = $temp[0]; foreach($d as $k=>$v){ From 267d48f640cdcf9607a0aa4b5d0c4742bf8ac829 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 25 Nov 2011 17:33:59 -0500 Subject: [PATCH 3/3] SAAS-82: Add "airtime-system --status" command - add a function that returns just global data of stream setting --- .../application/models/StreamSetting.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index a3c416ed4..d14843d8b 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -21,7 +21,23 @@ class Application_Model_StreamSetting { return $ids; } - + + /* Retruns only global data as array*/ + public static function getGlobalData(){ + global $CC_DBC; + $sql = "SELECT * " + ."FROM cc_stream_setting " + ."WHERE keyname IN ('output_sound_device', 'icecast_vorbis_metadata')"; + + $rows = $CC_DBC->getAll($sql); + $data = array(); + + foreach($rows as $row){ + $data[$row["keyname"]] = $row["value"]; + } + + return $data; + } /* Returns all information related to a specific stream. An example * of a stream id is 's1' or 's2'. */ public static function getStreamData($p_streamId){