public function getBootstrapInfoAction()
 {
     $live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
     $master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
     $scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
     $res = array("live_dj" => $live_dj, "master_dj" => $master_dj, "scheduled_play" => $scheduled_play);
     $this->view->switch_status = $res;
     $this->view->station_name = Application_Model_Preference::GetStationName();
     $this->view->stream_label = Application_Model_Preference::GetStreamLabelFormat();
     $this->view->transition_fade = Application_Model_Preference::GetDefaultTransitionFade();
 }
 public function getCurrentPlaylistAction()
 {
     $range = Application_Model_Schedule::GetPlayOrderRange();
     $show = Application_Model_Show::getCurrentShow();
     /* Convert all UTC times to localtime before sending back to user. */
     if (isset($range["previous"])) {
         $range["previous"]["starts"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["previous"]["starts"]);
         $range["previous"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["previous"]["ends"]);
     }
     if (isset($range["current"])) {
         $range["current"]["starts"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["current"]["starts"]);
         $range["current"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["current"]["ends"]);
     }
     if (isset($range["next"])) {
         $range["next"]["starts"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["next"]["starts"]);
         $range["next"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["next"]["ends"]);
     }
     Application_Model_Show::convertToLocalTimeZone($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
     Application_Model_Show::convertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
     $source_status = array();
     $switch_status = array();
     $live_dj = Application_Model_Preference::GetSourceStatus("live_dj");
     $master_dj = Application_Model_Preference::GetSourceStatus("master_dj");
     $scheduled_play_switch = Application_Model_Preference::GetSourceSwitchStatus("scheduled_play");
     $live_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("live_dj");
     $master_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("master_dj");
     //might not be the correct place to implement this but for now let's just do it here
     $source_status['live_dj_source'] = $live_dj;
     $source_status['master_dj_source'] = $master_dj;
     $this->view->source_status = $source_status;
     $switch_status['live_dj_source'] = $live_dj_switch;
     $switch_status['master_dj_source'] = $master_dj_switch;
     $switch_status['scheduled_play'] = $scheduled_play_switch;
     $this->view->switch_status = $switch_status;
     $this->view->entries = $range;
     $this->view->show_name = isset($show[0]) ? $show[0]["name"] : "";
 }
Exemple #3
0
 public static function UpdateMediaPlayedStatus($p_id)
 {
     global $CC_CONFIG;
     $con = Propel::getConnection();
     $sql = "UPDATE " . $CC_CONFIG['scheduleTable'] . " SET media_item_played=TRUE";
     // we need to update 'broadcasted' column as well
     // check the current switch status
     $live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on';
     $master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on';
     $scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on';
     if (!$live_dj && !$master_dj && $scheduled_play) {
         $sql .= ", broadcasted=1";
     }
     $sql .= " WHERE id={$p_id}";
     $retVal = $con->exec($sql);
     return $retVal;
 }
 public function SourceSwitchStatus()
 {
     $status = array("live_dj" => Application_Model_Preference::GetSourceSwitchStatus("live_dj"), "master_dj" => Application_Model_Preference::GetSourceSwitchStatus("master_dj"), "scheduled_play" => Application_Model_Preference::GetSourceSwitchStatus("scheduled_play"));
     return $status;
 }
Exemple #5
0
 public static function SetEndTime($state, $dateTime, $override = false)
 {
     try {
         $con = Propel::getConnection();
         $dj_live = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
         $master_live = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
         if ($dj_live == 'off' && $master_live == 'off' || $state == 'S' || $override) {
             $sql = "SELECT id, state from cc_live_log" . " where id in (select max(id) from cc_live_log)";
             $row = $con->query($sql)->fetch();
             /* Only set end time if state recevied ($state)
              * is the last row in cc_live_log
              */
             if ($row['state'] == $state) {
                 $update_sql = "UPDATE CC_LIVE_LOG" . " SET end_time = '{$dateTime->format("Y-m-d H:i:s")}'" . " WHERE id = '{$row['id']}'";
                 $con->exec($update_sql);
             }
             //If live broadcasting is off, turn scheduled play on
             $scheduled = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
             if ($state == 'L' && $scheduled == 'on' && !$override) {
                 self::SetNewLogTime('S', $dateTime);
             }
         }
     } catch (Exception $e) {
         header('HTTP/1.0 503 Service Unavailable');
         Logging::info("SetEndTime - Could not connect to database.");
         exit;
     }
 }
 public static function UpdateMediaPlayedStatus($p_id)
 {
     $sql = "UPDATE cc_schedule" . " SET media_item_played=TRUE";
     // we need to update 'broadcasted' column as well
     // check the current switch status
     $live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on';
     $master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on';
     $scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') == 'on';
     if (!$live_dj && !$master_dj && $scheduled_play) {
         $sql .= ", broadcasted=1";
     }
     $sql .= " WHERE id=:pid";
     $map = array(":pid" => $p_id);
     Application_Common_Database::prepareAndExecute($sql, $map, Application_Common_Database::EXECUTE);
 }
 public static function SetEndTime($state, $dateTime, $override = false)
 {
     try {
         $dj_live = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
         $master_live = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
         if ($dj_live == 'off' && $master_live == 'off' || $state == 'S' || $override) {
             $sql = "SELECT id, state from cc_live_log" . " where id in (select max(id) from cc_live_log)";
             $row = Application_Common_Database::prepareAndExecute($sql, array(), Application_Common_Database::SINGLE);
             /* Only set end time if state recevied ($state)
              * is the last row in cc_live_log
              */
             if ($row['state'] == $state) {
                 $update_sql = "UPDATE CC_LIVE_LOG" . " SET end_time = :end" . " WHERE id = :id";
                 $params = array(':end' => $dateTime->format("Y-m-d H:i:s"), ':id' => $row['id']);
                 Application_Common_Database::prepareAndExecute($update_sql, $params, Application_Common_Database::EXECUTE);
             }
             //If live broadcasting is off, turn scheduled play on
             $scheduled = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
             if ($state == 'L' && $scheduled == 'on' && !$override) {
                 self::SetNewLogTime('S', $dateTime);
             }
         }
     } catch (Exception $e) {
         header('HTTP/1.0 503 Service Unavailable');
         Logging::info("SetEndTime - Could not connect to database.");
         exit;
     }
 }