CC-3452: Live Stream: DJs assigned to the show and Program Managers should

be able to control switches and able to kick out connection

- kickout buttons and switch buttons are now visible to everyone.
- clicking buttons without correct permission will return proper error msg.
This commit is contained in:
james 2012-03-15 14:29:31 -04:00
parent 2beadc9301
commit 4595da9087
10 changed files with 98 additions and 62 deletions

View file

@ -18,31 +18,66 @@ class DashboardController extends Zend_Controller_Action
public function disconnectSourceAction(){
$request = $this->getRequest();
$sourcename = $request->getParam('sourcename');
$data = array("sourcename"=>$sourcename);
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$show = Application_Model_Show::GetCurrentShow();
$show_id = isset($show['id'])?$show['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if($user->canSchedule($show_id) && $source_connected){
$data = array("sourcename"=>$sourcename);
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
}else{
if($source_connected){
$this->view->error = "You don't have permission to disconnect source.";
}else{
$this->view->error = "There is no source connected to this input.";
}
}
}
public function switchSourceAction(){
$request = $this->getRequest();
$sourcename = $this->_getParam('sourcename');
$current_status = $this->_getParam('status');
$change_status_to = "on";
if(strtolower($current_status) == "on"){
$change_status_to = "off";
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$show = Application_Model_Show::GetCurrentShow();
$show_id = isset($show['id'])?$show['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play')){
$change_status_to = "on";
if(strtolower($current_status) == "on"){
$change_status_to = "off";
}
$data = array("sourcename"=>$sourcename, "status"=>$change_status_to);
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
if(strtolower($current_status) == "on"){
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
$this->view->status = "OFF";
}else{
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
$this->view->status = "ON";
}
}
$data = array("sourcename"=>$sourcename, "status"=>$change_status_to);
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
if(strtolower($current_status) == "on"){
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
$this->view->status = "OFF";
}else{
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
$this->view->status = "ON";
else{
if($source_connected){
$this->view->error = "You don't have permission to switch source.";
}else{
$this->view->error = "There is no source connected to this input.";
}
}
}