123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?php
- class Application_Model_Dashboard
- {
- public static function GetPreviousItem($p_timeNow)
- {
-
-
-
-
- $showInstance = Application_Model_ShowInstance::GetLastShowInstance($p_timeNow);
- $row = Application_Model_Schedule::GetLastScheduleItem($p_timeNow);
- if (is_null($showInstance)) {
- if (count($row) == 0) {
- return null;
- } else {
- return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
- "starts"=>$row[0]["starts"],
- "ends"=>$row[0]["ends"]);
- }
- } else {
- if (count($row) == 0) {
- if ($showInstance->isRecorded()) {
-
- return array("name"=>$showInstance->getName(),
- "starts"=>$showInstance->getShowInstanceStart(),
- "ends"=>$showInstance->getShowInstanceEnd());
- } else {
- return null;
- }
- } else {
-
- 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->getShowInstanceStart(),
- "ends"=>$showInstance->getShowInstanceEnd());
- }
- }
- }
- }
- public static function GetCurrentItem($p_timeNow)
- {
-
-
-
-
- $row = array();
- $showInstance = Application_Model_ShowInstance::GetCurrentShowInstance($p_timeNow);
- if (!is_null($showInstance)) {
- $instanceId = $showInstance->getShowInstanceId();
- $row = Application_Model_Schedule::GetCurrentScheduleItem($p_timeNow, $instanceId);
- }
- if (is_null($showInstance)) {
- if (count($row) == 0) {
- return null;
- } else {
-
- return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
- "starts"=>$row[0]["starts"],
- "ends"=>$row[0]["ends"]);
- }
- } else {
- if (count($row) == 0) {
-
- if ($showInstance->isRecorded()) {
- return array("name"=>$showInstance->getName(),
- "starts"=>$showInstance->getShowInstanceStart(),
- "ends"=>$showInstance->getShowInstanceEnd(),
- "media_item_played"=>false,
- "record"=>true);
- } else {
- return null;
- }
- } else {
- return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
- "starts"=>$row[0]["starts"],
- "ends"=>$row[0]["ends"],
- "media_item_played"=>$row[0]["media_item_played"],
- "record"=>0);
- }
- }
- }
- public static function GetNextItem($p_timeNow)
- {
-
-
-
-
- $showInstance = Application_Model_ShowInstance::GetNextShowInstance($p_timeNow);
- $row = Application_Model_Schedule::GetNextScheduleItem($p_timeNow);
- if (is_null($showInstance)) {
- if (count($row) == 0) {
- return null;
- } else {
- return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
- "starts"=>$row[0]["starts"],
- "ends"=>$row[0]["ends"]);
- }
- } else {
- if (count($row) == 0) {
- if ($showInstance->isRecorded()) {
-
- return array("name"=>$showInstance->getName(),
- "starts"=>$showInstance->getShowInstanceStart(),
- "ends"=>$showInstance->getShowInstanceEnd());
- } else {
- return null;
- }
- } else {
-
- 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->getShowInstanceStart(),
- "ends"=>$showInstance->getShowInstanceEnd());
- }
- }
- }
- }
- }
|