-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

@ -415,7 +415,7 @@ class ApiController extends Zend_Controller_Action
$show_inst->setRecordedFile($file_id); $show_inst->setRecordedFile($file_id);
$show_name = $show_inst->getName(); $show_name = $show_inst->getName();
$show_genre = $show_inst->getGenre(); $show_genre = $show_inst->getGenre();
$show_start_time = ConvertToLocalDateTimeString($show_inst->getShowStart()); $show_start_time = ConvertToLocalDateTimeString($show_inst->getShowInstanceStart());
} catch (Exception $e){ } catch (Exception $e){
//we've reached here probably because the show was //we've reached here probably because the show was

View File

@ -182,8 +182,8 @@ class ScheduleController extends Zend_Controller_Action
$params = '/format/json/id/#id#'; $params = '/format/json/id/#id#';
$showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowStart()); $showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceStart());
$showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowEnd()); $showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceEnd());
$menu = array(); $menu = array();
@ -356,8 +356,8 @@ class ScheduleController extends Zend_Controller_Action
return false; return false;
} }
$start_timestamp = $show->getShowStart(); $start_timestamp = $show->getShowInstanceStart();
$end_timestamp = $show->getShowEnd(); $end_timestamp = $show->getShowInstanceEnd();
//check to make sure show doesn't overlap. //check to make sure show doesn't overlap.
if(Application_Model_Show::getShows(new DateTime($start_timestamp, new DateTimeZone("UTC")), if(Application_Model_Show::getShows(new DateTime($start_timestamp, new DateTimeZone("UTC")),
@ -409,7 +409,7 @@ class ScheduleController extends Zend_Controller_Action
return false; return false;
} }
$originalShowName = $originalShow->getName(); $originalShowName = $originalShow->getName();
$originalShowStart = $originalShow->getShowStart(); $originalShowStart = $originalShow->getShowInstanceStart();
$timestamp = strtotime($originalShowStart); $timestamp = strtotime($originalShowStart);
$this->view->additionalShowInfo = $this->view->additionalShowInfo =
@ -466,8 +466,8 @@ class ScheduleController extends Zend_Controller_Action
'add_show_genre' => $show->getGenre(), 'add_show_genre' => $show->getGenre(),
'add_show_description' => $show->getDescription())); 'add_show_description' => $show->getDescription()));
$startsDateTime = new DateTime($showInstance->getShowStart(), new DateTimeZone("UTC")); $startsDateTime = new DateTime($showInstance->getShowInstanceStart(), new DateTimeZone("UTC"));
$endsDateTime = new DateTime($showInstance->getShowEnd(), new DateTimeZone("UTC")); $endsDateTime = new DateTime($showInstance->getShowInstanceEnd(), new DateTimeZone("UTC"));
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); $startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); $endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
@ -761,7 +761,7 @@ class ScheduleController extends Zend_Controller_Action
} }
$show = new Application_Model_Show($showInstance->getShowId()); $show = new Application_Model_Show($showInstance->getShowId());
$show->cancelShow($showInstance->getShowStart()); $show->cancelShow($showInstance->getShowInstanceStart());
} }
} }

View File

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

View File

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