clear a show, schedule a playlist during a show.
This commit is contained in:
parent
bef06bd0ff
commit
ce6a3f0278
4 changed files with 119 additions and 44 deletions
|
@ -17,7 +17,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
->addActionContext('move-show', 'json')
|
||||
->addActionContext('resize-show', 'json')
|
||||
->addActionContext('delete-show', 'json')
|
||||
->addActionContext('schedule-show', 'json')
|
||||
->addActionContext('schedule-show', 'json')
|
||||
->addActionContext('clear-show', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -41,6 +42,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
||||
$eventHostMenu[] = array('action' => '/Schedule/schedule-show', 'text' => 'Schedule');
|
||||
$eventHostMenu[] = array('action' => '/Schedule/clear-show', 'text' => 'Clear');
|
||||
|
||||
$this->view->eventHostMenu = $eventHostMenu;
|
||||
}
|
||||
|
@ -121,7 +123,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function deleteShowAction()
|
||||
{
|
||||
$showId = $this->_getParam('showId');
|
||||
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
@ -135,23 +137,44 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function scheduleShowAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
if($request->isPost()) {
|
||||
$plId = $this->_getParam('plId');
|
||||
$start = $this->_getParam('start');
|
||||
$showId = $this->_getParam('showId');
|
||||
|
||||
$sched = new ScheduleGroup();
|
||||
$this->view->res = $sched->add($start, null, $plId);
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
|
||||
if($user->isHost($showId)) {
|
||||
|
||||
$sched = new ScheduleGroup();
|
||||
$this->view->res = $sched->add($start, null, $plId);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$showId = $this->_getParam('showId');
|
||||
$length = $this->_getParam('length');
|
||||
|
||||
$this->view->playlists = Playlist::findPlaylistMaxLength($length);
|
||||
}
|
||||
}
|
||||
|
||||
public function clearShowAction()
|
||||
{
|
||||
$start = $this->_getParam('start');
|
||||
$showId = $this->_getParam('showId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
|
||||
if($user->isHost($showId)) {
|
||||
|
||||
$sched = new ScheduleGroup();
|
||||
$this->view->res = $sched->removeAtTime($start);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -171,3 +194,5 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -174,6 +174,22 @@ class ScheduleGroup {
|
|||
|
||||
}
|
||||
|
||||
public function removeAtTime($p_datetime) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$id = $this->dateToId($p_datetime);
|
||||
|
||||
$sql = "SELECT group_id FROM ".$CC_CONFIG["scheduleTable"]." WHERE id = ".$id;
|
||||
$groupId = $CC_DBC->GetOne($sql);
|
||||
|
||||
if($groupId === NULL)
|
||||
return;
|
||||
|
||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE group_id = ".$groupId;
|
||||
$CC_DBC->query($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the group from the schedule.
|
||||
* Note: does not check if it is in the past, you can remove anything.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue