Radio Page Code Review Changes
Reset stylesheets in index controller. Removed hardcoded days of week in WidgetHelper. Display schedule widget with 6 days after the current day.
This commit is contained in:
parent
ca8ca0abed
commit
042e441708
6 changed files with 23 additions and 22 deletions
|
@ -133,11 +133,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$view->headLink()->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version']);
|
||||
$view->headLink()->appendStylesheet($baseUrl . 'css/pro_dropdown_3.css?' . $CC_CONFIG['airtime_version']);
|
||||
$view->headLink()->appendStylesheet($baseUrl . 'css/qtip/jquery.qtip.min.css?' . $CC_CONFIG['airtime_version']);
|
||||
|
||||
// Don't include style.css on the Radio Page because there are conflicting styles.
|
||||
if ($_SERVER['REQUEST_URI'] != "/") {
|
||||
$view->headLink()->appendStylesheet($baseUrl . 'css/styles.css?' . $CC_CONFIG['airtime_version']);
|
||||
}
|
||||
$view->headLink()->appendStylesheet($baseUrl . 'css/masterpanel.css?' . $CC_CONFIG['airtime_version']);
|
||||
$view->headLink()->appendStylesheet($baseUrl . 'css/tipsy/jquery.tipsy.css?' . $CC_CONFIG['airtime_version']);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
define("DAYS_PER_WEEK", 7);
|
||||
|
||||
class WidgetHelper
|
||||
{
|
||||
public static function getWeekInfo($timezone)
|
||||
|
@ -59,10 +61,9 @@ class WidgetHelper
|
|||
public static function getWeekInfoV2($timezone)
|
||||
{
|
||||
//weekStart is in station time.
|
||||
$weekStartDateTime = Application_Common_DateHelper::getWeekStartDateTime();
|
||||
//$weekStartDateTime = Application_Common_DateHelper::getWeekStartDateTime();
|
||||
$weekStartDateTime = new DateTime("now", new DateTimeZone(Application_Model_Preference::GetTimezone()));
|
||||
|
||||
$dow = array("monday", "tuesday", "wednesday", "thursday", "friday",
|
||||
"saturday", "sunday");
|
||||
$maxNumOFWeeks = 2;
|
||||
|
||||
$result = array();
|
||||
|
@ -80,8 +81,12 @@ class WidgetHelper
|
|||
$utcDayStart = $weekStartDateTime->format("Y-m-d H:i:s");
|
||||
$weekCounter = 0;
|
||||
while ($weekCounter < $maxNumOFWeeks) {
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
for ($dayOfWeekCounter = 0; $dayOfWeekCounter < DAYS_PER_WEEK; $dayOfWeekCounter++) {
|
||||
$dateParse = date_parse($weekStartDateTime->format("Y-m-d H:i:s"));
|
||||
|
||||
$result[$weekCounter][$dayOfWeekCounter]["dayOfMonth"] = $dateParse["day"];
|
||||
$result[$weekCounter][$dayOfWeekCounter]["dayOfWeek"] = strtoupper(date("D", $weekStartDateTime->getTimestamp()));
|
||||
|
||||
//have to be in station timezone when adding 1 day for daylight savings.
|
||||
$weekStartDateTime->setTimezone(new DateTimeZone($timezone));
|
||||
$weekStartDateTime->add(new DateInterval('P1D'));
|
||||
|
@ -108,14 +113,13 @@ class WidgetHelper
|
|||
$endParseDate = date_parse($show['ends']);
|
||||
$show["show_end_hour"] = str_pad($endParseDate["hour"], 2, 0, STR_PAD_LEFT).":".str_pad($endParseDate["minute"],2, 0, STR_PAD_LEFT);
|
||||
}
|
||||
$result[$weekCounter][$dow[$i]]["dayOfMonth"] = $dateParse["day"];
|
||||
$result[$weekCounter][$dow[$i]]["dayOfWeek"] = strtoupper(substr($dow[$i], 0, 3));
|
||||
$result[$weekCounter][$dow[$i]]["shows"] = $shows;
|
||||
$result[$weekCounter][$dayOfWeekCounter]["shows"] = $shows;
|
||||
|
||||
// XSS exploit prevention
|
||||
self::convertSpecialChars($result, array("name", "url"));
|
||||
// convert image paths to point to api endpoints
|
||||
self::findAndConvertPaths($result);
|
||||
|
||||
}
|
||||
$weekCounter += 1;
|
||||
}
|
||||
|
|
|
@ -94,9 +94,10 @@ class EmbedController extends Zend_Controller_Action
|
|||
}
|
||||
$this->view->jquery = Application_Common_HTTPHelper::getStationUrl() . "widgets/js/jquery-1.6.1.min.js?".$CC_CONFIG['airtime_version'];
|
||||
|
||||
$result = WidgetHelper::getWeekInfoV2($this->getRequest()->getParam("timezone"));
|
||||
$this->view->scheduleDataWeek1 = $result[0];
|
||||
$this->view->scheduleDataWeek2 = $result[1];
|
||||
$weeklyScheduleData = WidgetHelper::getWeekInfoV2($this->getRequest()->getParam("timezone"));
|
||||
|
||||
// Return only the current week's schedule data. In the future we may use the next week's data.
|
||||
$this->view->weeklyScheduleData = $weeklyScheduleData[0];
|
||||
|
||||
$currentDay = new DateTime("now", new DateTimeZone(Application_Model_Preference::GetTimezone()));
|
||||
//day of the month without leading zeros (1 to 31)
|
||||
|
|
|
@ -23,14 +23,14 @@ class EmbeddableWidgetsController extends Zend_Controller_Action
|
|||
if ($numEnabledStreams > 0 && $apiEnabled) {
|
||||
$this->view->player_form = $form;
|
||||
} else {
|
||||
$this->view->player_error_msg = "To configure and use the embeddable player you must:<br><br>
|
||||
$this->view->player_error_msg = _("To configure and use the embeddable player you must:<br><br>
|
||||
1. Enable at least one MP3, AAC, or OGG stream under System -> Streams<br>
|
||||
2. Enable the Public Airtime API under System -> Preferences";
|
||||
2. Enable the Public Airtime API under System -> Preferences");
|
||||
}
|
||||
|
||||
if (!$apiEnabled) {
|
||||
$this->view->weekly_schedule_error_msg = "To use the embeddable weekly schedule you must:<br><br>
|
||||
1. Enable the Public Airtime API under System -> Preferences";
|
||||
$this->view->weekly_schedule_error_msg = _("To use the embeddable weekly schedule you must:<br><br>
|
||||
1. Enable the Public Airtime API under System -> Preferences");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class IndexController extends Zend_Controller_Action
|
|||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/radio-page/radio-page.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->setStylesheet($baseUrl.'css/radio-page/radio-page.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/embed/weekly-schedule-widget.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->_helper->layout->setLayout('radio-page');
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<div class="schedule tab_content current">
|
||||
<ul class="tabs">
|
||||
<?php
|
||||
foreach($this->scheduleDataWeek1 as $day => $data) {
|
||||
foreach($this->weeklyScheduleData as $day => $data) {
|
||||
$activeClass = $this->currentDayOfMonth == $data["dayOfMonth"] ? "active" : "";
|
||||
echo "<li class='".$activeClass."' data-tab='day-".$data["dayOfMonth"]."'>" . $data["dayOfWeek"] . "<span>" . $data["dayOfMonth"] . "</span></li>";
|
||||
}?>
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
<div class="schedule_content">
|
||||
<?php
|
||||
foreach($this->scheduleDataWeek1 as $day => $data) {
|
||||
foreach($this->weeklyScheduleData as $day => $data) {
|
||||
$activeClass = $this->currentDayOfMonth == $data["dayOfMonth"] ? "active" : "";
|
||||
|
||||
echo "<div id='day-".$data["dayOfMonth"]."' class='schedule_item ".$activeClass."'>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue