Merge branch 'master' of dev.sourcefabric.org:campcaster

This commit is contained in:
naomiaro 2011-04-02 16:34:09 -04:00
commit 7be60fbf84
7 changed files with 49 additions and 14 deletions

View file

@ -93,6 +93,27 @@ class Application_Model_Nowplaying
return $data;
}
public static function HandleRebroadcastShows($rows){
$newCopy = array();
$numRows = count($rows);
for ($i=0; $i<$numRows; $i++){
$currentRow = $rows[$i];
if ($currentRow["rebroadcast"] == 1 && !array_key_exists("group", $currentRow)){
$newRow = $currentRow;
unset($newRow['group']);
$newRow['item_starts'] = $newRow['show_starts'];
$newRow['item_ends'] = $newRow['show_ends'];
array_push($newCopy, $newRow);
} else {
array_push($newCopy, $currentRow);
}
}
return $newCopy;
}
public static function GetDataGridData($viewType, $dateString){
if ($viewType == "now"){
@ -111,14 +132,13 @@ class Application_Model_Nowplaying
$endCutoff = $date->getNowDayEndDiff();
}
$rows = Show_DAL::GetShowsInRange($timeNow, $startCutoff, $endCutoff);
$rows = Application_Model_Nowplaying::FindBeginningOfShow($rows);
$rows = Application_Model_Nowplaying::HandleRebroadcastShows($rows);
$rows = Application_Model_Nowplaying::FindGapAtEndOfShow($rows);
//$rows = FindGapsBetweenShows
//$rows = FindGapsBetweenShows()
$data = Application_Model_Nowplaying::FilterRowsByDate($rows, $date, $startCutoff, $endCutoff);
$date = new Application_Model_DateHelper;
$timeNow = $date->getDate();
return array("currentShow"=>Show_DAL::GetCurrentShow($timeNow), "rows"=>$data);

View file

@ -274,7 +274,7 @@ class Show {
{
global $CC_DBC;
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name, description,
$sql = "SELECT starts, ends, record, rebroadcast, soundcloud_id, instance_id, show_id, name, description,
color, background_color, cc_show_instances.id AS instance_id
FROM cc_show_instances
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id";
@ -565,6 +565,7 @@ class Show {
$event["showId"] = $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"]);
foreach($options as $key=>$value) {
$event[$key] = $value;
@ -1013,6 +1014,7 @@ class Show_DAL {
$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,"