-better naming of show instance functions

This commit is contained in:
Martin Konecny 2011-11-11 22:24:37 -05:00
parent 1c5b2dc813
commit f7fb6ddff0
5 changed files with 40 additions and 40 deletions

View file

@ -26,21 +26,21 @@ class Application_Model_Dashboard
if ($showInstance->isRecorded()){
//last item is a show instance
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd());
"starts"=>$showInstance->getShowInstanceStart(),
"ends"=>$showInstance->getShowInstanceEnd());
} else {
return null;
}
} else {
//return the one that started later.
if ($row[0]["starts"] >= $showInstance->getShowStart()){
if ($row[0]["starts"] >= $showInstance->getShowInstanceStart()){
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
"starts"=>$row[0]["starts"],
"ends"=>$row[0]["ends"]);
} else {
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd());
"starts"=>$showInstance->getShowInstanceStart(),
"ends"=>$showInstance->getShowInstanceEnd());
}
}
}
@ -75,8 +75,8 @@ class Application_Model_Dashboard
//last item is a show instance
if ($showInstance->isRecorded()){
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd(),
"starts"=>$showInstance->getShowInstanceStart(),
"ends"=>$showInstance->getShowInstanceEnd(),
"media_item_played"=>false,
"record"=>true);
} else {
@ -114,22 +114,22 @@ class Application_Model_Dashboard
if ($showInstance->isRecorded()){
//last item is a show instance
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd());
"starts"=>$showInstance->getShowInstanceStart(),
"ends"=>$showInstance->getShowInstanceEnd());
} else {
return null;
}
} else {
//return the one that starts sooner.
if ($row[0]["starts"] <= $showInstance->getShowStart()){
if ($row[0]["starts"] <= $showInstance->getShowInstanceStart()){
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
"starts"=>$row[0]["starts"],
"ends"=>$row[0]["ends"]);
} else {
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd());
"starts"=>$showInstance->getShowInstanceStart(),
"ends"=>$showInstance->getShowInstanceEnd());
}
}
}

View file

@ -81,8 +81,8 @@ class Application_Model_Nowplaying
$showId = $si->getShowId();
$show = new Application_Model_Show($showId);
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowStart());
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowEnd());
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceStart());
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceEnd());
//append show header row
$data[] = self::CreateHeaderRow($show->getName(), $showStartDateTime->format("Y-m-d H:i:s"), $showEndDateTime->format("Y-m-d H:i:s"));

View file

@ -56,7 +56,7 @@ class Application_Model_ShowInstance {
* @return string in format "Y-m-d H:i:s" (PHP time notation)
* TODO: make this function return a DateTime object instead.
*/
public function getShowStart()
public function getShowInstanceStart()
{
return $this->_showInstance->getDbStarts();
}
@ -66,21 +66,21 @@ class Application_Model_ShowInstance {
* @return string in format "Y-m-d H:i:s" (PHP time notation)
* TODO: make this function return a DateTime object instead.
*/
public function getShowEnd()
public function getShowInstanceEnd()
{
return $this->_showInstance->getDbEnds();
}
public function getStartDate()
{
$showStart = $this->getShowStart();
$showStart = $this->getShowInstanceStart();
$showStartExplode = explode(" ", $showStart);
return $showStartExplode[0];
}
public function getStartTime()
{
$showStart = $this->getShowStart();
$showStart = $this->getShowInstanceStart();
$showStartExplode = explode(" ", $showStart);
return $showStartExplode[1];
@ -150,7 +150,7 @@ class Application_Model_ShowInstance {
if (!is_null($scheduleStarts)){
$scheduleStartsEpoch = strtotime($scheduleStarts);
$showStartsEpoch = strtotime($this->getShowStart());
$showStartsEpoch = strtotime($this->getShowInstanceStart());
$diff = $showStartsEpoch - $scheduleStartsEpoch;
@ -183,8 +183,8 @@ class Application_Model_ShowInstance {
$mins = abs($deltaMin%60);
$today_timestamp = time();
$starts = $this->getShowStart();
$ends = $this->getShowEnd();
$starts = $this->getShowInstanceStart();
$ends = $this->getShowInstanceEnd();
$startsDateTime = new DateTime($starts, new DateTimeZone("UTC"));
@ -247,8 +247,8 @@ class Application_Model_ShowInstance {
$mins = abs($deltaMin%60);
$today_timestamp = date("Y-m-d H:i:s");
$starts = $this->getShowStart();
$ends = $this->getShowEnd();
$starts = $this->getShowInstanceStart();
$ends = $this->getShowInstanceEnd();
if(strtotime($today_timestamp) > strtotime($starts)) {
return "can't resize a past show";
@ -303,7 +303,7 @@ class Application_Model_ShowInstance {
$lastGroupId = $this->getLastGroupId();
if (is_null($lastGroupId)) {
$groupId = $sched->add($this->_instanceId, $this->getShowStart(), null, $plId);
$groupId = $sched->add($this->_instanceId, $this->getShowInstanceStart(), null, $plId);
}
else {
$groupId = $sched->addPlaylistAfter($this->_instanceId, $lastGroupId, $plId);
@ -323,7 +323,7 @@ class Application_Model_ShowInstance {
$lastGroupId = $this->getLastGroupId();
if (is_null($lastGroupId)) {
$groupId = $sched->add($this->_instanceId, $this->getShowStart(), $file_id);
$groupId = $sched->add($this->_instanceId, $this->getShowInstanceStart(), $file_id);
}
else {
$groupId = $sched->addFileAfter($this->_instanceId, $lastGroupId, $file_id);
@ -440,8 +440,8 @@ class Application_Model_ShowInstance {
public function getPercentScheduled()
{
$start_timestamp = $this->getShowStart();
$end_timestamp = $this->getShowEnd();
$start_timestamp = $this->getShowInstanceStart();
$end_timestamp = $this->getShowInstanceEnd();
$time_filled = $this->getTimeScheduled();
$s_epoch = strtotime($start_timestamp);
@ -460,8 +460,8 @@ class Application_Model_ShowInstance {
{
global $CC_DBC;
$start_timestamp = $this->getShowStart();
$end_timestamp = $this->getShowEnd();
$start_timestamp = $this->getShowInstanceStart();
$end_timestamp = $this->getShowInstanceEnd();
$sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}' ";
$length = $CC_DBC->GetOne($sql);
@ -596,11 +596,11 @@ class Application_Model_ShowInstance {
}
public function getShowEndGapTime(){
$showEnd = $this->getShowEnd();
$showEnd = $this->getShowInstanceEnd();
$lastItemEnd = $this->getLastAudioItemEnd();
if (is_null($lastItemEnd)){
$lastItemEnd = $this->getShowStart();
$lastItemEnd = $this->getShowInstanceStart();
}