diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index f5dcd6cca..c8dd8f2e9 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -257,8 +257,6 @@ class ShowbuilderController extends Zend_Controller_Action public function builderFeedAction() { - $start = microtime(true); - $request = $this->getRequest(); $current_time = time(); @@ -279,11 +277,6 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->schedule = $data["schedule"]; $this->view->instances = $data["showInstances"]; $this->view->timestamp = $current_time; - - $end = microtime(true); - - Logging::debug("getting builder feed info took:"); - Logging::debug(floatval($end) - floatval($start)); } public function scheduleAddAction() diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php index e3dc91c92..8fb007aef 100644 --- a/airtime_mvc/application/forms/SmartBlockCriteria.php +++ b/airtime_mvc/application/forms/SmartBlockCriteria.php @@ -101,7 +101,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $spType = new Zend_Form_Element_Radio('sp_type'); - $spType->setLabel('Set smart block type:') + $spType->setLabel('Set smart playlist type:') ->setDecorators(array('viewHelper')) ->setMultiOptions(array( 'static' => 'Static', diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 2666fa13e..c09eef089 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -256,59 +256,97 @@ class Application_Model_Schedule { global $CC_CONFIG; $con = Propel::getConnection(); - $templateSql = "SELECT DISTINCT - showt.name AS show_name, showt.color AS show_color, - showt.background_color AS show_background_color, showt.id AS show_id, + $templateSql = <<= '{$p_start}' AND si.starts < '{$p_end}') - OR (si.ends > '{$p_start}' AND si.ends <= '{$p_end}') - OR (si.starts <= '{$p_start}' AND si.ends >= '{$p_end}'))"; - - if (count($p_shows) > 0) { - $templateSql .= " AND show_id IN (".implode(",", $p_shows).")"; - } $filesSql = str_replace("%%columns%%", - "ft.track_title AS file_track_title, ft.artist_name AS file_artist_name, - ft.album_title AS file_album_title, ft.length AS file_length, ft.file_exists AS file_exists", + $filesColumns, $templateSql); $filesSql= str_replace("%%join%%", - "cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id) - RIGHT JOIN cc_show_instances AS si ON (si.id = sched.instance_id))", + $filesJoin, $filesSql); + $streamColumns = << 0) { + $showPredicate = " AND show_id IN (".implode(",", $p_shows).")"; + } + + $sql = <<= '{$p_start}' + AND si.starts < '{$p_end}') + OR (si.ends > '{$p_start}' + AND si.ends <= '{$p_end}') + OR (si.starts <= '{$p_start}' + AND si.ends >= '{$p_end}') +ORDER BY si_starts, + sched_starts; +SQL; $rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC); return $rows; diff --git a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js index b3f761961..ae7ea76c5 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js @@ -25,18 +25,8 @@ function setSmartPlaylistEvents() { form.find('a[id^="modifier_add"]').live('click', function(){ var id = $(this).attr('id'), row_index = id.charAt(id.length-1), - mod_index, criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val(); - //get index for the new modifier row - if ($(this).parent().find('select[name^="sp_criteria_modifier_'+row_index+'_"]').length == 0) { - mod_index = 0; - } else { - var last_mod = $(this).parent().find('select[name^="sp_criteria_modifier_'+row_index+'_"]:last'); - var last_mod_id = last_mod.attr('id'); - mod_index = parseInt(last_mod_id.substr(last_mod_id.length-1))+1; - } - //make new modifier row var newRow = $(this).parent().clone(), newRowCrit = newRow.find('select[name^="sp_criteria_field"]'), @@ -53,27 +43,21 @@ function setSmartPlaylistEvents() { //hide the critieria field select box newRowCrit.addClass('sp-invisible'); - //append modifier index to the new modifier row - newRowCrit.attr('name', 'sp_criteria_field_'+row_index+'_'+mod_index); - newRowCrit.attr('id', 'sp_criteria_field_'+row_index+'_'+mod_index); + //keep criteria value the same newRowCrit.val(criteria_value); - newRowMod.attr('name', 'sp_criteria_modifier_'+row_index+'_'+mod_index); - newRowMod.attr('id', 'sp_criteria_modifier_'+row_index+'_'+mod_index); + + //reset all other values newRowMod.val('0'); - newRowVal.attr('name', 'sp_criteria_value_'+row_index+'_'+mod_index); - newRowVal.attr('id', 'sp_criteria_value_'+row_index+'_'+mod_index); newRowVal.val(''); - newRowExtra.attr('name', 'sp_criteria_extra_'+row_index+'_'+mod_index); - newRowExtra.attr('id', 'sp_criteria_extra_'+row_index+'_'+mod_index); newRowExtra.val(''); disableAndHideExtraField(newRowVal); sizeTextBoxes(newRowVal, 'sp_extra_input_text', 'sp_input_text'); - newRowRemove.attr('id', 'criteria_remove_'+row_index+'_'+mod_index); //remove the 'criteria add' button from new modifier row newRow.find('.criteria_add').remove(); $(this).parent().after(newRow); + reindexElements(); appendAddButton(); appendModAddButton(); removeButtonCheck();