Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
ac74ca2449
20 changed files with 128 additions and 71 deletions
|
@ -491,11 +491,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
'add_show_genre' => $show->getGenre(),
|
||||
'add_show_description' => $show->getDescription()));
|
||||
|
||||
$startsDateTime = new DateTime($show->getStartDate()." ".$show->getStartTime(), new DateTimeZone(date_default_timezone_get()));
|
||||
$endsDateTime = new DateTime($show->getEndDate()." ".$show->getEndTime(), new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
//$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
//$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$startsDateTime = new DateTime($show->getStartDate()." ".$show->getStartTime(), new DateTimeZone("UTC"));
|
||||
$endsDateTime = new DateTime($show->getEndDate()." ".$show->getEndTime(), new DateTimeZone("UTC"));
|
||||
|
||||
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
$formWhen->populate(array('add_show_start_date' => $startsDateTime->format("Y-m-d"),
|
||||
'add_show_start_time' => $startsDateTime->format("H:i"),
|
||||
|
@ -595,12 +595,14 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$show = new Application_Model_Show($data['add_show_id']);
|
||||
|
||||
$startDateModified = true;
|
||||
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
|
||||
//show is being updated and changing the start date was disabled, since the
|
||||
//array key does not exist. We need to repopulate this entry from the db.
|
||||
$data['add_show_start_date'] = $show->getStartDate();
|
||||
$startDateModified = false;
|
||||
}
|
||||
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
|
||||
//show is being updated and changing the start date was disabled, since the
|
||||
//array key does not exist. We need to repopulate this entry from the db.
|
||||
//The start date will be return in UTC time, so lets convert it to local time.
|
||||
$dt = Application_Model_DateHelper::ConvertToLocalDateTime($show->getStartDate());
|
||||
$data['add_show_start_date'] = $dt->format("Y-m-d");
|
||||
$startDateModified = false;
|
||||
}
|
||||
|
||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
$data['add_show_day_check'] = $this->_getParam('days');
|
||||
|
|
|
@ -448,7 +448,7 @@ class Application_Model_Show {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the start date of the current show.
|
||||
* Get the start date of the current show in UTC timezone.
|
||||
*
|
||||
* @return string
|
||||
* The start date in the format YYYY-MM-DD
|
||||
|
@ -457,38 +457,49 @@ class Application_Model_Show {
|
|||
global $CC_DBC;
|
||||
|
||||
$showId = $this->getId();
|
||||
$sql = "SELECT first_show FROM cc_show_days"
|
||||
$sql = "SELECT first_show, start_time, timezone FROM cc_show_days"
|
||||
." WHERE show_id = $showId"
|
||||
." ORDER BY first_show";
|
||||
." ORDER BY first_show"
|
||||
." LIMIT 1";
|
||||
|
||||
$firstDate = $CC_DBC->GetOne($sql);
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
|
||||
if (is_null($firstDate)){
|
||||
if (count($rows) == 0){
|
||||
return "";
|
||||
} else {
|
||||
return $firstDate;
|
||||
$row = $rows[0];
|
||||
|
||||
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
|
||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||
return $dt->format("Y-m-d");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the start time of the current show.
|
||||
* Get the start time of the current show in UTC timezone.
|
||||
*
|
||||
* @return string
|
||||
* The start time in the format HH:MM:SS
|
||||
* The start time in the format HH:MM
|
||||
*/
|
||||
|
||||
public function getStartTime(){
|
||||
global $CC_DBC;
|
||||
|
||||
$showId = $this->getId();
|
||||
$sql = "SELECT start_time FROM cc_show_days"
|
||||
." WHERE show_id = $showId";
|
||||
$sql = "SELECT first_show, start_time, timezone FROM cc_show_days"
|
||||
." WHERE show_id = $showId"
|
||||
." ORDER BY first_show"
|
||||
." LIMIT 1";
|
||||
|
||||
$startTime = $CC_DBC->GetOne($sql);
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
|
||||
if (is_null($startTime)){
|
||||
if (count($rows) == 0){
|
||||
return "";
|
||||
} else {
|
||||
return $startTime;
|
||||
$row = $rows[0];
|
||||
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
|
||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||
return $dt->format("H:i");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,7 +551,7 @@ class Application_Model_Show {
|
|||
*/
|
||||
public function isStartDateTimeInPast(){
|
||||
$date = new Application_Model_DateHelper;
|
||||
$current_timestamp = $date->getTimestamp();
|
||||
$current_timestamp = $date->getUtcTimestamp();
|
||||
return ($current_timestamp > ($this->getStartDate()." ".$this->getStartTime()));
|
||||
}
|
||||
|
||||
|
@ -619,9 +630,9 @@ class Application_Model_Show {
|
|||
$sql .= "WHERE show_id = $p_data[add_show_id]";
|
||||
$CC_DBC->query($sql);
|
||||
|
||||
$oldStartDateTimeEpoch = strtotime($this->getStartDate()." ".$this->getStartTime());
|
||||
$newStartDateTimeEpoch = strtotime($p_data['add_show_start_date']." ".$p_data['add_show_start_time']);
|
||||
$diff = $newStartDateTimeEpoch - $oldStartDateTimeEpoch;
|
||||
$dtOld = new DateTime($this->getStartDate()." ".$this->getStartTime(), new DateTimeZone("UTC"));
|
||||
$dtNew = new DateTime($p_data['add_show_start_date']." ".$p_data['add_show_start_time'], new DateTimeZone(date_default_timezone_get()));
|
||||
$diff = $dtOld->getTimestamp() - $dtNew->getTimestamp();
|
||||
|
||||
$sql = "UPDATE cc_show_instances "
|
||||
."SET starts = starts + INTERVAL '$diff sec', "
|
||||
|
|
|
@ -2,9 +2,13 @@
|
|||
<h1>Live stream</h1>
|
||||
<?php $ids = Application_Model_StreamSetting::getEnabledStreamIds(); ?>
|
||||
<script>
|
||||
function setjPlayer(url, type){
|
||||
function setjPlayer(url, type, serverType){
|
||||
var obj = new Object();
|
||||
obj[type] = url;
|
||||
|
||||
if(serverType == 'shoutcast'){
|
||||
obj[type] = url + ";stream/1";
|
||||
}
|
||||
|
||||
$("#jquery_jplayer_1").jPlayer("destroy");
|
||||
$("#jquery_jplayer_1").jPlayer({
|
||||
|
@ -14,7 +18,7 @@ function setjPlayer(url, type){
|
|||
ended: function (event) {
|
||||
$(this).jPlayer("play");
|
||||
},
|
||||
swfPath: "js",
|
||||
swfPath: "/js/jplayer/",
|
||||
supplied: type,
|
||||
wmode: "window"
|
||||
});
|
||||
|
@ -26,7 +30,7 @@ $(document).ready(function(){
|
|||
var elem = $("#combo-box option:selected");
|
||||
console.log(elem);
|
||||
|
||||
setjPlayer(elem.attr("data-url"), elem.attr("data-type"));
|
||||
setjPlayer(elem.attr("data-url"), elem.attr("data-type"), elem.attr("server-type"));
|
||||
});
|
||||
|
||||
<?php
|
||||
|
@ -35,9 +39,10 @@ $(document).ready(function(){
|
|||
$streamData = Application_Model_StreamSetting::getStreamData($id);
|
||||
$url = "http://".$streamData["${id}_host"].":".$streamData["${id}_port"]."/".$streamData["${id}_mount"];
|
||||
$type = $streamData["${id}_type"];
|
||||
$serverType = $streamData["${id}_output"];
|
||||
if ($type == "ogg")
|
||||
$type = "oga";
|
||||
echo "setjPlayer('$url', '$type');";
|
||||
echo "setjPlayer('$url', '$type', '$serverType');";
|
||||
}
|
||||
?>
|
||||
});
|
||||
|
@ -53,11 +58,12 @@ $(document).ready(function(){
|
|||
$streamData = Application_Model_StreamSetting::getStreamData($id);
|
||||
$url = "http://".$streamData["${id}_host"].":".$streamData["${id}_port"]."/".$streamData["${id}_mount"];
|
||||
$type = $streamData["${id}_type"];
|
||||
$serverType = $streamData["${id}_output"];
|
||||
if ($type == "ogg")
|
||||
$type = "oga";
|
||||
|
||||
$label = $streamData["${id}_description"]." (".$streamData["${id}_bitrate"]." Kbit/s)";
|
||||
echo sprintf("<option class='stream' value='%s' data-url='%s' data-type='%s'>%s</option>", $id, $url, $type, $label);
|
||||
echo sprintf("<option class='stream' value='%s' data-url='%s' data-type='%s' server-type='%s'>%s</option>", $id, $url, $type, $serverType, $label);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
|
@ -345,7 +345,7 @@ function setAddShowEvents() {
|
|||
var endTime = $('#add_show_end_time').val().split(':');
|
||||
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||
|
||||
if(startDateTime.getTime() > endDateTime.getTime()){
|
||||
if(startDateTime.getTime() >= endDateTime.getTime()){
|
||||
var duration = $('#add_show_duration').val();
|
||||
// parse duration
|
||||
var time = 0;
|
||||
|
|
|
@ -399,7 +399,9 @@ function Calendar(element, options, eventSources) {
|
|||
elementOuterWidth = element.outerWidth();
|
||||
|
||||
header.updateTitle(currentView.title);
|
||||
var today = new Date();
|
||||
//adjusting this date ensures that the "today" button is greyed out on the
|
||||
//correct day.
|
||||
var today = adjustDateToServerDate(new Date(), options["serverTimezoneOffset"]);
|
||||
if (today >= currentView.start && today < currentView.end) {
|
||||
header.disableButton('today');
|
||||
}else{
|
||||
|
@ -581,7 +583,8 @@ function Calendar(element, options, eventSources) {
|
|||
|
||||
|
||||
function today() {
|
||||
date = new Date();
|
||||
//adjusting this date ensures that clicking "today" takes us to the correct date.
|
||||
date = adjustDateToServerDate(new Date(), options["serverTimezoneOffset"]);
|
||||
renderView();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue