diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php
index 1d3376350..bf81e44af 100644
--- a/airtime_mvc/application/controllers/PreferenceController.php
+++ b/airtime_mvc/application/controllers/PreferenceController.php
@@ -165,10 +165,10 @@ class PreferenceController extends Zend_Controller_Action
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
$form = new Application_Form_StreamSetting();
- if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
- $form->setSetting($setting);
- $form->startFrom();
- }
+
+ $form->setSetting($setting);
+ $form->startFrom();
+
for($i=1; $i<=$num_of_stream; $i++){
$subform = new Application_Form_StreamSettingSubForm();
$subform->setPrefix($i);
@@ -192,9 +192,14 @@ class PreferenceController extends Zend_Controller_Action
}
}
}
- if(Application_Model_Preference::GetPlanLevel() == 'disabled' && $form->isValid($post_data['output_sound_device'])){
- $values['output_sound_device'] = $form->getValue('output_sound_device');
+ if($form->isValid($post_data)){
+ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){// && $form->isValid($post_data['output_sound_device'])){
+ $values['output_sound_device'] = $form->getValue('output_sound_device');
+ }
+
+ $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/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index 8ed12e0ed..cd31e75bb 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -435,7 +435,7 @@ class ScheduleController extends Zend_Controller_Action
//convert from UTC to user's timezone for display.
$originalDateTime = new DateTime($originalShowStart, new DateTimeZone("UTC"));
- $originalDateTime->setTimezone(new DateTimeZone(date_default_timezone_get));
+ $originalDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
//$timestamp = Application_Model_DateHelper::ConvertToLocalDateTimeString($originalDateTime->format("Y-m-d H:i:s"));
$this->view->additionalShowInfo =
"Rebroadcast of show \"$originalShowName\" from "
@@ -493,7 +493,7 @@ class ScheduleController extends Zend_Controller_Action
$startsDateTime = new DateTime($show->getStartDate()." ".$show->getStartTime(), new DateTimeZone("UTC"));
$endsDateTime = new DateTime($show->getEndDate()." ".$show->getEndTime(), new DateTimeZone("UTC"));
-
+
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
@@ -508,13 +508,16 @@ class ScheduleController extends Zend_Controller_Action
$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).
$days = array();
$showDays = CcShowDaysQuery::create()->filterByDbShowId($showInstance->getShowId())->find();
foreach($showDays as $showDay){
- array_push($days, $showDay->getDbDay());
+ $showStartDay = new DateTime($showDay->getDbFirstShow(), new DateTimeZone($showDay->getDbTimezone()));
+ $showStartDay->setTimezone(new DateTimeZone(date_default_timezone_get()));
+ array_push($days, $showStartDay->format('w'));
}
- $displayedEndDate = new DateTime($show->getRepeatingEndDate(), new DateTimeZone("UTC"));
+ $displayedEndDate = new DateTime($show->getRepeatingEndDate(), new DateTimeZone($showDays[0]->getDbTimezone()));
$displayedEndDate->sub(new DateInterval("P1D"));//end dates are stored non-inclusively.
$displayedEndDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
@@ -742,7 +745,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
$this->view->addNewShow = true;
-
+
//the form still needs to be "update" since
//the validity test failed.
if ($data['add_show_id'] != -1){
@@ -751,9 +754,9 @@ class ScheduleController extends Zend_Controller_Action
if (!$startDateModified){
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
}
-
+
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
-
+
}
}else{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
diff --git a/airtime_mvc/application/forms/StreamSetting.php b/airtime_mvc/application/forms/StreamSetting.php
index cb7735cb5..fc07544a5 100644
--- a/airtime_mvc/application/forms/StreamSetting.php
+++ b/airtime_mvc/application/forms/StreamSetting.php
@@ -15,19 +15,31 @@ class Application_Form_StreamSetting extends Zend_Form
public function startFrom() {
$setting = $this->setting;
- $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
- $output_sound_device->setLabel('Enabled')
- ->setRequired(false)
- ->setValue(($setting['output_sound_device'] == "true")?1:0)
- ->setDecorators(array('ViewHelper'));
- if (Application_Model_Preference::GetEnableStreamConf() == "false"){
- $output_sound_device->setAttrib("readonly", true);
+ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
+ $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
+ $output_sound_device->setLabel('Hardware Audio Ouput')
+ ->setRequired(false)
+ ->setValue(($setting['output_sound_device'] == "true")?1:0)
+ ->setDecorators(array('ViewHelper'));
+ if (Application_Model_Preference::GetEnableStreamConf() == "false"){
+ $output_sound_device->setAttrib("readonly", true);
+ }
+ $this->addElement($output_sound_device);
}
- $this->addElement($output_sound_device);
+
+ $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
+ $icecast_vorbis_metadata->setLabel('Icecast Vorbis Meatadata')
+ ->setRequired(false)
+ ->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
+ ->setDecorators(array('ViewHelper'));
+ if (Application_Model_Preference::GetEnableStreamConf() == "false"){
+ $icecast_vorbis_metadata->setAttrib("readonly", true);
+ }
+ $this->addElement($icecast_vorbis_metadata);
}
public function isValid($data){
- $this->populate(array("output_sound_device"=>$data));
+ $this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata']));
return true;
}
}
diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php
index f44855d46..1f90d15c5 100644
--- a/airtime_mvc/application/models/Show.php
+++ b/airtime_mvc/application/models/Show.php
@@ -187,14 +187,16 @@ class Application_Model_Show {
$uncheckedDaysImploded = implode(",", $p_uncheckedDays);
$showId = $this->getId();
- $date = new Application_Model_DateHelper;
- $timestamp = $date->getTimestamp();
+ $timestamp = gmdate("Y-m-d H:i:s");
$sql = "DELETE FROM cc_show_instances"
." WHERE EXTRACT(DOW FROM starts) IN ($uncheckedDaysImploded)"
." AND starts > TIMESTAMP '$timestamp'"
." AND show_id = $showId";
+ Logging::log("sql for removing unchecked days");
+ Logging::log($sql);
+
$CC_DBC->query($sql);
}
@@ -856,7 +858,8 @@ class Application_Model_Show {
//What we are doing here is checking if the show repeats or if
//any repeating days have been checked. If not, then by default
//the "selected" DOW is the initial day.
- $startDow = gmdate("w", $utcStartDateTime->getTimestamp());
+ //DOW in local time.
+ $startDow = date("w", $startDateTime->getTimestamp());
if (!$data['add_show_repeats']) {
$data['add_show_day_check'] = array($startDow);
} else if ($data['add_show_repeats'] && $data['add_show_day_check'] == "") {
@@ -907,7 +910,10 @@ class Application_Model_Show {
$showDay->setDbRecord($isRecorded);
$showDay->save();
} else {
+ Logging::log("startDow is: {$startDow}");
foreach ($data['add_show_day_check'] as $day) {
+ Logging::log("day is: {$day}");
+
$daysAdd=0;
$startDateTimeClone = clone $startDateTime;
if ($startDow !== $day){
@@ -916,7 +922,10 @@ class Application_Model_Show {
else
$daysAdd = $day - $startDow;
+ Logging::log("days to add: {$daysAdd}");
+
$startDateTimeClone->add(new DateInterval("P".$daysAdd."D"));
+ Logging::log("start date: {$startDateTimeClone->format("Y-m-d")}");
}
if (is_null($endDate) || $startDateTimeClone->getTimestamp() <= $endDateTime->getTimestamp()) {
$showDay = new CcShowDays();
diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php
index 4486178ae..577bab05c 100644
--- a/airtime_mvc/application/models/StreamSetting.php
+++ b/airtime_mvc/application/models/StreamSetting.php
@@ -60,12 +60,13 @@ class Application_Model_StreamSetting {
public static function setStreamSetting($data){
global $CC_DBC;
foreach($data as $key=>$d){
- if($key == "output_sound_device"){
+ if($key == "output_sound_device" || $key == "icecast_vorbis_metadata"){
$v = $d == 1?"true":"false";
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
$CC_DBC->query($sql);
}
else{
+ var_dump($key);
$temp = explode('_', $key);
$prefix = $temp[0];
foreach($d as $k=>$v){
diff --git a/airtime_mvc/application/views/scripts/preference/stream-setting.phtml b/airtime_mvc/application/views/scripts/preference/stream-setting.phtml
index d250be0cd..e2e49af59 100644
--- a/airtime_mvc/application/views/scripts/preference/stream-setting.phtml
+++ b/airtime_mvc/application/views/scripts/preference/stream-setting.phtml
@@ -8,21 +8,29 @@
statusMsg;?>
-form->getElement('output_sound_device') != null){?>
-