CC-4961: Show linking
Removed unused schedule controller actions Fix bug where changing a show to repeat deletes the original show's content
This commit is contained in:
parent
4bdd89f747
commit
bae9f1202a
|
@ -6,6 +6,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
protected $sched_sess = null;
|
protected $sched_sess = null;
|
||||||
|
|
||||||
private $service_calendar;
|
private $service_calendar;
|
||||||
|
private $currentUser;
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
@ -42,6 +43,9 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->sched_sess = new Zend_Session_Namespace("schedule");
|
$this->sched_sess = new Zend_Session_Namespace("schedule");
|
||||||
|
|
||||||
$this->service_calendar = new Application_Service_CalendarService();
|
$this->service_calendar = new Application_Service_CalendarService();
|
||||||
|
|
||||||
|
$service_user = new Application_Service_UserService();
|
||||||
|
$this->currentUser = $service_user->getCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
|
@ -121,11 +125,9 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$end = new DateTime($this->_getParam('end', null));
|
$end = new DateTime($this->_getParam('end', null));
|
||||||
$end->setTimezone(new DateTimeZone("UTC"));
|
$end->setTimezone(new DateTimeZone("UTC"));
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$events = &Application_Model_Show::getFullCalendarEvents($start, $end,
|
||||||
$user = new Application_Model_User($userInfo->id);
|
$this->currentUser->isAdminOrPM());
|
||||||
$editable = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
|
||||||
|
|
||||||
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
|
||||||
$this->view->events = $events;
|
$this->view->events = $events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,32 +423,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->show_name = isset($show[0])?$show[0]["name"]:"";
|
$this->view->show_name = isset($show[0])?$show[0]["name"]:"";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeGroupAction()
|
|
||||||
{
|
|
||||||
$showInstanceId = $this->sched_sess->showInstanceId;
|
|
||||||
$group_id = $this->_getParam('groupId');
|
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
|
||||||
$user = new Application_Model_User($userInfo->id);
|
|
||||||
try {
|
|
||||||
$show = new Application_Model_ShowInstance($showInstanceId);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->view->show_error = true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)) || $user->isHostOfShow($show->getShowId())) {
|
|
||||||
$show->removeGroupFromShow($group_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->view->showContent = $show->getShowContent();
|
|
||||||
$this->view->timeFilled = $show->getTimeScheduled();
|
|
||||||
$this->view->percentFilled = $show->getPercentScheduled();
|
|
||||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
|
||||||
unset($this->view->showContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function showContentDialogAction()
|
public function showContentDialogAction()
|
||||||
{
|
{
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
@ -730,9 +706,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function getFormAction()
|
public function getFormAction()
|
||||||
{
|
{
|
||||||
$user = Application_Model_User::getCurrentUser();
|
if ($this->currentUser->isAdminOrPM()) {
|
||||||
|
|
||||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
|
||||||
$this->createShowFormAction(true);
|
$this->createShowFormAction(true);
|
||||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||||
}
|
}
|
||||||
|
@ -933,29 +907,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function contentContextMenuAction()
|
|
||||||
{
|
|
||||||
$id = $this->_getParam('id');
|
|
||||||
|
|
||||||
$params = '/format/json/id/#id#/';
|
|
||||||
|
|
||||||
$paramsPop = str_replace('#id#', $id, $params);
|
|
||||||
|
|
||||||
// added for downlaod
|
|
||||||
$id = $this->_getParam('id');
|
|
||||||
|
|
||||||
$file_id = $this->_getParam('id', null);
|
|
||||||
$file = Application_Model_StoredFile::Recall($file_id);
|
|
||||||
|
|
||||||
$baseUrl = $this->getRequest()->getBaseUrl();
|
|
||||||
$url = $file->getRelativeFileUrl($baseUrl).'download/true';
|
|
||||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
|
||||||
'title' => _('Download'));
|
|
||||||
|
|
||||||
//returns format jjmenu is looking for.
|
|
||||||
$this->_helper->json->sendJson($menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the user specific preference for which time scale to use in Calendar.
|
* Sets the user specific preference for which time scale to use in Calendar.
|
||||||
* This is only being used by schedule.js at the moment.
|
* This is only being used by schedule.js at the moment.
|
||||||
|
|
|
@ -372,11 +372,6 @@ SQL;
|
||||||
$this->deleteAllRepeatInstances($currentShowDay, $showId);
|
$this->deleteAllRepeatInstances($currentShowDay, $showId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//duration has changed
|
|
||||||
/*if ($showData['add_show_duration'] != $currentShowDay->getDbDuration()) {
|
|
||||||
$this->updateInstanceDuration($showData);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if ($showData['add_show_repeats']) {
|
if ($showData['add_show_repeats']) {
|
||||||
|
|
||||||
$localShowStart = $currentShowDay->getLocalStartDateAndTime();
|
$localShowStart = $currentShowDay->getLocalStartDateAndTime();
|
||||||
|
@ -395,7 +390,10 @@ SQL;
|
||||||
$this->deleteAllInstances($showId);
|
$this->deleteAllInstances($showId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($repeatType != $currentShowDay->getDbRepeatType()) {
|
$currentRepeatType = $currentShowDay->getDbRepeatType();
|
||||||
|
//only delete instances if the show being edited was already repeating
|
||||||
|
//and the repeat type changed
|
||||||
|
if ($currentRepeatType != -1 && $repeatType != $currentRepeatType) {
|
||||||
//repeat type changed
|
//repeat type changed
|
||||||
$this->deleteAllInstances($showId);
|
$this->deleteAllInstances($showId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -513,12 +511,12 @@ DELETE
|
||||||
FROM cc_show_instances
|
FROM cc_show_instances
|
||||||
WHERE starts > :timestamp::TIMESTAMP
|
WHERE starts > :timestamp::TIMESTAMP
|
||||||
AND show_id = :showId
|
AND show_id = :showId
|
||||||
AND date(starts) != :firstShow
|
AND starts != :firstShow
|
||||||
SQL;
|
SQL;
|
||||||
Application_Common_Database::prepareAndExecute( $sql,
|
Application_Common_Database::prepareAndExecute( $sql,
|
||||||
array( ':timestamp' => gmdate("Y-m-d H:i:s"),
|
array( ':timestamp' => gmdate("Y-m-d H:i:s"),
|
||||||
':showId' => $showId,
|
':showId' => $showId,
|
||||||
':firstShow' => $firstShow->format("Y-m-d")), 'execute');
|
':firstShow' => $firstShow->format("Y-m-d H:i:s")), 'execute');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteAllInstances($showId)
|
public function deleteAllInstances($showId)
|
||||||
|
|
Loading…
Reference in New Issue