<?php $status = nyss_session_get_status(); $current_channel = variable_get('nyss_videosettings_main_livestream_channel', 'nysenate'); ?> <p><?php print $status['message']; ?> </p> <?php if ($status['display_video']) { ?> <?php if (!nyss_internalusers_is_internal()) { ?> <?php if (nyss_videosettings_livestream_working()) { ?> <center> <div id="livestream_block"> <script src="http://static.mogulus.com/scripts/playerv2.js?channel=<?php print $current_channel; ?> &layout=playerEmbedDefault&backgroundColor=0xffffff&backgroundAlpha=1&backgroundGradientStrength=0&chromeColor=0x000000&headerBarGlossEnabled=true&controlBarGlossEnabled=true&chatInputGlossEnabled=false&uiWhite=true&uiAlpha=0.5&uiSelectedAlpha=1&dropShadowEnabled=true&dropShadowHorizontalDistance=10&dropShadowVerticalDistance=10&paddingLeft=10&paddingRight=10&paddingTop=10&paddingBottom=10&cornerRadius=3&backToDirectoryURL=null&bannerURL=null&bannerText=null&bannerWidth=320&bannerHeight=50&showViewers=true&embedEnabled=true&chatEnabled=false&onDemandEnabled=true&programGuideEnabled=false&fullScreenEnabled=true&reportAbuseEnabled=false&gridEnabled=false&initialIsOn=false&initialIsMute=false&initialVolume=10&contentId=null&initThumbUrl=null&playeraspectwidth=4&playeraspectheight=3&mogulusLogoEnabled=false&width=550&height=430&wmode=window" type="text/javascript"></script> </div> </center> <?php } ?> <p>Having trouble? Try viewing the video at <a href="http://www.livestream.com/<?php print $current_channel;
function nyss_session_get_status() { $result = _nyss_session_get_xml("http://63.118.56.3/wtsstatus.xml"); $status = array(); // Parse out values from the retrieved XML $status['state'] = (string) $result->channel->item->wtsstate; $status['text'] = (string) $result->channel->item->wtstext; $status['start_day'] = (string) $result->channel->item->startstringday; $status['start_time'] = (string) $result->channel->item->startstringtime; $status['majority_conference_meeting'] = (string) $result->channel->item->wtsmajconfmeeting; $status['last_convened'] = (string) $result->channel->item->wtslastconvened; $status['last_adjourned'] = (string) $result->channel->item->wtslastadjourned; // Calculate a boolean value // This flag also gets set individually below, so this code arguably isn't necessary. // Belts and braces. Belts and braces. $status['display_video'] = in_array(trim(strtolower($status['state'])), array("standby to convene", "standby to reconvene", "in session", "senate and assembly convened in joint session", "convened in extraordinary session")); // Construct the message and headline, and decide whether to display video. switch (trim(strtolower($status['state']))) { // Senate is meeting, so show video case 'standby to convene': $status['message'] = 'The Senate is standing by to convene. '; $status['message'] .= $status['text']; $status['headline'] = 'Senate Status'; $status['display_video'] = TRUE; break; case 'standby to reconvene': $status['message'] = 'The Senate is standing by to reconvene. '; $status['message'] .= $status['text']; $status['headline'] = 'Senate Status'; $status['display_video'] = TRUE; break; case 'in session': $status['message'] = 'The Senate is in Session. '; $status['message'] .= $status['text']; $status['headline'] = 'Senate Status. '; $status['display_video'] = TRUE; break; case 'senate and assembly convened in joint session': $status['message'] = 'The Senate and Assembly has convened in a Joint Session. '; $status['message'] .= $status['text']; $status['headline'] = 'Senate Status'; $status['display_video'] = TRUE; break; case 'convened in extraordinary session': $status['message'] = 'The Senate is Convened in Extraordinary Session. '; $status['message'] .= $status['text']; $status['headline'] = 'Senate Status'; $status['display_video'] = TRUE; break; // Senate is not currently meeting, so point people to video archives // Senate is not currently meeting, so point people to video archives case 'adjourned to [date, time]': $status['message'] = 'Adjourned until ' . $status['start_time'] . ', ' . $status['start_day'] . '. '; $status['message'] .= _nyss_session_archives_text(); $status['message'] .= $status['text']; $status['headline'] = 'When is Session?'; $status['display_video'] = FALSE; break; case 'adjourned to the call of the temporary president': $status['message'] = 'Adjourned to the call of the Temporary President. '; $status['message'] .= _nyss_session_archives_text(); $status['message'] .= $status['text']; $status['headline'] = 'When is Session?'; $status['display_video'] = FALSE; break; case 'temporarily at ease': case 'at ease': $status['message'] = 'The Senate is Temporarily at Ease. '; $status['message'] .= _nyss_session_archives_text(); $status['message'] .= $status['text']; $status['headline'] = 'Senate Status'; $status['display_video'] = FALSE; break; case 'in recess until [time]': $status['message'] = 'The Senate is in recess until ' . $status['start_time'] . '. '; $status['message'] .= _nyss_session_archives_text(); $status['message'] .= $status['text']; $status['headline'] = 'When is Session?'; $status['display_video'] = FALSE; break; case 'in recess': $status['message'] = 'The Senate is in recess. '; $status['message'] .= _nyss_session_archives_text(); $status['message'] .= $status['text']; $status['headline'] = 'When is Session?'; $status['display_video'] = FALSE; break; // Free form text doesn't meet any of the above categories, so don't show video // OR point to the video archives. // Free form text doesn't meet any of the above categories, so don't show video // OR point to the video archives. case 'free form text box': $status['message'] = $status['text']; $status['headline'] = 'Senate Status'; $status['display_video'] = FALSE; break; default: // belts and braces logic to make sure the temporary president case gets matched correctly if (substr($status['state'], 0, 12) == 'Adjourned to' && preg_match('/temporary president/i', $status['state'], $matches)) { $status['message'] = 'The Senate is adjourned to the call of the Temporary President. '; $status['message'] .= _nyss_session_archives_text(); $status['message'] .= $status['text']; $status['headline'] = 'When is Session?'; $status['display_video'] = FALSE; } else { if (substr($status['state'], 0, 12) == 'Adjourned to' && trim($status['start_day']) != '' && trim($status['start_time']) != '') { $status['message'] = 'Adjourned until ' . $status['start_time'] . ', ' . $status['start_day'] . '. '; $status['message'] .= _nyss_session_archives_text(); $status['message'] .= $status['text']; $status['headline'] = 'When is Session?'; $status['display_video'] = FALSE; } else { if (substr($status['state'], 0, 15) == 'In Recess until' && $status['start_time'] != '') { $status['message'] = 'The Senate is in recess until ' . $status['start_time'] . '. '; $status['message'] .= _nyss_session_archives_text(); $status['message'] .= $status['text']; $status['headline'] = 'When is Session?'; $status['display_video'] = FALSE; } else { if ($status['state'] != '') { $status['message'] = $status['state'] . ' '; $status['message'] .= $status['text']; $status['headline'] = 'Senate Status'; $status['display_video'] = FALSE; } else { if ($status['text']) { $status['message'] = $status['text']; $status['headline'] = 'Senate Status'; $status['display_video'] = FALSE; } else { $status['message'] = 'We are currently experiencing technical difficulties. Please stand by. '; $status['headline'] = 'Senate Status'; $status['display_video'] = FALSE; } } } } } break; } $last_char = substr(trim($status['message']), -1, 1); // add a period in case the journal clerk's office appends a message and forgets to punctuate. if (!in_array($last_char, array('.', '?', '!'))) { $status['message'] = trim($status['message']) . '. '; } $status['internal'] = nyss_internalusers_is_internal(); $status['ip'] = ip_address(); return $status; }