schedule show finds playlists available and returns show content better
This commit is contained in:
parent
ad869e0f7f
commit
0ffa232b6d
3 changed files with 31 additions and 37 deletions
|
@ -142,34 +142,32 @@ class ScheduleController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
if($request->isPost()) {
|
||||
|
||||
$plId = $this->_getParam('plId');
|
||||
$start = $this->_getParam('start');
|
||||
$end = $this->_getParam('end');
|
||||
$showId = $this->_getParam('showId');
|
||||
$day = $this->_getParam('day');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$show = new Show($user, $showId);
|
||||
|
||||
if($request->isPost()) {
|
||||
|
||||
$plId = $this->_getParam('plId');
|
||||
|
||||
$show->scheduleShow($start, array($plId));
|
||||
|
||||
$this->view->showContent = $show->getShowContent($start);
|
||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||
|
||||
unset($this->view->showContent);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
$length = $this->_getParam('length');
|
||||
$this->view->playlists = $show->searchPlaylistsForShow($day);
|
||||
$this->view->showContent = $show->getShowContent($start);
|
||||
|
||||
$this->view->playlists = Playlist::searchPlaylists($length);
|
||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||
$this->view->dialog = $this->view->render('schedule/schedule-show.phtml');
|
||||
|
||||
unset($this->view->showContent);
|
||||
unset($this->view->playlists);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function clearShowAction()
|
||||
|
|
|
@ -515,7 +515,7 @@ class Show {
|
|||
return $event;
|
||||
}
|
||||
|
||||
public function searchPlaylistsForShow($day, $search){
|
||||
public function searchPlaylistsForShow($day, $search=null){
|
||||
global $CC_DBC;
|
||||
|
||||
$sql = "SELECT * FROM cc_show_days WHERE show_id = '{$this->_showId}' AND day = '{$day}'";
|
||||
|
|
|
@ -185,9 +185,10 @@ function makeScheduleDialog(dialog, show) {
|
|||
dialog.find("#schedule_playlist_chosen")
|
||||
.droppable({
|
||||
drop: function(event, ui) {
|
||||
var li, pl_id, url, start_date, end_date;
|
||||
var li, pl_id, url, start_date, end_date, day;
|
||||
|
||||
pl_id = $(ui.helper).attr("id").split("_").pop();
|
||||
day = show.start.getDay();
|
||||
|
||||
start_date = makeTimeStamp(show.start);
|
||||
end_date = makeTimeStamp(show.end);
|
||||
|
@ -195,7 +196,7 @@ function makeScheduleDialog(dialog, show) {
|
|||
url = '/Schedule/schedule-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{plId: pl_id, start: start_date, end: end_date, showId: show.id},
|
||||
{plId: pl_id, start: start_date, end: end_date, showId: show.id, day: day},
|
||||
function(json){
|
||||
var x;
|
||||
|
||||
|
@ -208,13 +209,17 @@ function makeScheduleDialog(dialog, show) {
|
|||
});
|
||||
}
|
||||
|
||||
function openScheduleDialog(show, time) {
|
||||
var url;
|
||||
function openScheduleDialog(show) {
|
||||
var url, start_date, end_date, day;
|
||||
|
||||
url = '/Schedule/schedule-show/format/json';
|
||||
day = show.start.getDay();
|
||||
|
||||
start_date = makeTimeStamp(show.start);
|
||||
end_date = makeTimeStamp(show.end);
|
||||
|
||||
$.get(url,
|
||||
{length: time},
|
||||
{day: day, start: start_date, end: end_date, showId: show.id},
|
||||
function(json){
|
||||
var dialog = $(json.dialog);
|
||||
|
||||
|
@ -250,17 +255,8 @@ function eventMenu(action, el, pos) {
|
|||
});
|
||||
}
|
||||
else if (method === 'schedule-show') {
|
||||
var length, h, m, s, time;
|
||||
|
||||
length = event.end.getTime() - event.start.getTime();
|
||||
|
||||
h = Math.floor(length / (1000*60*60));
|
||||
m = (length % (1000*60*60)) / (1000*60);
|
||||
s = ((length % (1000*60*60)) % (1000*60)) / 1000;
|
||||
|
||||
time = h+":"+m+":"+s;
|
||||
|
||||
openScheduleDialog(event, time);
|
||||
openScheduleDialog(event);
|
||||
}
|
||||
else if (method === 'clear-show') {
|
||||
start_date = makeTimeStamp(event.start);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue