CC-3547 : Refactoring Views, removing action stack to better work with permissions. Reorganizing Statistics Dialog.
This commit is contained in:
parent
12b23443db
commit
5a24331ef6
airtime_mvc/application
controllers
models
views/scripts/showbuilder
|
@ -376,48 +376,6 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public function notifyScheduleGroupPlayAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$api_key = $this->_getParam('api_key');
|
||||
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
{
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource.';
|
||||
exit;
|
||||
}
|
||||
|
||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
||||
|
||||
$schedule_group_id = $this->_getParam("schedule_id");
|
||||
if (is_numeric($schedule_group_id)) {
|
||||
$sg = new Application_Model_ScheduleGroup($schedule_group_id);
|
||||
if ($sg->exists()) {
|
||||
$result = $sg->notifyGroupStartPlay();
|
||||
if (!PEAR::isError($result)) {
|
||||
echo json_encode(array("status"=>1, "message"=>""));
|
||||
exit;
|
||||
} else {
|
||||
echo json_encode(array("status"=>0, "message"=>"DB Error:".$result->getMessage()));
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
echo json_encode(array("status"=>0, "message"=>"Schedule group does not exist: ".$schedule_group_id));
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
echo json_encode(array("status"=>0, "message"=>"Incorrect or non-numeric arguments given."));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public function recordedShowsAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
|
|
@ -109,7 +109,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
//determine whether to remove/hide/display the library.
|
||||
$showLib = false;
|
||||
if (!$user->isGuest()) {
|
||||
$hideLib = false;
|
||||
$disableLib = false;
|
||||
$data = Application_Model_Preference::GetValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$settings = unserialize($data);
|
||||
|
@ -120,9 +120,9 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
else {
|
||||
$hideLib = true;
|
||||
$disableLib = true;
|
||||
}
|
||||
$this->view->hideLib = $hideLib;
|
||||
$this->view->disableLib = $disableLib;
|
||||
$this->view->showLib = $showLib;
|
||||
|
||||
//populate date range form for show builder.
|
||||
|
|
|
@ -2,31 +2,6 @@
|
|||
|
||||
class Application_Model_Schedule {
|
||||
|
||||
/**
|
||||
* Return true if there is nothing in the schedule for the given start time
|
||||
* up to the length of time after that.
|
||||
*
|
||||
* @param string $p_datetime
|
||||
* In the format YYYY-MM-DD HH:MM:SS.mmmmmm
|
||||
* @param string $p_length
|
||||
* In the format HH:MM:SS.mmmmmm
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public static function isScheduleEmptyInRange($p_datetime, $p_length) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (empty($p_length)) {
|
||||
return new PEAR_Error("Application_Model_Schedule::isSchedulerEmptyInRange: param p_length is empty.");
|
||||
}
|
||||
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE (starts >= '$p_datetime') "
|
||||
." AND (ends <= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))";
|
||||
//$_SESSION["debug"] = $sql;
|
||||
//echo $sql;
|
||||
$count = $CC_DBC->GetOne($sql);
|
||||
//var_dump($count);
|
||||
return ($count == '0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return TRUE if file is going to be played in the future.
|
||||
*
|
||||
|
@ -238,110 +213,6 @@ class Application_Model_Schedule {
|
|||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an SQL Query for accessing scheduled item information from
|
||||
* the database.
|
||||
*
|
||||
* @param int $timeNow
|
||||
* @param int $timePeriod
|
||||
* @param int $count
|
||||
* @param String $interval
|
||||
* @return date
|
||||
*
|
||||
* $timeNow is the the currentTime in the format "Y-m-d H:i:s".
|
||||
* For example: 2011-02-02 22:00:54
|
||||
*
|
||||
* $timePeriod can be either negative, zero or positive. This is used
|
||||
* to indicate whether we want items from the past, present or future.
|
||||
*
|
||||
* $count indicates how many results we want to limit ourselves to.
|
||||
*
|
||||
* $interval is used to indicate how far into the past or future we
|
||||
* want to search the database. For example "5 days", "18 hours", "60 minutes",
|
||||
* "30 seconds" etc.
|
||||
*/
|
||||
public static function GetScheduledItemData($timeStamp, $timePeriod=0, $count = 0, $interval="0 hours")
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$sql = "SELECT DISTINCT"
|
||||
." pt.name,"
|
||||
." ft.track_title,"
|
||||
." ft.artist_name,"
|
||||
." ft.album_title,"
|
||||
." st.starts,"
|
||||
." st.ends,"
|
||||
." st.clip_length,"
|
||||
." st.media_item_played,"
|
||||
." st.group_id,"
|
||||
." show.name as show_name,"
|
||||
." st.instance_id"
|
||||
." FROM $CC_CONFIG[scheduleTable] st"
|
||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||
." ON st.file_id = ft.id"
|
||||
." LEFT JOIN $CC_CONFIG[playListTable] pt"
|
||||
." ON st.playlist_id = pt.id"
|
||||
." LEFT JOIN $CC_CONFIG[showInstances] si"
|
||||
." ON st.instance_id = si.id"
|
||||
." LEFT JOIN $CC_CONFIG[showTable] show"
|
||||
." ON si.show_id = show.id"
|
||||
." WHERE st.starts < si.ends";
|
||||
|
||||
if ($timePeriod < 0){
|
||||
$sql .= " AND st.ends < TIMESTAMP '$timeStamp'"
|
||||
." AND st.ends > (TIMESTAMP '$timeStamp' - INTERVAL '$interval')"
|
||||
." ORDER BY st.starts DESC"
|
||||
." LIMIT $count";
|
||||
} else if ($timePeriod == 0){
|
||||
$sql .= " AND st.starts <= TIMESTAMP '$timeStamp'"
|
||||
." AND st.ends >= TIMESTAMP '$timeStamp'";
|
||||
} else if ($timePeriod > 0){
|
||||
$sql .= " AND st.starts > TIMESTAMP '$timeStamp'"
|
||||
." AND st.starts < (TIMESTAMP '$timeStamp' + INTERVAL '$interval')"
|
||||
." ORDER BY st.starts"
|
||||
." LIMIT $count";
|
||||
}
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
public static function getScheduleItemsInRange($starts, $ends)
|
||||
{
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
|
||||
$sql = "SELECT"
|
||||
." si.starts as show_starts,"
|
||||
." si.ends as show_ends,"
|
||||
." si.rebroadcast as rebroadcast,"
|
||||
." st.starts as item_starts,"
|
||||
." st.ends as item_ends,"
|
||||
." st.clip_length as clip_length,"
|
||||
." ft.track_title as track_title,"
|
||||
." ft.artist_name as artist_name,"
|
||||
." ft.album_title as album_title,"
|
||||
." s.name as show_name,"
|
||||
." si.id as instance_id,"
|
||||
." pt.name as playlist_name"
|
||||
." FROM ".$CC_CONFIG["showInstances"]." si"
|
||||
." LEFT JOIN ".$CC_CONFIG["scheduleTable"]." st"
|
||||
." ON st.instance_id = si.id"
|
||||
." LEFT JOIN ".$CC_CONFIG["playListTable"]." pt"
|
||||
." ON st.playlist_id = pt.id"
|
||||
." LEFT JOIN ".$CC_CONFIG["filesTable"]." ft"
|
||||
." ON st.file_id = ft.id"
|
||||
." LEFT JOIN ".$CC_CONFIG["showTable"]." s"
|
||||
." ON si.show_id = s.id"
|
||||
." WHERE ((si.starts < TIMESTAMP '$starts' AND si.ends > TIMESTAMP '$starts')"
|
||||
." OR (si.starts > TIMESTAMP '$starts' AND si.ends < TIMESTAMP '$ends')"
|
||||
." OR (si.starts < TIMESTAMP '$ends' AND si.ends > TIMESTAMP '$ends'))"
|
||||
." AND (st.starts < si.ends)"
|
||||
." ORDER BY si.id, si.starts, st.starts";
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* @param DateTime $p_startDateTime
|
||||
|
@ -396,23 +267,6 @@ class Application_Model_Schedule {
|
|||
return $rows;
|
||||
}
|
||||
|
||||
public static function GetShowInstanceItems($instance_id)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.media_item_played, st.group_id, show.name as show_name, st.instance_id"
|
||||
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] show"
|
||||
." WHERE st.playlist_id = pt.id"
|
||||
." AND st.file_id = ft.id"
|
||||
." AND st.instance_id = si.id"
|
||||
." AND si.show_id = show.id"
|
||||
." AND instance_id = $instance_id"
|
||||
." ORDER BY st.starts";
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function UpdateMediaPlayedStatus($p_id)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
|
|
@ -1,216 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_ScheduleGroup {
|
||||
|
||||
private $groupId;
|
||||
|
||||
public function __construct($p_groupId = null) {
|
||||
$this->groupId = $p_groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the schedule group exists in the DB.
|
||||
* @return boolean
|
||||
*/
|
||||
public function exists() {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG['scheduleTable']
|
||||
." WHERE group_id=".$this->groupId;
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
return $result != "0";
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a music clip or playlist to the schedule.
|
||||
*
|
||||
* @param int $p_showInstance
|
||||
* ID of the show.
|
||||
* @param $p_datetime
|
||||
* In the format YYYY-MM-DD HH:MM:SS.mmmmmm
|
||||
* @param $p_audioFileId
|
||||
* (optional, either this or $p_playlistId must be set) DB ID of the audio file
|
||||
* @param $p_playlistId
|
||||
* (optional, either this of $p_audioFileId must be set) DB ID of the playlist
|
||||
* @param $p_options
|
||||
* Does nothing at the moment.
|
||||
*
|
||||
* @return int|PEAR_Error
|
||||
* Return PEAR_Error if the item could not be added.
|
||||
* Error code 555 is a scheduling conflict.
|
||||
*/
|
||||
public function add($p_showInstance, $p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
if (!is_null($p_audioFileId)) {
|
||||
// Schedule a single audio track
|
||||
|
||||
// Load existing track
|
||||
$track = Application_Model_StoredFile::Recall($p_audioFileId);
|
||||
if (is_null($track)) {
|
||||
return new PEAR_Error("Could not find audio track.");
|
||||
}
|
||||
|
||||
// Check if there are any conflicts with existing entries
|
||||
$metadata = $track->getMetadata();
|
||||
$length = $metadata['MDATA_KEY_DURATION'];
|
||||
if (empty($length)) {
|
||||
return new PEAR_Error("Length is empty.");
|
||||
}
|
||||
// Insert into the table
|
||||
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
|
||||
|
||||
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
||||
." (instance_id, starts, ends, clip_length, group_id, file_id, cue_out)"
|
||||
." VALUES ($p_showInstance, TIMESTAMP '$p_datetime', "
|
||||
." (TIMESTAMP '$p_datetime' + INTERVAL '$length'),"
|
||||
." '$length',"
|
||||
." {$this->groupId}, $p_audioFileId, '$length')";
|
||||
$result = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($result)) {
|
||||
//var_dump($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
elseif (!is_null($p_playlistId)){
|
||||
// Schedule a whole playlist
|
||||
|
||||
// Load existing playlist
|
||||
$playlist = Application_Model_Playlist::Recall($p_playlistId);
|
||||
if (is_null($playlist)) {
|
||||
return new PEAR_Error("Could not find playlist.");
|
||||
}
|
||||
|
||||
// Check if there are any conflicts with existing entries
|
||||
$length = trim($playlist->getLength());
|
||||
//var_dump($length);
|
||||
if (empty($length)) {
|
||||
return new PEAR_Error("Length is empty.");
|
||||
}
|
||||
|
||||
// Insert all items into the schedule
|
||||
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
|
||||
$itemStartTime = $p_datetime;
|
||||
|
||||
$plItems = $playlist->getContents();
|
||||
//var_dump($plItems);
|
||||
foreach ($plItems as $row) {
|
||||
$trackLength = $row["cliplength"];
|
||||
//var_dump($trackLength);
|
||||
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
||||
." (instance_id, playlist_id, starts, ends, group_id, file_id,"
|
||||
." clip_length, cue_in, cue_out, fade_in, fade_out)"
|
||||
." VALUES ($p_showInstance, $p_playlistId, TIMESTAMP '$itemStartTime', "
|
||||
." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'),"
|
||||
." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}',"
|
||||
." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
|
||||
$result = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($result)) {
|
||||
//var_dump($sql);
|
||||
return $result;
|
||||
}
|
||||
$itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'");
|
||||
}
|
||||
}
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
return $this->groupId;
|
||||
}
|
||||
|
||||
public function addFileAfter($show_instance, $p_groupId, $p_audioFileId) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
// Get the end time for the given entry
|
||||
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE group_id=$p_groupId";
|
||||
$startTime = $CC_DBC->GetOne($sql);
|
||||
return $this->add($show_instance, $startTime, $p_audioFileId);
|
||||
}
|
||||
|
||||
public function addPlaylistAfter($show_instance, $p_groupId, $p_playlistId) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
// Get the end time for the given entry
|
||||
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE group_id=$p_groupId";
|
||||
|
||||
$startTime = $CC_DBC->GetOne($sql);
|
||||
return $this->add($show_instance, $startTime, null, $p_playlistId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the group from the schedule.
|
||||
* Note: does not check if it is in the past, you can remove anything.
|
||||
*
|
||||
* @return boolean
|
||||
* TRUE on success, false if there is no group ID defined.
|
||||
*/
|
||||
public function remove() {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (is_null($this->groupId) || !is_numeric($this->groupId)) {
|
||||
return false;
|
||||
}
|
||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE group_id = ".$this->groupId;
|
||||
//echo $sql;
|
||||
$retVal = $CC_DBC->query($sql);
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
return $retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of items in this group.
|
||||
* @return string
|
||||
*/
|
||||
public function count() {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT COUNT(*) FROM {$CC_CONFIG['scheduleTable']}"
|
||||
." WHERE group_id={$this->groupId}";
|
||||
return $CC_DBC->GetOne($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the list of items in this group as a 2D array.
|
||||
* @return array
|
||||
*/
|
||||
public function getItems() {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT "
|
||||
." st.id,"
|
||||
." st.file_id,"
|
||||
." st.cue_in,"
|
||||
." st.cue_out,"
|
||||
." st.clip_length,"
|
||||
." st.fade_in,"
|
||||
." st.fade_out,"
|
||||
." st.starts,"
|
||||
." st.ends"
|
||||
." FROM $CC_CONFIG[scheduleTable] as st"
|
||||
." LEFT JOIN $CC_CONFIG[showInstances] as si"
|
||||
." ON st.instance_id = si.id"
|
||||
." WHERE st.group_id=$this->groupId"
|
||||
." AND st.starts < si.ends"
|
||||
." ORDER BY st.starts";
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
public function notifyGroupStartPlay() {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
||||
." SET schedule_group_played=TRUE"
|
||||
." WHERE group_id=".$this->groupId;
|
||||
$retVal = $CC_DBC->query($sql);
|
||||
return $retVal;
|
||||
}
|
||||
|
||||
public function notifyMediaItemStartPlay($p_fileId) {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "UPDATE ".$CC_CONFIG['scheduleTable']
|
||||
." SET media_item_played=TRUE"
|
||||
." WHERE group_id=".$this->groupId
|
||||
." AND file_id=".pg_escape_string($p_fileId);
|
||||
$retVal = $CC_DBC->query($sql);
|
||||
return $retVal;
|
||||
}
|
||||
}
|
|
@ -346,18 +346,6 @@ class Application_Model_ShowInstance {
|
|||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the group ID for this show.
|
||||
*
|
||||
*/
|
||||
private function getLastGroupId()
|
||||
{
|
||||
global $CC_DBC;
|
||||
$sql = "SELECT group_id FROM cc_schedule WHERE instance_id = '{$this->_instanceId}' ORDER BY ends DESC LIMIT 1";
|
||||
$res = $CC_DBC->GetOne($sql);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a playlist as the last item of the current show.
|
||||
*
|
||||
|
@ -406,29 +394,6 @@ class Application_Model_ShowInstance {
|
|||
}
|
||||
}
|
||||
|
||||
public function removeGroupFromShow($group_id)
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
||||
$sql = "SELECT MAX(ends) as end_timestamp, (MAX(ends) - MIN(starts)) as length
|
||||
FROM cc_schedule
|
||||
WHERE group_id = '{$group_id}'";
|
||||
|
||||
$groupBoundry = $CC_DBC->GetRow($sql);
|
||||
|
||||
$group = CcScheduleQuery::create()
|
||||
->filterByDbGroupId($group_id)
|
||||
->delete();
|
||||
|
||||
$sql = "UPDATE cc_schedule
|
||||
SET starts = (starts - INTERVAL '{$groupBoundry["length"]}'), ends = (ends - INTERVAL '{$groupBoundry["length"]}')
|
||||
WHERE starts >= '{$groupBoundry["end_timestamp"]}' AND instance_id = {$this->_instanceId}";
|
||||
|
||||
$CC_DBC->query($sql);
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
$this->updateScheduledTime();
|
||||
}
|
||||
|
||||
public function clearShow()
|
||||
{
|
||||
CcScheduleQuery::create()
|
||||
|
@ -646,11 +611,6 @@ class Application_Model_ShowInstance {
|
|||
return $interval->format("%h:%I:%S");
|
||||
}
|
||||
|
||||
public function searchPlaylistsForShow($datatables)
|
||||
{
|
||||
return Application_Model_StoredFile::searchPlaylistsForSchedule($datatables);
|
||||
}
|
||||
|
||||
public function getShowListContent()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
@ -677,64 +637,6 @@ class Application_Model_ShowInstance {
|
|||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function GetShowsInstancesIdsInRange($p_start, $p_end)
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
||||
$sql = "SELECT id FROM cc_show_instances AS si "
|
||||
."WHERE modified_instance != TRUE AND ("
|
||||
."(si.starts < TIMESTAMP '$p_start'"
|
||||
."AND si.ends > TIMESTAMP '$p_start') "
|
||||
."OR (si.starts > TIMESTAMP '$p_start' "
|
||||
."AND si.ends < TIMESTAMP '$p_end') "
|
||||
."OR (si.starts < TIMESTAMP '$p_end' "
|
||||
."AND si.ends > TIMESTAMP '$p_end') "
|
||||
.") "
|
||||
." ORDER BY si.starts";
|
||||
|
||||
Logging::debug($sql);
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function getScheduleItemsInRange($timeNow, $start, $end)
|
||||
{
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
|
||||
$instanceId = $this->_instanceId;
|
||||
|
||||
$sql = "SELECT"
|
||||
." si.starts as show_starts,"
|
||||
." si.ends as show_ends,"
|
||||
." si.rebroadcast as rebroadcast,"
|
||||
." st.starts as item_starts,"
|
||||
." st.ends as item_ends,"
|
||||
." st.clip_length as clip_length,"
|
||||
." ft.track_title as track_title,"
|
||||
." ft.artist_name as artist_name,"
|
||||
." ft.album_title as album_title,"
|
||||
." s.name as show_name,"
|
||||
." si.id as instance_id"
|
||||
." FROM {$CC_CONFIG['showInstances']} si"
|
||||
." LEFT JOIN {$CC_CONFIG['scheduleTable']} st"
|
||||
." ON st.instance_id = si.id"
|
||||
." LEFT JOIN {$CC_CONFIG['filesTable']} ft"
|
||||
." ON st.file_id = ft.id"
|
||||
." LEFT JOIN {$CC_CONFIG['showTable']} s"
|
||||
." ON si.show_id = s.id"
|
||||
." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')"
|
||||
." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')"
|
||||
." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))"
|
||||
." AND (st.starts < si.ends)"
|
||||
." AND si.id = $instanceId"
|
||||
." ORDER BY si.starts, st.starts";
|
||||
|
||||
Logging::log($sql);
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
public function getLastAudioItemEnd(){
|
||||
global $CC_DBC;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php if (!$this->hideLib): ?>
|
||||
<?php if (!$this->disableLib): ?>
|
||||
<div id="library_content" class="lib-content tabs ui-widget ui-widget-content block-shadow alpha-block padded"
|
||||
<?php if (!$this->showLib): ?>
|
||||
style="display:none"
|
||||
|
@ -9,7 +9,7 @@
|
|||
<?php endif; ?>
|
||||
|
||||
<div id="show_builder" class="sb-content ui-widget ui-widget-content block-shadow omega-block padded">
|
||||
<?php if (!$this->hideLib && !$this->showLib): ?>
|
||||
<?php if (!$this->disableLib && !$this->showLib): ?>
|
||||
<div id="sb_edit" class="ui-state-default" title="open the library to schedule files.">
|
||||
<span class="ui-icon ui-icon-arrowthick-1-nw"></span>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue