diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index e13547c88..bf44a8030 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -638,7 +638,10 @@ class ScheduleController extends Zend_Controller_Action public function updateFutureIsScheduledAction() { $schedId = $this->_getParam('schedId'); - $redrawLibTable = Application_Model_StoredFile::setIsScheduled($schedId, false); + + $scheduleService = new Application_Service_SchedulerService(); + $redrawLibTable = $scheduleService->updateFutureIsScheduled($schedId, false); + $this->_helper->json->sendJson(array("redrawLibTable" => $redrawLibTable)); } } diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 6f0a98cce..d37f77bc1 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -1325,20 +1325,14 @@ SQL; } } - public static function setIsScheduled($p_scheduleItem, $p_status, - $p_fileId=null) { + public static function setIsScheduled($fileId, $status) { - if (is_null($p_fileId)) { - $fileId = Application_Model_Schedule::GetFileId($p_scheduleItem); - } else { - $fileId = $p_fileId; - } $file = self::RecallById($fileId); $updateIsScheduled = false; if (!is_null($fileId) && !in_array($fileId, Application_Model_Schedule::getAllFutureScheduledFiles())) { - $file->_file->setDbIsScheduled($p_status)->save(); + $file->_file->setDbIsScheduled($status)->save(); $updateIsScheduled = true; } diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php index a39b26bde..c79fa9ca1 100644 --- a/airtime_mvc/application/models/Webstream.php +++ b/airtime_mvc/application/models/Webstream.php @@ -408,6 +408,23 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable return $webstream->getDbId(); } + + /* + * method is not used, webstreams aren't currently kept track of for isScheduled. + */ + public static function setIsScheduled($p_webstreamId, $p_status) { + + $webstream = CcWebstreamQuery::create()->findPK($p_webstreamId); + $updateIsScheduled = false; + + if (isset($webstream) && !in_array($p_webstreamId, + Application_Model_Schedule::getAllFutureScheduledWebstreams())) { + //$webstream->setDbIsScheduled($p_status)->save(); + $updateIsScheduled = true; + } + + return $updateIsScheduled; + } } class WebstreamNoPermissionException extends Exception {} diff --git a/airtime_mvc/application/services/SchedulerService.php b/airtime_mvc/application/services/SchedulerService.php index c1dd6fc1f..712ea6205 100644 --- a/airtime_mvc/application/services/SchedulerService.php +++ b/airtime_mvc/application/services/SchedulerService.php @@ -407,4 +407,24 @@ class Application_Service_SchedulerService return false; } } + + /* + * TODO in the future this should probably support webstreams. + */ + public function updateFutureIsScheduled($scheduleId, $status) + { + $sched = CcScheduleQuery::create()->findPk($scheduleId); + $redraw = false; + + if (isset($sched)) { + + $fileId = $sched->getDbFileId(); + + if (isset($fileId)) { + $redraw = Application_Model_StoredFile::setIsScheduled($fileId, $status); + } + } + + return $redraw; + } } \ No newline at end of file