Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
0ad4e0dd28
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
class Application_Common_Database
|
||||
{
|
||||
public static function prepareAndExecute($sql, array $paramValueMap,
|
||||
public static function prepareAndExecute($sql, array $paramValueMap,
|
||||
$type='all', $fetchType=PDO::FETCH_ASSOC)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
@ -15,8 +15,13 @@ class Application_Common_Database
|
|||
$rows = $stmt->fetch($fetchType);
|
||||
} else if ($type == 'column'){
|
||||
$rows = $stmt->fetchColumn();
|
||||
} else {
|
||||
} else if ($type == 'all') {
|
||||
$rows = $stmt->fetchAll($fetchType);
|
||||
} else if ($type == 'execute') {
|
||||
$rows = null;
|
||||
} else {
|
||||
$msg = "bad type passed: type($type)";
|
||||
throw new Exception("Error: $msg");
|
||||
}
|
||||
} else {
|
||||
$msg = implode(',', $stmt->errorInfo());
|
||||
|
|
|
@ -175,7 +175,7 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable
|
|||
f.length AS orig_length
|
||||
FROM cc_playlistcontents AS pc
|
||||
JOIN cc_files AS f ON pc.file_id=f.id
|
||||
WHERE pc.playlist_id = {$this->id}
|
||||
WHERE pc.playlist_id = :playlist_id1
|
||||
AND TYPE = 0)
|
||||
UNION ALL
|
||||
(SELECT pc.id AS id,
|
||||
|
@ -194,7 +194,7 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable
|
|||
FROM cc_playlistcontents AS pc
|
||||
JOIN cc_webstream AS ws ON pc.stream_id=ws.id
|
||||
LEFT JOIN cc_subjs AS sub ON sub.id = ws.creator_id
|
||||
WHERE pc.playlist_id = {$this->id}
|
||||
WHERE pc.playlist_id = :playlist_id2
|
||||
AND pc.TYPE = 1)
|
||||
UNION ALL
|
||||
(SELECT pc.id AS id,
|
||||
|
@ -213,13 +213,12 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable
|
|||
FROM cc_playlistcontents AS pc
|
||||
JOIN cc_block AS bl ON pc.block_id=bl.id
|
||||
JOIN cc_subjs AS sbj ON bl.creator_id=sbj.id
|
||||
WHERE pc.playlist_id = {$this->id}
|
||||
WHERE pc.playlist_id = :playlist_id3
|
||||
AND pc.TYPE = 2)) AS temp
|
||||
ORDER BY temp.position;
|
||||
SQL;
|
||||
|
||||
$con = Propel::getConnection();
|
||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||
$rows = Application_Common_Database::prepareAndExecute($sql, array(':playlist_id1'=>$this->id, ':playlist_id2'=>$this->id, ':playlist_id3'=>$this->id));
|
||||
|
||||
$offset = 0;
|
||||
foreach ($rows as &$row) {
|
||||
|
@ -291,9 +290,9 @@ SQL;
|
|||
{
|
||||
$sql = "SELECT bl.id FROM cc_playlistcontents as pc
|
||||
JOIN cc_block as bl ON pc.type=2 AND pc.block_id=bl.id AND bl.type='dynamic'
|
||||
WHERE playlist_id={$this->id} AND pc.type=2";
|
||||
$r = $this->con->query($sql);
|
||||
$result = $r->fetchAll(PDO::FETCH_ASSOC);
|
||||
WHERE playlist_id=:playlist_id AND pc.type=2";
|
||||
|
||||
$result = Application_Common_Database::prepareAndExecute($sql, array(':playlist_id'=>$this->id));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -625,9 +624,8 @@ SQL;
|
|||
|
||||
if (!is_null($fadeIn)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :fadein > INTERVAL '{$clipLength}'";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':fadein'=>$fadeIn), 'column')) {
|
||||
//"Fade In can't be larger than overall playlength.";
|
||||
$fadeIn = $clipLength;
|
||||
}
|
||||
|
@ -635,9 +633,8 @@ SQL;
|
|||
}
|
||||
if (!is_null($fadeOut)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :fadeout > INTERVAL '{$clipLength}'";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':fadeout'=>$fadeOut), 'column')) {
|
||||
//Fade Out can't be larger than overall playlength.";
|
||||
$fadeOut = $clipLength;
|
||||
}
|
||||
|
@ -727,25 +724,22 @@ SQL;
|
|||
$cueOut = $origLength;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :cueIn > INTERVAL :cueOut";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':cueOut'=>$cueOut), 'column')) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :cueOut > INTERVAL :origLength";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) {
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$sql = "SELECT INTERVAL :cueOut - INTERVAL :cueIn";
|
||||
$cliplength = Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':cueIn'=>$cueIn), 'column');
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDbCueout($cueOut);
|
||||
|
@ -753,17 +747,15 @@ SQL;
|
|||
|
||||
} elseif (!is_null($cueIn)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :cueIn > INTERVAL :oldCueOut";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut), 'column')) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$sql = "SELECT INTERVAL :oldCueOut - INTERVAL :cueIn";
|
||||
$cliplength = Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut, 'column'));
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDBCliplength($cliplength);
|
||||
|
@ -773,25 +765,22 @@ SQL;
|
|||
$cueOut = $origLength;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :cueOut < INTERVAL :oldCueIn";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn, 'column'))) {
|
||||
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :cueOut > INTERVAL :origLength";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength, 'column'))) {
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
||||
$r = $this->con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$sql = "SELECT INTERVAL :cueOut - INTERVAL :oldCueIn";
|
||||
$cliplength = Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn, 'column'));
|
||||
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
|
@ -799,16 +788,14 @@ SQL;
|
|||
|
||||
$cliplength = $row->getDbCliplength();
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :fadeIn > INTERVAL :cliplength";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':fadeIn'=>$fadeIn, ':cliplength'=>$cliplength, 'column'))) {
|
||||
$fadeIn = $cliplength;
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$sql = "SELECT INTERVAL :fadeOut > INTERVAL :cliplength";
|
||||
if (Application_Common_Database::prepareAndExecute($sql, array(':fadeOut'=>$fadeOut, ':cliplength'=>$cliplength, 'column'))) {
|
||||
$fadeOut = $cliplength;
|
||||
$row->setDbFadein($fadeOut);
|
||||
}
|
||||
|
|
|
@ -18,48 +18,57 @@ class Application_Model_Preference
|
|||
|
||||
//Check if key already exists
|
||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||
." WHERE keystr = '$key'";
|
||||
|
||||
." WHERE keystr = :key";
|
||||
|
||||
$paramMap = array();
|
||||
$paramMap[':key'] = $key;
|
||||
|
||||
//For user specific preference, check if id matches as well
|
||||
if ($isUserValue) {
|
||||
$sql .= " AND subjid = '$id'";
|
||||
$sql .= " AND subjid = :id";
|
||||
$paramMap[':id'] = $id;
|
||||
}
|
||||
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, 'column');
|
||||
|
||||
if ($value == "") {
|
||||
$value = "NULL";
|
||||
} else {
|
||||
$value = "'$value'";
|
||||
$value = "$value";
|
||||
}
|
||||
|
||||
$paramMap = array();
|
||||
if ($result == 1) {
|
||||
// result found
|
||||
if (is_null($id) || !$isUserValue) {
|
||||
// system pref
|
||||
$sql = "UPDATE cc_pref"
|
||||
." SET subjid = NULL, valstr = $value"
|
||||
." WHERE keystr = '$key'";
|
||||
." SET subjid = NULL, valstr = :value"
|
||||
." WHERE keystr = :key";
|
||||
} else {
|
||||
// user pref
|
||||
$sql = "UPDATE cc_pref"
|
||||
. " SET valstr = $value"
|
||||
. " WHERE keystr = '$key' AND subjid = $id";
|
||||
. " SET valstr = :value"
|
||||
. " WHERE keystr = :key AND subjid = :id";
|
||||
$paramMap[':id'] = $id;
|
||||
}
|
||||
} else {
|
||||
// result not found
|
||||
if (is_null($id) || !$isUserValue) {
|
||||
// system pref
|
||||
$sql = "INSERT INTO cc_pref (keystr, valstr)"
|
||||
." VALUES ('$key', $value)";
|
||||
." VALUES (:key, :value)";
|
||||
} else {
|
||||
// user pref
|
||||
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
||||
." VALUES ($id, '$key', $value)";
|
||||
." VALUES (:id, :key, :value)";
|
||||
$paramMap[':id'] = $id;
|
||||
}
|
||||
}
|
||||
$paramMap[':key'] = $key;
|
||||
$paramMap[':value'] = $value;
|
||||
|
||||
$con->exec($sql);
|
||||
Application_Common_Database::prepareAndExecute($sql, $paramMap, 'execute');
|
||||
|
||||
} catch (Exception $e) {
|
||||
header('HTTP/1.0 503 Service Unavailable');
|
||||
|
@ -77,28 +86,39 @@ class Application_Model_Preference
|
|||
//Check if key already exists
|
||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||
." WHERE keystr = '$key'";
|
||||
/*." WHERE keystr = :key";
|
||||
$paramMap = array();
|
||||
$paramMap[':key'] = $key;*/
|
||||
//For user specific preference, check if id matches as well
|
||||
if ($isUserValue) {
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$id = $auth->getIdentity()->id;
|
||||
$sql .= " AND subjid = '$id'";
|
||||
/*$sql .= " AND subjid = :id";
|
||||
$paramMap[':id'] = $id;*/
|
||||
}
|
||||
}
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
//$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, 'column');
|
||||
if ($result == 0)
|
||||
|
||||
return "";
|
||||
else {
|
||||
$sql = "SELECT valstr FROM cc_pref"
|
||||
." WHERE keystr = '$key'";
|
||||
/*." WHERE keystr = :key";
|
||||
$paramMap = array();
|
||||
$paramMap[':key'] = $key;*/
|
||||
|
||||
//For user specific preference, check if id matches as well
|
||||
if ($isUserValue && $auth->hasIdentity()) {
|
||||
$sql .= " AND subjid = '$id'";
|
||||
/*$sql .= " AND subjid = :id";
|
||||
$paramMap[':id'] = $id;*/
|
||||
}
|
||||
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
//$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, 'column');
|
||||
|
||||
return ($result !== false) ? $result : "";
|
||||
}
|
||||
|
|
|
@ -10,10 +10,9 @@ class Application_Model_Schedule
|
|||
public function IsFileScheduledInTheFuture($p_fileId)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"]
|
||||
." WHERE file_id = {$p_fileId} AND ends > NOW() AT TIME ZONE 'UTC'";
|
||||
$count = $con->query($sql)->fetchColumn(0);
|
||||
." WHERE file_id = :file_id AND ends > NOW() AT TIME ZONE 'UTC'";
|
||||
$count = Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$p_fileId), 'column');
|
||||
|
||||
return (is_numeric($count) && ($count != '0'));
|
||||
}
|
||||
|
@ -88,14 +87,18 @@ class Application_Model_Schedule
|
|||
LEFT JOIN (SELECT * FROM cc_webstream_metadata ORDER BY start_time DESC LIMIT 1) AS wm on st.id = wm.instance_id";
|
||||
|
||||
$predicateArr = array();
|
||||
$paramMap = array();
|
||||
if (isset($p_previousShowID)) {
|
||||
$predicateArr[] = 'st.instance_id = '.$p_previousShowID;
|
||||
$predicateArr[] = 'st.instance_id = :previousShowId';
|
||||
$paramMap[':previousShowId'] = $p_previousShowID;
|
||||
}
|
||||
if (isset($p_currentShowID)) {
|
||||
$predicateArr[] = 'st.instance_id = '.$p_currentShowID;
|
||||
$predicateArr[] = 'st.instance_id = :currentShowId';
|
||||
$paramMap[':currentShowId'] = $p_currentShowID;
|
||||
}
|
||||
if (isset($p_nextShowID)) {
|
||||
$predicateArr[] = 'st.instance_id = '.$p_nextShowID;
|
||||
$predicateArr[] = 'st.instance_id = :nextShowId';
|
||||
$paramMap[':nextShowId'] = $p_nextShowID;
|
||||
}
|
||||
|
||||
$sql .= " (".implode(" OR ", $predicateArr).") ";
|
||||
|
@ -109,7 +112,7 @@ class Application_Model_Schedule
|
|||
|
||||
$sql = "SELECT * FROM (($filesSql) UNION ($streamSql)) AS unioned ORDER BY starts";
|
||||
|
||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||
$rows = Application_Common_Database::prepareAndExecute($sql, $paramMap);
|
||||
$numberOfRows = count($rows);
|
||||
|
||||
$results['previous'] = null;
|
||||
|
@ -169,7 +172,6 @@ class Application_Model_Schedule
|
|||
public static function GetLastScheduleItem($p_timeNow)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT"
|
||||
." ft.artist_name, ft.track_title,"
|
||||
." st.starts as starts, st.ends as ends"
|
||||
|
@ -178,13 +180,13 @@ class Application_Model_Schedule
|
|||
." ON st.file_id = ft.id"
|
||||
." LEFT JOIN $CC_CONFIG[showInstances] sit"
|
||||
." ON st.instance_id = sit.id"
|
||||
." WHERE st.ends < TIMESTAMP '$p_timeNow'"
|
||||
." WHERE st.ends < TIMESTAMP :timeNow"
|
||||
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
|
||||
." AND st.starts < sit.ends"
|
||||
." ORDER BY st.ends DESC"
|
||||
." LIMIT 1";
|
||||
|
||||
$row = $con->query($sql)->fetchAll();
|
||||
$row = Application_Common_Database::prepareAndExecute($sql, array(':timeNow'=>$p_timeNow));
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
@ -192,7 +194,6 @@ class Application_Model_Schedule
|
|||
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
/* Note that usually there will be one result returned. In some
|
||||
* rare cases two songs are returned. This happens when a track
|
||||
* that was overbooked from a previous show appears as if it
|
||||
|
@ -204,13 +205,13 @@ class Application_Model_Schedule
|
|||
." FROM $CC_CONFIG[scheduleTable] st"
|
||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||
." ON st.file_id = ft.id"
|
||||
." WHERE st.starts <= TIMESTAMP '$p_timeNow'"
|
||||
." AND st.instance_id = $p_instanceId"
|
||||
." AND st.ends > TIMESTAMP '$p_timeNow'"
|
||||
." WHERE st.starts <= TIMESTAMP :timeNow1"
|
||||
." AND st.instance_id = :instanceId"
|
||||
." AND st.ends > TIMESTAMP :timeNow2"
|
||||
." ORDER BY st.starts DESC"
|
||||
." LIMIT 1";
|
||||
|
||||
$row = $con->query($sql)->fetchAll();
|
||||
$row = Application_Common_Database::prepareAndExecute($sql, array(':timeNow1'=>$p_timeNow, ':instanceId'=>$p_instanceId, ':timeNow2'=>$p_timeNow,));
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
@ -218,7 +219,6 @@ class Application_Model_Schedule
|
|||
public static function GetNextScheduleItem($p_timeNow)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT"
|
||||
." ft.artist_name, ft.track_title,"
|
||||
." st.starts as starts, st.ends as ends"
|
||||
|
@ -227,13 +227,13 @@ class Application_Model_Schedule
|
|||
." ON st.file_id = ft.id"
|
||||
." LEFT JOIN $CC_CONFIG[showInstances] sit"
|
||||
." ON st.instance_id = sit.id"
|
||||
." WHERE st.starts > TIMESTAMP '$p_timeNow'"
|
||||
." WHERE st.starts > TIMESTAMP :timeNow"
|
||||
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
|
||||
." AND st.starts < sit.ends"
|
||||
." ORDER BY st.starts"
|
||||
." LIMIT 1";
|
||||
|
||||
$row = $con->query($sql)->fetchAll();
|
||||
$row = Application_Common_Database::prepareAndExecute($sql, array(':timeNow'=>$p_timeNow));
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
@ -514,7 +514,6 @@ SQL;
|
|||
public static function GetItems($p_startTime, $p_endTime)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$baseQuery = "SELECT st.file_id AS file_id,"
|
||||
." st.id AS id,"
|
||||
|
@ -540,15 +539,15 @@ SQL;
|
|||
." LEFT JOIN cc_webstream AS ws"
|
||||
." ON st.stream_id = ws.id";
|
||||
|
||||
$predicates = " WHERE st.ends > '$p_startTime'"
|
||||
." AND st.starts < '$p_endTime'"
|
||||
$predicates = " WHERE st.ends > :startTime1"
|
||||
." AND st.starts < :endTime"
|
||||
." AND st.playout_status > 0"
|
||||
." AND si.ends > '$p_startTime'"
|
||||
." AND si.ends > :startTime2"
|
||||
." ORDER BY st.starts";
|
||||
|
||||
$sql = $baseQuery.$predicates;
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
$rows = Application_Common_Database::prepareAndExecute($sql, array(':startTime1'=>$p_startTime, ':endTime'=>$p_endTime, ':startTime2'=>$p_startTime));
|
||||
|
||||
if (count($rows) < 3) {
|
||||
Logging::debug("Get Schedule: Less than 3 results returned. Doing another query since we need a minimum of 3 results.");
|
||||
|
@ -557,15 +556,15 @@ SQL;
|
|||
$dt->add(new DateInterval("PT24H"));
|
||||
$range_end = $dt->format("Y-m-d H:i:s");
|
||||
|
||||
$predicates = " WHERE st.ends > '$p_startTime'"
|
||||
." AND st.starts < '$range_end'"
|
||||
$predicates = " WHERE st.ends > :startTime1"
|
||||
." AND st.starts < :rangeEnd"
|
||||
." AND st.playout_status > 0"
|
||||
." AND si.ends > '$p_startTime'"
|
||||
." AND si.ends > :startTime2"
|
||||
." ORDER BY st.starts"
|
||||
." LIMIT 3";
|
||||
|
||||
$sql = $baseQuery.$predicates;
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
$rows = Application_Common_Database::prepareAndExecute($sql, array(':startTime1'=>$p_startTime, ':rangeEnd'=>$range_end, ':startTime2'=>$p_startTime));
|
||||
}
|
||||
|
||||
return $rows;
|
||||
|
@ -748,9 +747,8 @@ SQL;
|
|||
public static function deleteWithFileId($fileId)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=$fileId";
|
||||
$res = $con->query($sql);
|
||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=:file_id";
|
||||
$res = Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute');
|
||||
}
|
||||
|
||||
public static function createNewFormSections($p_view)
|
||||
|
@ -861,12 +859,12 @@ SQL;
|
|||
$formStyle->disable();
|
||||
//$formLive->disable();
|
||||
|
||||
$controller->view->what = $formWhat;
|
||||
$controller->view->when = $formWhen;
|
||||
$controller->view->what = $formWhat;
|
||||
$controller->view->when = $formWhen;
|
||||
$controller->view->repeats = $formRepeats;
|
||||
$controller->view->who = $formWho;
|
||||
$controller->view->style = $formStyle;
|
||||
$controller->view->live = $formLive;
|
||||
$controller->view->who = $formWho;
|
||||
$controller->view->style = $formStyle;
|
||||
$controller->view->live = $formLive;
|
||||
if (!$isSaas) {
|
||||
$controller->view->rr = $formRecord;
|
||||
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
|
@ -1091,7 +1089,7 @@ SQL;
|
|||
and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days')
|
||||
and modified_instance = false order by ends";
|
||||
|
||||
$stmt = $con->prepare("SELECT id, starts, ends FROM
|
||||
$stmt = $con->prepare("SELECT id, starts, ends FROM
|
||||
{$CC_CONFIG['showInstances']}
|
||||
where (ends <= :show_end1 or starts <= :show_end2)
|
||||
and date(starts) >= (date(:show_end3) - INTERVAL '2 days')
|
||||
|
|
|
@ -803,12 +803,19 @@ SQL;
|
|||
':add_show_id' => $p_data['add_show_id']
|
||||
));
|
||||
|
||||
$sql = "UPDATE cc_show_instances "
|
||||
."SET ends = starts + INTERVAL '$p_data[add_show_duration]' "
|
||||
."WHERE show_id = $p_data[add_show_id] "
|
||||
."AND ends > TIMESTAMP '$timestamp'";
|
||||
$con->exec($sql);
|
||||
|
||||
$sql = <<<SQL
|
||||
UPDATE cc_show_instances
|
||||
SET ends = starts + :add_show_duration::INTERVAL
|
||||
WHERE show_id = :show_id
|
||||
AND ends > :timestamp::TIMESTAMP
|
||||
SQL;
|
||||
|
||||
|
||||
Application_Common_Database::prepareAndExecute( $sql, array(
|
||||
':add_show_duration' => $p_data['add_show_duration'],
|
||||
':show_id' => $p_data['add_show_id'],
|
||||
':timestamp' => $timestamp), "execute");
|
||||
}
|
||||
|
||||
private function updateStartDateTime($p_data, $p_endDate)
|
||||
|
|
|
@ -35,7 +35,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"sample_rate" : "n",
|
||||
"track_title" : "s",
|
||||
"track_num" : "n",
|
||||
"year" : "n"
|
||||
"year" : "n",
|
||||
"owner" : "s"
|
||||
};
|
||||
|
||||
if (AIRTIME.library === undefined) {
|
||||
|
|
Loading…
Reference in New Issue