public function cancelCurrentShowAction() { $user = Application_Model_User::getCurrentUser(); if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { $id = $this->_getParam('id'); try { $scheduler = new Application_Model_Scheduler(); $scheduler->cancelShow($id); Application_Model_StoredFile::updatePastFilesIsScheduled(); // send kick out source stream signal to pypo $data = array("sourcename" => "live_dj"); Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data); } catch (Exception $e) { $this->view->error = $e->getMessage(); Logging::info($e->getMessage()); } } }
public function deleteShow($instanceId, $singleInstance = false) { $service_user = new Application_Service_UserService(); $currentUser = $service_user->getCurrentUser(); $con = Propel::getConnection(); $con->beginTransaction(); try { if (!$currentUser->isAdminOrPM()) { throw new Exception("Permission denied"); } $ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId); if (!$ccShowInstance) { throw new Exception("Could not find show instance"); } $showId = $ccShowInstance->getDbShowId(); if ($singleInstance) { $ccShowInstances = CcShowInstancesQuery::create()->filterByDbShowId($showId)->filterByDbStarts($ccShowInstance->getDbStarts(), Criteria::GREATER_EQUAL)->filterByDbEnds($ccShowInstance->getDbEnds(), Criteria::LESS_EQUAL)->find(); } else { $ccShowInstances = CcShowInstancesQuery::create()->filterByDbShowId($showId)->filterByDbStarts($ccShowInstance->getDbStarts(), Criteria::GREATER_EQUAL)->find(); } if (gmdate("Y-m-d H:i:s") <= $ccShowInstance->getDbEnds()) { $this->deleteShowInstances($ccShowInstances, $ccShowInstance->getDbShowId()); } Application_Model_StoredFile::updatePastFilesIsScheduled(); Application_Model_RabbitMq::PushSchedule(); $con->commit(); return $showId; } catch (Exception $e) { $con->rollback(); Logging::info("Delete show instance failed"); Logging::info($e->getMessage()); return false; } }