From c0d379e3069bb44e946513048126b6f36b0e8409 Mon Sep 17 00:00:00 2001 From: naomiaro Date: Sun, 6 Feb 2011 23:58:58 -0500 Subject: [PATCH] cannot schedule anything in a show that overlaps. --- application/controllers/ScheduleController.php | 6 ++++++ public/js/airtime/schedule/schedule.js | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index e5873acc2..37f5ac8a6 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -295,6 +295,12 @@ class ScheduleController extends Zend_Controller_Action $show = new ShowInstance($showInstanceId); $start_timestamp = $show->getShowStart(); $end_timestamp = $show->getShowEnd(); + + //check to make sure show doesn't overlap. + if(Show::getShows($start_timestamp, $end_timestamp, array($showInstanceId))) { + $this->view->error = "cannot schedule an overlapping show."; + return; + } $start = explode(" ", $start_timestamp); $end = explode(" ", $end_timestamp); diff --git a/public/js/airtime/schedule/schedule.js b/public/js/airtime/schedule/schedule.js index 17054f412..40b9865a9 100644 --- a/public/js/airtime/schedule/schedule.js +++ b/public/js/airtime/schedule/schedule.js @@ -165,8 +165,14 @@ function buildContentDialog(json){ } function buildScheduleDialog(json){ - var dialog = $(json.dialog); + var dialog; + if(json.error) { + alert(json.error); + return; + } + + dialog = $(json.dialog); makeScheduleDialog(dialog, json); dialog.dialog({