diff --git a/.zfproject.xml b/.zfproject.xml index c9da28565..9767ec927 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -71,6 +71,7 @@ + @@ -335,6 +336,9 @@ + + + diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index e589f7fe9..b0924ebb6 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -153,6 +153,15 @@ class ScheduleController extends Zend_Controller_Action } $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/show-content-dialog'.$params, 'callback' => 'window["buildContentDialog"]'), 'title' => 'Show Content'); + + if (strtotime($show->getShowStart()) <= strtotime($today_timestamp) && + strtotime($today_timestamp) < strtotime($show->getShowEnd())) { + $menu[] = array('action' => array('type' => 'fn', + //'url' => '/Schedule/cancel-current-show'.$params, + 'callback' => "window['confirmCancelShow']($id)"), + 'title' => 'Cancel Current Show'); + } + if (strtotime($today_timestamp) < strtotime($show->getShowStart())) { if ($user->isAdmin()) { $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance'); @@ -392,6 +401,19 @@ class ScheduleController extends Zend_Controller_Action $show->cancelShow($showInstance->getShowStart()); } } + + public function cancelCurrentShowAction() + { + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + $user = new User($userInfo->id); + + if($user->isAdmin()) { + $showInstanceId = $this->_getParam('id'); + $show = new ShowInstance($showInstanceId); + $show->clearShow(); + $show->deleteShow(); + } + } } diff --git a/application/views/scripts/schedule/cancel-current-show.phtml b/application/views/scripts/schedule/cancel-current-show.phtml new file mode 100644 index 000000000..837c66731 --- /dev/null +++ b/application/views/scripts/schedule/cancel-current-show.phtml @@ -0,0 +1 @@ +

View script for controller Schedule and script/action name cancelCurrentShow
\ No newline at end of file diff --git a/public/js/airtime/schedule/schedule.js b/public/js/airtime/schedule/schedule.js index 48b256a10..79c364e4c 100644 --- a/public/js/airtime/schedule/schedule.js +++ b/public/js/airtime/schedule/schedule.js @@ -155,6 +155,16 @@ function makeScheduleDialog(dialog, json) { setScheduleDialogEvents(dialog); } +function confirmCancelShow(show_instance_id){ + if(confirm('Erase current show and stop playback?')){ + var url = "/Schedule/cancel-current-show/id/"+show_instance_id; + $.ajax({ + url: url, + success: function(data){scheduleRefetchEvents();} + }); + } +} + function buildContentDialog(json){ var dialog = $(json.dialog);