CC-3174 : Show builder
creating a scheduling system to work with the new timeline in mind using propel.
This commit is contained in:
parent
f5761fd03c
commit
3f3117cf0e
8 changed files with 175 additions and 27 deletions
|
@ -29,6 +29,13 @@ $pages = array(
|
|||
'action' => 'index',
|
||||
'resource' => 'library'
|
||||
),
|
||||
array(
|
||||
'label' => 'Show Builder',
|
||||
'module' => 'default',
|
||||
'controller' => 'Showbuilder',
|
||||
'action' => 'index',
|
||||
'resource' => 'showbuilder'
|
||||
),
|
||||
array(
|
||||
'label' => 'Calendar',
|
||||
'module' => 'default',
|
||||
|
@ -67,7 +74,7 @@ $pages = array(
|
|||
'action' => 'stream-setting'
|
||||
),
|
||||
array(
|
||||
'label' =>
|
||||
'label' =>
|
||||
Application_Model_Preference::GetPlanLevel() == 'disabled'?'Support Settings':'Station Information Settings',
|
||||
'module' => 'default',
|
||||
'controller' => 'Preference',
|
||||
|
|
|
@ -232,8 +232,8 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
public function contentsAction()
|
||||
{
|
||||
$post = $this->getRequest()->getPost();
|
||||
$datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($post);
|
||||
$params = $this->getRequest()->getParams();
|
||||
$datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($params);
|
||||
|
||||
//format clip lengh to 1 decimal
|
||||
foreach($datatables["aaData"] as &$data){
|
||||
|
|
|
@ -26,13 +26,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js','text/javascript');
|
||||
|
||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = ".date("Z")."; //in seconds");
|
||||
//$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||
//$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js','text/javascript');
|
||||
//$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedHeader.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js','text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css');
|
||||
|
@ -64,12 +59,44 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$show_instance_id = $request->getParam("sid", 0);
|
||||
$scheduled_item_id = $request->getParam("time", 0);
|
||||
$scheduled_start = $request->getParam("start", 0);
|
||||
$instance = $request->getParam("instance", null);
|
||||
$id = $request->getParam("id", null);
|
||||
$starts_epoch = $request->getParam("start", null);
|
||||
$file_id = $request->getParam("file", null);
|
||||
|
||||
//snap to previous/next default.
|
||||
$scheduled_type = $request->getParam("type", 0);
|
||||
$startDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
//invalid request
|
||||
if (is_null($start)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//updating a scheduled item.
|
||||
if (isset($id)) {
|
||||
$schedItem = CcScheduleQuery::create()->findPK($id);
|
||||
$duration = $schedItem->getDbEnds('U') - $schedItem->getDbStarts('U');
|
||||
|
||||
$endDT = DateTime::createFromFormat("U", $starts_epoch + $duration, new DateTimeZone("UTC"));
|
||||
|
||||
$oldInstance = $schedItem->getDbInstanceId();
|
||||
|
||||
if ($instance === $oldInstance) {
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($oldInstance)
|
||||
->find();
|
||||
}
|
||||
//file was dragged out of the show into another show or scheduled not within a show.
|
||||
else {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$schedItem = new CcSchedule();
|
||||
}
|
||||
|
||||
$schedItem->setDbStarts($startDT);
|
||||
$schedItem->setDbEnds($endDT);
|
||||
$schedItem->save();
|
||||
}
|
||||
}
|
70
airtime_mvc/application/models/Scheduler.php
Normal file
70
airtime_mvc/application/models/Scheduler.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Scheduler {
|
||||
|
||||
private $propSched;
|
||||
|
||||
public function __construct($id = null) {
|
||||
|
||||
if (is_null($id)) {
|
||||
$this->propSched = new CcSchedule();
|
||||
}
|
||||
else {
|
||||
$this->propSched = CcScheduleQuery::create()->findPK($id);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public function findScheduledItems($starts, $ends) {
|
||||
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbStarts(array('min' => $starts->format('Y-m-d H:i:s'), 'max' => $ends->format('Y-m-d H:i:s')))
|
||||
->find();
|
||||
}
|
||||
*/
|
||||
|
||||
public function addScheduledItem($starts, $duration, $adjustSched = true) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* @param DateTime $starts
|
||||
*/
|
||||
public function updateScheduledItem($p_newStarts, $p_adjustSched = true) {
|
||||
|
||||
$origStarts = $this->propSched->getDbStarts(null);
|
||||
|
||||
$diff = $origStarts->diff($p_newStarts);
|
||||
|
||||
//item is scheduled further in future
|
||||
if ($diff->format("%R") === "+") {
|
||||
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbStarts($this->propSched->getDbStarts(), Criteria::GREATER_THAN)
|
||||
->filterByDbId($this->propSched->getDbId(), Criteria::NOT_EQUAL)
|
||||
->find();
|
||||
|
||||
}
|
||||
//item has been scheduled earlier
|
||||
else {
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbStarts($this->propSched->getDbStarts(), Criteria::GREATER_THAN)
|
||||
->filterByDbId($this->propSched->getDbId(), Criteria::NOT_EQUAL)
|
||||
->find();
|
||||
}
|
||||
}
|
||||
|
||||
public function removeScheduledItem($adjustSched = true) {
|
||||
|
||||
if ($adjustSched === true) {
|
||||
$duration = $this->propSched->getDbEnds('U') - $this->propSched->getDbStarts('U');
|
||||
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbInstanceId()
|
||||
->filterByDbStarts()
|
||||
->find();
|
||||
}
|
||||
|
||||
$this->propSched->delete();
|
||||
}
|
||||
}
|
|
@ -14,7 +14,9 @@ class Application_Model_ShowBuilder {
|
|||
"id" => "",
|
||||
"instance" => "",
|
||||
"starts" => "",
|
||||
"startsUnix" => null,
|
||||
"ends" => "",
|
||||
"endsUnix" => null,
|
||||
"runtime" => "",
|
||||
"title" => "",
|
||||
"creator" => "",
|
||||
|
@ -73,7 +75,10 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
$row["header"] = true;
|
||||
$row["starts"] = $showStartDT->format("Y-m-d H:i");
|
||||
$row["startsUnix"] = $showStartDT->format("U");
|
||||
$row["ends"] = $showEndDT->format("Y-m-d H:i");
|
||||
$row["endsUnix"] = $showEndDT->format("U");
|
||||
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
|
||||
$row["title"] = $p_item["show_name"];
|
||||
|
||||
return $row;
|
||||
|
@ -94,7 +99,10 @@ class Application_Model_ShowBuilder {
|
|||
$row["id"] = $p_item["sched_id"];
|
||||
$row["instance"] = $p_item["si_id"];
|
||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||
$row["startsUnix"] = $schedStartDT->format("U");
|
||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||
$row["endsUnix"] = $schedEndDT->format("U");
|
||||
$row["duration"] = $schedEndDT->format("U") - $schedStartDT->format("U");
|
||||
$row["runtime"] = $this->formatDuration($runtime);
|
||||
$row["title"] = $p_item["file_track_title"];
|
||||
$row["creator"] = $p_item["file_artist_name"];
|
||||
|
|
|
@ -804,6 +804,8 @@ class Application_Model_StoredFile {
|
|||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
|
||||
Logging::log($sql);
|
||||
|
||||
$results = $CC_DBC->getAll($sql);
|
||||
|
||||
if(!isset($totalDisplayRows)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue