CC-3444: Ability to edit currently playing show (end time and permissions)
- done
This commit is contained in:
parent
5242ac45a9
commit
286c240012
|
@ -87,8 +87,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new Application_Model_User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
$this->view->isAdmin = $user->isAdmin();
|
|
||||||
$this->view->isProgramManager = $user->isUserType('P');
|
|
||||||
|
|
||||||
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
|
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
|
||||||
}
|
}
|
||||||
|
@ -215,13 +213,16 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->show_error = true;
|
$this->view->show_error = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
$isDJ = $user->isHost($instance->getShowId());
|
||||||
|
|
||||||
$showStartLocalDT = Application_Model_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart());
|
$showStartLocalDT = Application_Model_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart());
|
||||||
$showEndLocalDT = Application_Model_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd());
|
$showEndLocalDT = Application_Model_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd());
|
||||||
|
|
||||||
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
||||||
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST), $instance->getShowId())
|
if ( ($isAdminOrPM || $isDJ)
|
||||||
&& !$instance->isRecorded()
|
&& !$instance->isRecorded()
|
||||||
&& !$instance->isRebroadcast()) {
|
&& !$instance->isRebroadcast()) {
|
||||||
|
|
||||||
|
@ -249,24 +250,27 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
if ($showStartLocalDT->getTimestamp() <= $epochNow &&
|
if ($showStartLocalDT->getTimestamp() <= $epochNow &&
|
||||||
$epochNow < $showEndLocalDT->getTimestamp() &&
|
$epochNow < $showEndLocalDT->getTimestamp() &&
|
||||||
$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
($isAdminOrPM || $isDJ)) {
|
||||||
|
|
||||||
if ($instance->isRecorded()) {
|
if ($instance->isRecorded()) {
|
||||||
|
if($isAdminOrPM){
|
||||||
$menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
$menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
|
||||||
$menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
if($isAdminOrPM){
|
||||||
|
$menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
||||||
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
if ($isAdminOrPM || $isDJ) {
|
||||||
|
|
||||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
|
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
|
||||||
|
|
||||||
if ($instance->getShow()->isRepeating()) {
|
if ($instance->getShow()->isRepeating() && $isAdminOrPM) {
|
||||||
|
|
||||||
//create delete sub menu.
|
//create delete sub menu.
|
||||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "items" => array());
|
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "items" => array());
|
||||||
|
@ -275,7 +279,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$menu["del"]["items"]["following"] = array("name"=> "Delete This Instance and All Following", "icon" => "delete", "url" => "/schedule/cancel-show");
|
$menu["del"]["items"]["following"] = array("name"=> "Delete This Instance and All Following", "icon" => "delete", "url" => "/schedule/cancel-show");
|
||||||
}
|
}
|
||||||
else {
|
else if($isAdminOrPM){
|
||||||
//window["scheduleRefetchEvents"]'
|
//window["scheduleRefetchEvents"]'
|
||||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show");
|
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show");
|
||||||
}
|
}
|
||||||
|
@ -413,19 +417,24 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new Application_Model_User($userInfo->id);
|
$user = new Application_Model_User($userInfo->id);
|
||||||
if(!$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
$this->view->show_error = true;
|
$this->view->show_error = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
$isDJ = $user->isHost($showInstance->getShowId());
|
||||||
|
|
||||||
|
if(!($isAdminOrPM || $isDJ)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
|
@ -541,6 +550,19 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
||||||
|
if(!$isAdminOrPM){
|
||||||
|
$formRecord->disable();
|
||||||
|
$formAbsoluteRebroadcast->disable();
|
||||||
|
$formRebroadcast->disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$isAdminOrPM){
|
||||||
|
$formWhat->disable();
|
||||||
|
$formWho->disable();
|
||||||
|
$formWhen->disable();
|
||||||
|
$formRepeats->disable();
|
||||||
|
$formStyle->disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
|
@ -563,6 +585,12 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$show = new Application_Model_Show($data['add_show_id']);
|
$show = new Application_Model_Show($data['add_show_id']);
|
||||||
|
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
$isDJ = $user->isHost($show->getId());
|
||||||
|
|
||||||
$startDateModified = true;
|
$startDateModified = true;
|
||||||
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
|
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
|
||||||
|
@ -695,9 +723,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
if ($what && $when && $repeats && $who && $style && $live) {
|
if ($what && $when && $repeats && $who && $style && $live) {
|
||||||
if(!$isSaas){
|
if(!$isSaas){
|
||||||
if($record && $rebroadAb && $rebroad){
|
if($record && $rebroadAb && $rebroad){
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
if ($isAdminOrPM || $isDJ) {
|
||||||
$user = new Application_Model_User($userInfo->id);
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
|
||||||
Application_Model_Show::create($data);
|
Application_Model_Show::create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,9 +756,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
if ($isAdminOrPM || $isDJ) {
|
||||||
$user = new Application_Model_User($userInfo->id);
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
|
||||||
Application_Model_Show::create($data);
|
Application_Model_Show::create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,18 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
||||||
$this->addElement($text);
|
$this->addElement($text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disable(){
|
||||||
|
$elements = $this->getElements();
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
{
|
||||||
|
$element->setAttrib('readonly',true);
|
||||||
|
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData) {
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,17 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disable(){
|
||||||
|
$elements = $this->getElements();
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
{
|
||||||
|
$element->setAttrib('readonly',true);
|
||||||
|
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,18 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||||
$this->addElement($text);
|
$this->addElement($text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disable(){
|
||||||
|
$elements = $this->getElements();
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
{
|
||||||
|
$element->setAttrib('readonly',true);
|
||||||
|
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData) {
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,18 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
||||||
'checked' => true,
|
'checked' => true,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disable(){
|
||||||
|
$elements = $this->getElements();
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
{
|
||||||
|
$element->setAttrib('readonly',true);
|
||||||
|
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData) {
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,17 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disable(){
|
||||||
|
$elements = $this->getElements();
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
{
|
||||||
|
$element->setAttrib('readonly',true);
|
||||||
|
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,5 +59,17 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
))));
|
))));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disable(){
|
||||||
|
$elements = $this->getElements();
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
{
|
||||||
|
$element->setAttrib('readonly',true);
|
||||||
|
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,5 +112,17 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disable(){
|
||||||
|
$elements = $this->getElements();
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
{
|
||||||
|
$element->setAttrib('readonly',true);
|
||||||
|
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,16 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
$this->addElement($hosts);
|
$this->addElement($hosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function disable(){
|
||||||
|
$elements = $this->getElements();
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||||
|
{
|
||||||
|
$element->setAttrib('readonly',true);
|
||||||
|
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php if($this->isAdmin || $this->isProgramManager) : ?>
|
<form id="add-show-form" method="post" action="" style="display:none;">
|
||||||
<form id="add-show-form" method="post" action="" style="display:none;">
|
<?php echo $this->render('schedule/add-show-form.phtml') ?>
|
||||||
<?php echo $this->render('schedule/add-show-form.phtml') ?>
|
</form>
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div id='schedule_calendar' class="ui-widget-content block-shadow padded omega-block"></div>
|
<div id='schedule_calendar' class="ui-widget-content block-shadow padded omega-block"></div>
|
||||||
|
|
Loading…
Reference in New Issue