Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-09-04 16:00:26 -04:00
commit f698b70341
2 changed files with 70 additions and 63 deletions

View File

@ -356,9 +356,9 @@ SQL;
." SET media_item_played=TRUE";
// we need to update 'broadcasted' column as well
// check the current switch status
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'?true:false;
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'?true:false;
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on'?true:false;
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on';
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on';
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on';
if (!$live_dj && !$master_dj && $scheduled_play) {
$sql .= ", broadcasted=1";

View File

@ -475,10 +475,9 @@ class Application_Model_Show
->filterByDbShowId($this->_showId)
->findOne();
if (!is_null($showDaysRow)) {
if (!is_null($showDaysRow))
return $showDaysRow->getDbRepeatType();
} else
else
return -1;
}
@ -607,24 +606,30 @@ class Application_Model_Show
* Get the start date of the current show in UTC timezone.
*
* @return string
* The start date in the format YYYY-MM-DD
* The start date in the format YYYY-MM-DD or empty string in case
* start date could not be found
*/
public function getStartDateAndTime()
{
$con = Propel::getConnection();
$showId = $this->getId();
$sql = "SELECT first_show, start_time, timezone FROM cc_show_days"
." WHERE show_id = $showId"
$stmt = $con->prepare(
"SELECT first_show, start_time, timezone FROM cc_show_days"
." WHERE show_id = :showId"
." ORDER BY first_show"
." LIMIT 1";
." LIMIT 1");
$query = $con->query($sql);
$stmt->bindParam(':showId', $showId);
$stmt->execute();
if ($query->rowCount() == 0) {
//$query = $con->query($sql);
if (!$stmt) {
return "";
} else {
$rows = $query->fetchAll();
}
$rows = $stmt->fetchAll();
$row = $rows[0];
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
@ -632,7 +637,6 @@ class Application_Model_Show
return $dt->format("Y-m-d H:i");
}
}
/**
* Get the start date of the current show in UTC timezone.
@ -1064,8 +1068,8 @@ class Application_Model_Show
$ccShow->setDbGenre($data['add_show_genre']);
$ccShow->setDbColor($data['add_show_color']);
$ccShow->setDbBackgroundColor($data['add_show_background_color']);
$ccShow->setDbLiveStreamUsingAirtimeAuth($data['cb_airtime_auth'] == 1?true:false);
$ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1?true:false);
$ccShow->setDbLiveStreamUsingAirtimeAuth($data['cb_airtime_auth'] == 1);
$ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1);
$ccShow->setDbLiveStreamUser($data['custom_username']);
$ccShow->setDbLiveStreamPass($data['custom_password']);
$ccShow->save();
@ -1250,6 +1254,8 @@ class Application_Model_Show
*/
private static function populateShow($p_showDaysRow, $p_populateUntilDateTime)
{
// TODO : use constants instead of int values here? or maybe php will
// get enum types by the time somebody gets around to fix this. -- RG
if ($p_showDaysRow["repeat_type"] == -1) {
Application_Model_Show::populateNonRepeatingShow($p_showDaysRow, $p_populateUntilDateTime);
} elseif ($p_showDaysRow["repeat_type"] == 0) {
@ -1740,7 +1746,8 @@ class Application_Model_Show
$event["showId"] = intval($show["show_id"]);
$event["record"] = intval($show["record"]);
$event["rebroadcast"] = intval($show["rebroadcast"]);
$event["soundcloud_id"] = is_null($show["soundcloud_id"]) ? -1 : $show["soundcloud_id"];
$event["soundcloud_id"] = is_null($show["soundcloud_id"])
? -1 : $show["soundcloud_id"];
//event colouring
if ($show["color"] != "") {