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
|
@ -58,6 +58,7 @@
|
|||
<actionMethod actionName="deleteShow"/>
|
||||
<actionMethod actionName="makeContextMenu"/>
|
||||
<actionMethod actionName="scheduleShow"/>
|
||||
<actionMethod actionName="clearShow"/>
|
||||
</controllerFile>
|
||||
<controllerFile controllerName="Api">
|
||||
<actionMethod actionName="index"/>
|
||||
|
@ -194,6 +195,9 @@
|
|||
<viewControllerScriptsDirectory forControllerName="Schedule">
|
||||
<viewScriptFile forActionName="scheduleShow"/>
|
||||
</viewControllerScriptsDirectory>
|
||||
<viewControllerScriptsDirectory forControllerName="Schedule">
|
||||
<viewScriptFile forActionName="clearShow"/>
|
||||
</viewControllerScriptsDirectory>
|
||||
</viewScriptsDirectory>
|
||||
<viewHelpersDirectory/>
|
||||
<viewFiltersDirectory enabled="false"/>
|
||||
|
|
|
@ -18,6 +18,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
->addActionContext('resize-show', 'json')
|
||||
->addActionContext('delete-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;
|
||||
}
|
||||
|
@ -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.
|
||||
|
|
|
@ -89,29 +89,37 @@ function closeDialog(event, ui) {
|
|||
}
|
||||
|
||||
function schedulePlaylist() {
|
||||
var li, pl_id, url, start, dialog;
|
||||
var li, pl_id, url, event, start, dialog;
|
||||
|
||||
dialog = $(this);
|
||||
li = $("#schedule_playlist_dialog").find(".ui-state-active");
|
||||
|
||||
if(li.length === 0) {
|
||||
dialog.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
pl_id = li.data('pl_id');
|
||||
start = li.data('start');
|
||||
event = li.parent().data('event');
|
||||
start = event.start;
|
||||
|
||||
var sy, sm, sd, h, m, s;
|
||||
sy = start.getFullYear();
|
||||
sm = start.getMonth() + 1;
|
||||
sd = start.getDate();
|
||||
h = start.getHours();
|
||||
m = start.getMinutes();
|
||||
s = start.getSeconds();
|
||||
sy = start.getFullYear();
|
||||
sm = start.getMonth() + 1;
|
||||
sd = start.getDate();
|
||||
h = start.getHours();
|
||||
m = start.getMinutes();
|
||||
s = start.getSeconds();
|
||||
|
||||
start_date = sy+"-"+ sm +"-"+ sd +" "+ h +":"+ m +":"+ s;
|
||||
start_date = sy+"-"+ sm +"-"+ sd +" "+ h +":"+ m +":"+ s;
|
||||
|
||||
url = '/Schedule/schedule-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{plId: pl_id, start: start_date},
|
||||
{plId: pl_id, start: start_date, showId: event.id},
|
||||
function(json){
|
||||
dialog.remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -154,7 +162,7 @@ function makeScheduleDialog(playlists, event) {
|
|||
ol = $('<ul/>');
|
||||
$.each(playlists, function(i, val){
|
||||
li = $('<li />')
|
||||
.addClass('ui-widget-content ui-selectee')
|
||||
.addClass('ui-widget-content')
|
||||
.append('<div>'+val.name+'</div>')
|
||||
.append('<div>'+val.description+'</div>')
|
||||
.click(function(){
|
||||
|
@ -162,10 +170,11 @@ function makeScheduleDialog(playlists, event) {
|
|||
$(this).addClass("ui-state-active");
|
||||
});
|
||||
|
||||
li.data({'pl_id': val.id, 'start': event.start});
|
||||
li.data({'pl_id': val.id});
|
||||
ol.append(li);
|
||||
});
|
||||
|
||||
ol.data({'event': event});
|
||||
dialog.append(ol);
|
||||
|
||||
dialog.dialog({
|
||||
|
@ -180,6 +189,30 @@ function makeScheduleDialog(playlists, event) {
|
|||
return dialog;
|
||||
}
|
||||
|
||||
function openShowDialog() {
|
||||
var url;
|
||||
|
||||
url = '/Schedule/add-show-dialog/format/json';
|
||||
|
||||
$.get(url, function(json){
|
||||
var dialog = makeShowDialog(json.form);
|
||||
dialog.dialog('open');
|
||||
});
|
||||
}
|
||||
|
||||
function openScheduleDialog(event, time) {
|
||||
var url;
|
||||
|
||||
url = '/Schedule/schedule-show/format/json';
|
||||
|
||||
$.get(url,
|
||||
{length: time},
|
||||
function(json){
|
||||
var dialog = makeScheduleDialog(json.playlists, event);
|
||||
dialog.dialog('open');
|
||||
});
|
||||
}
|
||||
|
||||
function eventMenu(action, el, pos) {
|
||||
var method = action.split('/').pop(),
|
||||
event;
|
||||
|
@ -206,6 +239,27 @@ function eventMenu(action, el, pos) {
|
|||
|
||||
openScheduleDialog(event, time);
|
||||
}
|
||||
else if (method === 'clear-show') {
|
||||
start = event.start;
|
||||
|
||||
var sy, sm, sd, h, m, s, start_date;
|
||||
sy = start.getFullYear();
|
||||
sm = start.getMonth() + 1;
|
||||
sd = start.getDate();
|
||||
h = start.getHours();
|
||||
m = start.getMinutes();
|
||||
s = start.getSeconds();
|
||||
|
||||
start_date = sy+"-"+ sm +"-"+ sd +" "+ h +":"+ m +":"+ s;
|
||||
|
||||
url = '/Schedule/clear-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{start: start_date, showId: event.id},
|
||||
function(json){
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -284,30 +338,6 @@ function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, vie
|
|||
});
|
||||
}
|
||||
|
||||
function openShowDialog() {
|
||||
var url;
|
||||
|
||||
url = '/Schedule/add-show-dialog/format/json';
|
||||
|
||||
$.get(url, function(json){
|
||||
var dialog = makeShowDialog(json.form);
|
||||
dialog.dialog('open');
|
||||
});
|
||||
}
|
||||
|
||||
function openScheduleDialog(event, time) {
|
||||
var url;
|
||||
|
||||
url = '/Schedule/schedule-show/format/json';
|
||||
|
||||
$.get(url,
|
||||
{showId: event.id, length: time},
|
||||
function(json){
|
||||
var dialog = makeScheduleDialog(json.playlists, event);
|
||||
dialog.dialog('open');
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#schedule_calendar').fullCalendar({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue