CC-3174 : Show Content Builder
adding time filled/empty row data.
This commit is contained in:
parent
7e223aebae
commit
4f5b5d8562
4 changed files with 78 additions and 28 deletions
|
@ -68,7 +68,7 @@ class Application_Model_Scheduler {
|
|||
*
|
||||
* @return DateTime endDT in UTC
|
||||
*/
|
||||
private function findEndTime($p_startDT, $p_duration) {
|
||||
public static function findEndTime($p_startDT, $p_duration) {
|
||||
|
||||
$startEpoch = $p_startDT->format("U.u");
|
||||
$durationSeconds = Application_Model_Playlist::playlistTimeToSeconds($p_duration);
|
||||
|
@ -149,7 +149,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
Logging::log("adding file with id: ".$file["id"]);
|
||||
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
|
||||
$endTimeDT = self::findEndTime($nextStartDT, $file['cliplength']);
|
||||
|
||||
//item existed previously and is being moved.
|
||||
//need to keep same id for resources if we want REST.
|
||||
|
@ -184,7 +184,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
Logging::log("adjusting iterm {$item->getDbId()}");
|
||||
|
||||
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
|
||||
$endTimeDT = self::findEndTime($nextStartDT, $item->getDbClipLength());
|
||||
|
||||
$item->setDbStarts($nextStartDT);
|
||||
$item->setDbEnds($endTimeDT);
|
||||
|
@ -346,7 +346,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
Logging::log("adjusting item #".$item->getDbId());
|
||||
|
||||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||
$itemEndDT = self::findEndTime($itemStartDT, $item->getDbClipLength());
|
||||
|
||||
$item->setDbStarts($itemStartDT);
|
||||
$item->setDbEnds($itemEndDT);
|
||||
|
|
|
@ -7,6 +7,8 @@ class Application_Model_ShowBuilder {
|
|||
private $endDT;
|
||||
private $user;
|
||||
|
||||
private $contentDT;
|
||||
|
||||
private $defaultRowArray = array(
|
||||
"header" => false,
|
||||
"footer" => false,
|
||||
|
@ -15,9 +17,7 @@ class Application_Model_ShowBuilder {
|
|||
"id" => 0,
|
||||
"instance" => "",
|
||||
"starts" => "",
|
||||
"startsUnix" => null,
|
||||
"ends" => "",
|
||||
"endsUnix" => null,
|
||||
"runtime" => "",
|
||||
"title" => "",
|
||||
"creator" => "",
|
||||
|
@ -56,11 +56,45 @@ class Application_Model_ShowBuilder {
|
|||
return $runtime;
|
||||
}
|
||||
|
||||
private function makeFooterRow() {
|
||||
private function formatTimeFilled($p_sec) {
|
||||
|
||||
$formatted = "";
|
||||
$sign = ($p_sec < 0) ? "-" : "+";
|
||||
|
||||
$time = Application_Model_Playlist::secondsToPlaylistTime(abs($p_sec));
|
||||
Logging::log("time is: ".$time);
|
||||
$info = explode(":", $time);
|
||||
|
||||
$formatted .= $sign;
|
||||
|
||||
if ($info[0] > 0) {
|
||||
$formatted .= " {$info[0]}h";
|
||||
}
|
||||
|
||||
if ($info[1] > 0) {
|
||||
$formatted .= " {$info[1]}m";
|
||||
}
|
||||
|
||||
if ($info[2] > 0) {
|
||||
$sec = round($info[2], 0);
|
||||
$formatted .= " {$sec}s";
|
||||
}
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
||||
private function makeFooterRow($p_item) {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
$row["footer"] = true;
|
||||
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
$contentDT = $this->contentDT;
|
||||
|
||||
$runtime = bcsub($contentDT->format("U.u"), $showEndDT->format("U.u"), 6);
|
||||
$row["runtime"] = $runtime;
|
||||
$row["fRuntime"] = $this->formatTimeFilled($runtime);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
@ -80,6 +114,8 @@ class Application_Model_ShowBuilder {
|
|||
$row["title"] = $p_item["show_name"];
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
|
||||
$this->contentDT = $showStartDT;
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
@ -107,6 +143,8 @@ class Application_Model_ShowBuilder {
|
|||
$row["title"] = $p_item["file_track_title"];
|
||||
$row["creator"] = $p_item["file_artist_name"];
|
||||
$row["album"] = $p_item["file_album_title"];
|
||||
|
||||
$this->contentDT = $schedEndDT;
|
||||
}
|
||||
//show is empty
|
||||
else {
|
||||
|
@ -125,14 +163,17 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT->format("Y-m-d H:i:s"), $this->endDT->format("Y-m-d H:i:s"));
|
||||
|
||||
foreach ($scheduled_items as $item) {
|
||||
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {
|
||||
|
||||
$item = $scheduled_items[$i];
|
||||
|
||||
//make a header row.
|
||||
if ($current_id !== $item["si_id"]) {
|
||||
|
||||
//make a footer row.
|
||||
if ($current_id !== -1) {
|
||||
$display_items[] = $this->makeFooterRow();
|
||||
//pass in the previous row as it's the last row for the previous show.
|
||||
$display_items[] = $this->makeFooterRow($scheduled_items[$i-1]);
|
||||
}
|
||||
|
||||
$display_items[] = $this->makeHeaderRow($item);
|
||||
|
@ -146,7 +187,7 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
//make the last footer if there were any scheduled items.
|
||||
if (count($scheduled_items) > 0) {
|
||||
$display_items[] = $this->makeFooterRow();
|
||||
$display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items)-1]);
|
||||
}
|
||||
|
||||
return $display_items;
|
||||
|
|
|
@ -362,7 +362,7 @@ function alertShowErrorAndReload(){
|
|||
window.location.reload();
|
||||
}
|
||||
|
||||
$(window).load(function() {
|
||||
$(document).ready(function() {
|
||||
$.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:createFullCalendar
|
||||
, error:function(jqXHR, textStatus, errorThrown){}});
|
||||
|
||||
|
|
|
@ -129,12 +129,12 @@ $(document).ready(function() {
|
|||
//save some info for reordering purposes.
|
||||
$(nRow).data({"aData": aData});
|
||||
|
||||
fnPrepareSeparatorRow = function(sRowContent, sClass) {
|
||||
fnPrepareSeparatorRow = function(sRowContent, sClass, iNodeIndex) {
|
||||
|
||||
node = nRow.children[1];
|
||||
node = nRow.children[iNodeIndex];
|
||||
node.innerHTML = sRowContent;
|
||||
node.setAttribute('colspan',100);
|
||||
for (i = 2; i < nRow.children.length; i = i+1) {
|
||||
for (i = iNodeIndex + 1; i < nRow.children.length; i = i+1) {
|
||||
node = nRow.children[i];
|
||||
node.innerHTML = "";
|
||||
node.setAttribute("style", "display : none");
|
||||
|
@ -144,19 +144,29 @@ $(document).ready(function() {
|
|||
};
|
||||
|
||||
if (aData.header === true) {
|
||||
node = nRow.children[0];
|
||||
node.innerHTML = '<span class="ui-icon ui-icon-play"></span>';
|
||||
//node = nRow.children[0];
|
||||
//node.innerHTML = '<span class="ui-icon ui-icon-play"></span>';
|
||||
//node.innerHTML = '<span class="ui-icon ui-icon-play"></span>';
|
||||
|
||||
sSeparatorHTML = '<span>'+aData.title+'</span><span>'+aData.starts+'</span><span>'+aData.ends+'</span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, "sb-header");
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, "sb-header", 0);
|
||||
}
|
||||
else if (aData.footer === true) {
|
||||
|
||||
var c,
|
||||
node = nRow.children[0];
|
||||
node.innerHTML = '<span class="ui-icon ui-icon-check"></span>';
|
||||
|
||||
//check the show's content status.
|
||||
if (aData.runtime > 0) {
|
||||
node.innerHTML = '<span class="ui-icon ui-icon-check"></span>';
|
||||
cl = 'ui-state-highlight';
|
||||
}
|
||||
else {
|
||||
node.innerHTML = '<span class="ui-icon ui-icon-notice"></span>';
|
||||
cl = 'ui-state-error';
|
||||
}
|
||||
|
||||
sSeparatorHTML = '<span>Show Footer</span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, "sb-footer");
|
||||
sSeparatorHTML = '<span>'+aData.fRuntime+'</span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||
}
|
||||
else if (aData.empty === true) {
|
||||
|
||||
|
@ -164,7 +174,7 @@ $(document).ready(function() {
|
|||
node.innerHTML = '';
|
||||
|
||||
sSeparatorHTML = '<span>Show Empty</span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, "sb-empty odd");
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, "sb-empty odd", 1);
|
||||
}
|
||||
else {
|
||||
$(nRow).attr("id", "sched_"+aData.id);
|
||||
|
@ -272,7 +282,7 @@ $(document).ready(function() {
|
|||
},
|
||||
|
||||
// R = ColReorderResize, C = ColVis, T = TableTools
|
||||
"sDom": 'Rr<"H"CT<"#show_builder_toolbar">>t<"F">',
|
||||
"sDom": 'Rr<"H"CT>t<"F">',
|
||||
|
||||
"sAjaxDataProp": "schedule",
|
||||
"sAjaxSource": "/showbuilder/builder-feed"
|
||||
|
@ -383,15 +393,14 @@ $(document).ready(function() {
|
|||
update: fnUpdate,
|
||||
start: function(event, ui) {
|
||||
//ui.placeholder.html("PLACE HOLDER");
|
||||
},
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
tableDiv.sortable(sortableConf);
|
||||
|
||||
$("#show_builder_toolbar")
|
||||
.append('<span class="ui-icon ui-icon-trash"></span>')
|
||||
.find(".ui-icon-trash")
|
||||
.click(fnRemoveSelectedItems);
|
||||
$("#show_builder .fg-toolbar")
|
||||
.append('<div class="ColVis TableTools"><button class="ui-button ui-state-default"><span>Delete</span></button></div>')
|
||||
.click(fnRemoveSelectedItems);
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue