Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
deb5629c36
|
@ -141,32 +141,39 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function scheduleShowAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
$start = $this->_getParam('start');
|
||||
$end = $this->_getParam('end');
|
||||
$showId = $this->_getParam('showId');
|
||||
$day = $this->_getParam('day');
|
||||
$search = $this->_getParam('search', null);
|
||||
|
||||
if($search == "") {
|
||||
$search = null;
|
||||
}
|
||||
|
||||
$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');
|
||||
$start = $this->_getParam('start');
|
||||
$end = $this->_getParam('end');
|
||||
$showId = $this->_getParam('showId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$show = new Show($user, $showId);
|
||||
$show->scheduleShow($start, array($plId));
|
||||
|
||||
$this->view->showContent = $show->getShowContent($start);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
$length = $this->_getParam('length');
|
||||
$this->view->playlists = $show->searchPlaylistsForShow($day, $search);
|
||||
$this->view->showContent = $show->getShowContent($start);
|
||||
|
||||
$this->view->playlists = Playlist::searchPlaylists($length);
|
||||
$this->view->dialog = $this->view->render('schedule/schedule-show.phtml');
|
||||
$this->view->choice = $this->view->render('schedule/find-playlists.phtml');
|
||||
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
|
||||
$this->view->dialog = $this->view->render('schedule/schedule-show.phtml');
|
||||
|
||||
unset($this->view->playlists);
|
||||
}
|
||||
unset($this->view->showContent);
|
||||
unset($this->view->playlists);
|
||||
|
||||
}
|
||||
|
||||
public function clearShowAction()
|
||||
|
|
|
@ -285,9 +285,42 @@ class Show {
|
|||
LEFT JOIN cc_files AS f ON f.id = s.file_id
|
||||
LEFT JOIN cc_playlist AS p ON p.id = s.playlist_id )
|
||||
|
||||
WHERE ss.show_day = '{$timeinfo[0]}' AND ss.show_id = '{$this->_showId}'";
|
||||
WHERE ss.show_day = '{$timeinfo[0]}' AND ss.show_id = '{$this->_showId}' ORDER BY starts";
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
$res = $CC_DBC->GetAll($sql);
|
||||
|
||||
if(count($res) <= 0) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
$items = array();
|
||||
$currGroupId = -1;
|
||||
$pl_counter = -1;
|
||||
$f_counter = -1;
|
||||
foreach ($res as $row) {
|
||||
if($currGroupId != $row["group_id"]){
|
||||
$currGroupId = $row["group_id"];
|
||||
$pl_counter = $pl_counter + 1;
|
||||
$f_counter = -1;
|
||||
|
||||
$items[$pl_counter]["pl_name"] = $row["name"];
|
||||
$items[$pl_counter]["pl_creator"] = $row["creator"];
|
||||
$items[$pl_counter]["pl_description"] = $row["description"];
|
||||
$items[$pl_counter]["pl_group"] = $row["group_id"];
|
||||
|
||||
$sql = "SELECT SUM(clip_length) FROM cc_schedule WHERE group_id = '{$currGroupId}'";
|
||||
$length = $CC_DBC->GetOne($sql);
|
||||
|
||||
$items[$pl_counter]["pl_length"] = $length;
|
||||
}
|
||||
$f_counter = $f_counter + 1;
|
||||
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_name"] = $row["track_title"];
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_artist"] = $row["artist_name"];
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_length"] = $row["length"];
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public function clearShow($day) {
|
||||
|
@ -482,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}'";
|
||||
|
|
|
@ -2,4 +2,7 @@
|
|||
if(count($this->playlists) > 0) {
|
||||
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
|
||||
}
|
||||
else {
|
||||
echo "No Playlists Fit Duration";
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
if(count($this->playlists) > 0) {
|
||||
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
|
||||
}
|
||||
else {
|
||||
echo "No Playlists Fit Duration";
|
||||
}
|
||||
?>
|
|
@ -1,9 +1,5 @@
|
|||
<div id="schedule_playlist_dialog">
|
||||
<input id="schedule_playlist_search" type="text"></input>
|
||||
<ul id="schedule_playlist_choice">
|
||||
<?php
|
||||
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
|
||||
?>
|
||||
</ul>
|
||||
<ul id="schedule_playlist_chosen">No Playlists</ul>
|
||||
<input id="schedule_playlist_search" type="text"></input>
|
||||
<ul id="schedule_playlist_choice"></ul>
|
||||
<ul id="schedule_playlist_chosen"></ul>
|
||||
</div>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
<h3>First header</h3>
|
||||
<div>First content</div>
|
|
@ -0,0 +1,25 @@
|
|||
<?php if(count($this->showContent) > 0) : ?>
|
||||
<?php foreach($this->showContent as $pl) : ?>
|
||||
<li id="g_<?php echo $pl["pl_group"] ?>">
|
||||
<div>
|
||||
<span><?php echo $pl["pl_name"] ?></span>
|
||||
<span><?php echo $pl["pl_length"] ?></span>
|
||||
<div><?php echo $pl["pl_creator"] ?></div>
|
||||
<div class="group_list" style="display:none">
|
||||
<div class="sched_description"><?php echo $pl["pl_description"] ?></div>
|
||||
<?php foreach($pl["pl_content"] as $file) : ?>
|
||||
<div>
|
||||
<span><?php echo $file["f_name"] ?></span>
|
||||
<span><?php echo $file["f_length"] ?></span>
|
||||
</div>
|
||||
<div><?php echo $file["f_artist"] ?></div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<h3><a href="#">Empty</a></h3>
|
||||
<div>No Playlists</div>
|
||||
<?php endif; ?>
|
||||
|
|
@ -159,7 +159,7 @@ function openShowDialog() {
|
|||
});
|
||||
}
|
||||
|
||||
function makeScheduleDialog(dialog, show) {
|
||||
function makeScheduleDialog(dialog, json, show) {
|
||||
|
||||
dialog.find("#schedule_playlist_search").keyup(function(){
|
||||
var url, string, day;
|
||||
|
@ -172,53 +172,84 @@ function makeScheduleDialog(dialog, show) {
|
|||
|
||||
$("#schedule_playlist_choice")
|
||||
.empty()
|
||||
.append(html);
|
||||
.append(html)
|
||||
.find('li')
|
||||
.draggable({
|
||||
helper: 'clone'
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
dialog.find('#schedule_playlist_choice li')
|
||||
.draggable({
|
||||
helper: 'clone'
|
||||
});
|
||||
dialog.find('#schedule_playlist_choice')
|
||||
.append(json.choice)
|
||||
.find('li')
|
||||
.draggable({
|
||||
helper: 'clone'
|
||||
});
|
||||
|
||||
dialog.find("#schedule_playlist_chosen")
|
||||
.append(json.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, search;
|
||||
|
||||
search = $("#schedule_playlist_search").val();
|
||||
|
||||
pl_id = $(ui.helper).attr("id").split("_").pop();
|
||||
day = show.start.getDay();
|
||||
|
||||
start_date = makeTimeStamp(show.start);
|
||||
end_date = makeTimeStamp(show.end);
|
||||
|
||||
url = '/Schedule/schedule-show/format/json';
|
||||
|
||||
//$("#schedule_playlist_chosen")
|
||||
// .append(ui.helper);
|
||||
|
||||
|
||||
$.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, search: search},
|
||||
function(json){
|
||||
var x;
|
||||
|
||||
$("#schedule_playlist_choice")
|
||||
.empty()
|
||||
.append(json.choice)
|
||||
.find('li')
|
||||
.draggable({
|
||||
helper: 'clone'
|
||||
});
|
||||
|
||||
$("#schedule_playlist_chosen")
|
||||
.empty()
|
||||
.append(json.chosen)
|
||||
.find("li")
|
||||
.click(function(){
|
||||
$(this).find(".group_list").toggle();
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
dialog.find("#schedule_playlist_chosen li")
|
||||
.click(function(){
|
||||
$(this).find(".group_list").toggle();
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
makeScheduleDialog(dialog, show);
|
||||
makeScheduleDialog(dialog, json, show);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
|
@ -250,17 +281,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…
Reference in New Issue