+ Error on line 429
foreach ($this->content['marquee'][0]->slides as $slide) {
<?php
namespace cbs\core\controllers\shows;
use cbs\core\blocks\atoms\Ads;
use cbs\core\blocks\components\About;
use cbs\core\blocks\components\BasketballSchedule;
use cbs\core\blocks\components\Carousel;
use cbs\core\blocks\components\ClipGridView;
use cbs\core\blocks\components\FlexUnit;
use cbs\core\blocks\components\FootballSchedule;
use cbs\core\blocks\components\Hero;
use cbs\core\blocks\components\HeroVideo;
use cbs\core\blocks\components\JSCarousel;
use cbs\core\blocks\components\RainMaker;
use cbs\core\blocks\components\Tweet;
use cbs\core\blocks\components\WatchlistCta;
use cbs\core\blocks\components\ContentPreferenceCta;
use cbs\core\blocks\components\WhatsNewGridView;
use cbs\core\controllers\ParentalControlsPinTrait;
use cbs\core\helpers\VideoHelper;
use cbs\core\lib\abTests\ShowsHomeAbTests;
use cbs\core\lib\Page;
use cbs\core\lib\Platform;
use cbs\core\config\Feature;
use cbs\core\config\Settings;
use cbs\core\lib\ResponsivePageTypes;
use cbs\core\managers\GuestManager;
use cbs\core\managers\PageAttributesManager;
use cbs\core\managers\ScheduleManager;
use cbs\core\managers\ShowHomeManager;
use cbs\core\managers\ShowManager;
use cbs\core\managers\ShowManager as ShowManagerV2;
use cbs\core\managers\TwitterManager;
use cbs\core\managers\VideosManager;
use cbs\core\managers\WhatsNewManager;
use cbs\core\models\basketballGame\BasketballGameModel;
use cbs\core\models\carousel\CastModel;
use cbs\core\models\carousel\GuestsModel;
use cbs\core\models\carousel\RelatedShowsModel;
use cbs\core\models\carousel\WhatsNewCarouselHockeyEastModel;
use cbs\core\models\carousel\WhatsNewCarouselNCAAModel;
use cbs\core\models\carousel\WhatsNewCarouselNFLModel;
use cbs\core\models\carousel\WhatsNewCarouselSECModel;
use cbs\core\models\WhatsNewItem;
use cbs\core\models\carousel\WhatsNewCarouselNWSLModel;
use cbs\core\models\carousel\WhatsNewCarouselMastersModel;
use cbs\core\models\footballGame\FootballGameModel;
use cbs\core\models\grid\WhatsNewGridModel;
use cbs\core\models\MarqueeSlide;
use cbs\core\models\Show;
use cbs\core\utils\Input;
use Exception;
use function PHPUnit\Framework\isInstanceOf;
use cbs\core\models\carousel\YMALShowsModel;
use cbs\core\lib\Localization;
use cbs\core\lib\Configuration;
use cbs\core\utils\UrlHelper;
class ShowsHomeController extends ShowsController {
use ShowsComponentsControllerTrait;
use ShowDynamicSectionsTrait;
use ParentalControlsPinTrait;
protected $abTests;
public function __construct()
{
parent::__construct();
// For new ShowsHomeAbTests component class instance
$this->abTests = new ShowsHomeAbTests($this);
}
/**
* Parsing section ids for Full Episodes section & dynamic sections need to render in page
*/
private function setVideoSectionIds()
{
# this code (not api call) to run after Full Eps call to setup Clips grid sectionId
$m = new VideosManager($this->show->id);
if (Platform::isMobile() || Platform::isTablet()) {
$m->overridePlatform(Platform::PLATFORM_DESKTOP_CHROME);
} else {
$m->overridePlatform(Platform::getVideoApiPlatformType());
}
$m->setConfig(VideoHelper::CONFIG_SHOW_HOME_CONFIG);
$m->setPreviewMode();
$m->size = 1;
$resp = $m->getSectionByIndex();
if (!empty($resp['section_metadata'])) {
$this->sectionMetadata = $resp['section_metadata'];
$this->sectionIds = $resp[1];
foreach ($this->sectionMetadata as $sectionId => $metadata) {
if ($metadata['title'] == 'Full Episodes') {
$this->sectionIdEpisodes = $sectionId;
$this->sectionIds = array_filter($resp[1], function ($id) {
return $id !== $this->sectionIdEpisodes;
});
}
}
$this->pageVars->sectionIds = $this->sectionIds;
$this->pageVars->sectionIdEpisodes = $this->sectionIdEpisodes;
}
}
/**
* cbs\core\models\Show Landing Page start here
*
* @throws Exception
*/
public function showHome()
{
// Feature flags
$featureAdsActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_ADS);
$featureLightningActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_LIGHTNING);
$featureGuestsActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_GUESTS);
$featureCastActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_CAST);
$featureTwitterActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_TWITTER);
$featureOtherCarouselsActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_OTHER_CAROUSELS);
$featureWhatsNewActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_WHATS_NEW);
$featureWhatsNewNFLActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_WHATS_NEW_NFL);
$featureWhatsNewNCAAActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_WHATS_NEW_NCAA);
$featureWhatsNewSECActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_WHATS_NEW_SEC);
$featureWhatsNewHockeyEastActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_WHATS_NEW_HOCKEY_EAST);
$featureRainmakerActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_RAINMAKER);
$featureUpsellActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_UPSELL);
$featureSportsScheduleActive = $this->settings
->feature()
->isActive(FEATURE::SHOWS_SPORTS_SCHEDULE);
$featureRelatedShowsActive = $this->settings
->feature()
->isActive(FEATURE::RELATED_SHOWS);
$featureWatchList = filter_var(
Configuration::getConfigValue(
'watchlist_enabled',
$this->settings
->feature()
->isActive(FEATURE::WATCHLIST_ENABLED),
),
FILTER_VALIDATE_BOOLEAN,
);
try { # Initializes showsHome AbTests
$this->abTests->runTests();
Page::section('Show Home');
Page::setType(Page::TYPE_SHOWHOME);// updated per team approval
$this->setCacheOnVarnish();
$this->setVideoSectionIds(); // Removes body tag top margin
$this->pageVars->header->removeBodyOffset();
$this->content = $this->show->home_content;
$this->content['marquee'] = $this->parseMarquee();
$this->content['promos'] = $this->parsePromos();
if (!empty($this->content['alerts'])) {
$this->pageVars->header->setAlert(
$this->content['alerts'][0]->alert_text,
);
}
$this->view->setJSBundle('showHome.js');
$this->view->setCSSBundle('pages/showHome.css'); # build ads
# build ads
if ($featureAdsActive) {
$this->buildAdsBlocks();
}
# hero
$this->buildHeroes($featureWatchList);
# full eps
$this->buildFullEpisodes(
VideoHelper::CONFIG_SHOW_HOME_CONFIG,
$this->content
);
# lightning carousel (xhr)
if ($featureLightningActive) {
$this->buildLightning();
}
#Guests
// TODO: TEMPORARY CHECK, NEED A CHECKBOX ON CMS TO FLAG WHETHER WE NEED TO BUILD GUEST MODULE OR NOT
if ($featureGuestsActive &&
in_array($this->show->id, $this->showsWithGuests)) {
$this->buildGuests();
}
# cast
if ($featureCastActive) {
$this->buildCast();
}
# related shows
if ($featureRelatedShowsActive) {
$this->buildYMALShows();
}
# about
$this->buildAbout();
# twitter
if ($featureTwitterActive) {
$this->buildTweet();
}
# other carousels
if ($featureOtherCarouselsActive) {
$this->buildVideoConfigs();
}
# whats new
if (
$featureWhatsNewActive &&
!in_array($this->show->id, $this->showsWithoutWhatsNew)
) {
$this->buildWhatsNew();
}
# live events
if ($this->show->has_live_events) {
$this->__buildLiveEventsGrid();
}
# whats new NFL
if (
$featureWhatsNewNFLActive &&
($this->show->id === self::NFL_SHOW_ID ||
$this->show->id === self::SUPER_BOWL_SHOW_ID)
) {
if ($this->show->id === self::SUPER_BOWL_SHOW_ID) {
$whatsNewTitle = "Latest NFL News From CBS Sports";
} else {
$whatsNewTitle = "What's New";
}
$this->buildWhatsNewNFL($whatsNewTitle);
}
# whats new NCAA Hoops
if (
$featureWhatsNewNCAAActive &&
$this->show->id === self::NCAA_ON_CBS_SHOW_ID
) {
$whatsNewTitle = "What's New";
$this->buildWhatsNewNCAA($whatsNewTitle);
}
# whats new SEC Football
if (
$featureWhatsNewSECActive &&
$this->show->id === self::SEC_ON_CBS_SHOW_ID
) {
$whatsNewTitle = "What's New";
$this->buildWhatsNewSEC($whatsNewTitle);
}
# whats new Hockey East
if (
$featureWhatsNewHockeyEastActive &&
$this->show->id === self::HOCKEY_EAST_SHOW_ID
) {
$whatsNewTitle = "Latest Hockey East News";
$this->buildWhatsNewHockeyEast($whatsNewTitle);
}
# whats new National Women's Soccer League
if ($this->show->id === self::NWSL_SHOW_ID) {
$whatsNewTitle = "Latest NWSL News";
$this->buildWhatsNewNWSL($whatsNewTitle);
}
# whats new Masters Tournament
if ($this->show->id === self::MASTERS_SHOW_ID) {
$whatsNewTitle = "Latest News from The Masters";
$this->buildWhatsNewMasters($whatsNewTitle);
}
#rain-maker
if (Settings::getInstance()->feature()->isActive(Feature::RAINMAKER)) {
if ($featureRainmakerActive && $this->show->has_rain_maker) {
$this->buildRainMaker();
}
}
# flex unit
if ($featureUpsellActive) {
$this->buildUpsellUnit();
}
# NFL & SEC schedule
if (
$featureSportsScheduleActive &&
in_array($this->show->id, $this->showsWithSchedule)
) {
$this->buildSportsSchedule();
}
# parental control pin overlay
$this->parentalControlsPin();
$this->tagManager->setOverrideTealiumTags([
'pageType' => PAGE::TYPE_SHOW,
]);
$this->view->setVar('TemplateVars', $this->pageVars);
$this->view->setVar('lazy_load_ads', 'yes');
$this->view->render('pages/shows/home');
} catch (Exception $e) {
$this->logger->logError($e->getMessage());
}
}
protected function setShow() {
try {
parent::setShow();
$showManager = new ShowManager($this->show->id);
$this->show = $this->getLandingPageShow($showManager);
} catch (Exception $e) {
$this->logger->logError($e->getMessage());
}
}
/**
* This function need to get called by big brother over the top, the grammy awards, and the good fight. Wish we could make it private....
*/
public function setLighteningCarousel() {
try {
$this->view->setVar('useLighteningCarousel', false);
if (!empty($this->show->showMenu->links)) {
foreach ($this->show->showMenu->links as $menuIem) {
if (property_exists($menuIem, 'videoConfigUniqueName') && $menuIem->videoConfigUniqueName == "DEFAULT_LIGHT_SVOD"
) { $this->view->setVar('useLighteningCarousel', true);
}
}
}//this overrides lightning carousel checkbox in show nav items if DEFAULT_LIGHT_SVOD exists for a show (CBSBE-505)
if (!empty($this->show->dynamicShowFlags->hasLightningCarouselVideoConfig) &&
$this->show->dynamicShowFlags->hasLightningCarouselVideoConfig ===
true
) {
$this->view->setVar('useLighteningCarousel', true);
}
} catch (Exception $e) {
$this->logger->logError($e->getMessage());
}
}
/**
* @param ShowManager $showManager
* @return Show
*/
private function getLandingPageShow(ShowManager $showManager) {
// TODO: move this code and cbs\core\managers\ShowHomeManager::get() into ShowManager, then get rid of cbs\core\managers\ShowHomeManager
$show_home_m = new ShowHomeManager();
$options = [];
if ($this->isClassics) {
$options['excludeClassics'] = 'false';
$options['includeAboutShowPage'] = 'false';
$options['includeRelatedShows'] = 'false';
$options['includeAlbums'] = 'false';
$options['includeCasts'] = 'false';
$options['includePromos'] = 'false';
$options['includeEpisodes'] = 'false';
}
if (
$this->user->auth->status &&
isset($this->user->svod->user_package) &&
!is_null($this->user->svod->user_package->source)
) {
$options[
'billingVendor'
] = "{$this->user->svod->user_package->source}";
}
$show_home_m = $show_home_m->get($options, $this->show->id);
$show = $this->show;
$show->home_content = $show_home_m->content;
if (!empty($show_home_m->dynamicShowFlags)) {
$show->dynamicShowFlags = $show_home_m->dynamicShowFlags;
}
return $show;
}
// show home
private function parseMarquee() {
$result = [];
if (!empty($this->content['marquee'])) {
foreach (
$this->content['marquee'][0]->slides as $slide) {
if(isset($this->show->brand_slug)){
$slide->brand = $this->show->brand;
$slide->brand_url = '/brands/'.$this->show->brand_slug.'/';
}
$slide->show_logo = $this->show->show_logo;
$slide->tune_in_time_override = $this->show->tune_in_time;
$slide->about = $this->show->about;
$slide->availableSeasons = count($this->show->available_video_seasons);
$slide->tv_age_rating = $this->show->tv_age_rating;
$slide->isContentAccessibleInCMS = $this->show->isContentAccessibleInCMS;
$slide->show_year = $this->show->premiere_date ? date("Y", strtotime($this->show->premiere_date)) : '';
$result[] = new MarqueeSlide($slide);
}
return $result;
}
return $result;
}
protected function parsePromos() {
$results = [];
if (isset($this->content['promos'])) {
foreach ($this->content['promos'] as $promo) {
$promo->content_feed_type = $promo->promo_content_type;
$promo->link_url = $promo->action_url;
$promo->filepath_promo_image = $promo->image;
$results[] = new WhatsNewItem($promo, true);
}
}
return $results;
}
public function addMarquee() {
$this->_view->setVar('has_marquee', true);
}
private function getDynamicPlayVideo() {
$showManV2 = new ShowManagerV2($this->show->id);
$showManV2->overridePlatform(\cbs\core\lib\Platform::PLATFORM_DESKTOP_CHROME);
return $showManV2->getDynamicPlayData($this->show->id);
}
private function buildShowMarquee($dynamicPlayVideo)
{
$slide = new \stdClass();
$slide->title = $this->show->title;
$slide->slide_title_1 = $this->show->title;
if (
!empty($dynamicPlayVideo->showAssets->filepath_show_hero_landscape)
) {
$slide->filepath_hero_landscape =
$dynamicPlayVideo->showAssets->filepath_show_hero_landscape;
}
if (
!empty($dynamicPlayVideo->showAssets->filepath_show_hero_portrait)
) {
$slide->filepath_hero_portrait =
$dynamicPlayVideo->showAssets->filepath_show_hero_portrait;
}
return $slide;
}
/**
* Build and set page var for Heroes
*/
private function buildHeroes($featureWatchList = false)
{
// Deprecated show marquee
$marquee = $this->content['marquee'];
$dynamicPlayVideo = $this->getDynamicPlayVideo();
// If no cms marquee is available, use dynamic play
if (empty($marquee)) {
$slide = $this->buildShowMarquee($dynamicPlayVideo);
$marquee = [new MarqueeSlide($slide)];
}
$hero = new Hero($marquee);
$hero->setPageType(ResponsivePageTypes::$TYPE_SHOWHOME);
if (!empty($dynamicPlayVideo->video->season_number)) {
$this->content['season_number'] =
$dynamicPlayVideo->video->season_number;
}
if ($dynamicPlayVideo->showId) {
$hero->setDynamicVideo($dynamicPlayVideo);
}
$hero->callOut = $this->show->tune_in_time;
$hero->heroContentId = $dynamicPlayVideo->spliceContentId;
$spliceEnabled = '0';
if($hero->heroContentId !== ''){
$url = 'https://splice.amlg.io/api/v2/video/'.$hero->heroContentId.'/preview/high69.mp4';
if($exits = UrlHelper::existURL($url)){
$spliceEnabled = '1';
}
}
$this->tagManager->setValues(array(
'spliceEnabled' => $spliceEnabled,
'showSectionTitle' => 'home')
);
if ($dynamicPlayVideo->medTime > 0) {
$dynamicPlayVideo->cta = Localization::getInstance()->getLocale(
'resume',
);
}
if ($featureWatchList) {
// Creates watchlist cta
$hero->setWatchlistCta(
new WatchlistCta($this->show, $dynamicPlayVideo->video),
);
}
$hero->setContentPreferenceCta(new ContentPreferenceCta($this->show, null));
$this->pageVars->hero = $hero;
}
/**
* Coordinate initialization of WhatsNew Grid & Carousel section with specified $start and $size
*
* @param int $start
* @param int $size
*/
private function buildWhatsNew(
$start = self::WHATSNEW_START,
$size = self::WHATSNEW_SIZE
) {
$w = new WhatsNewManager();
$arr = $w->getShowHomeWhatsNew($this->show->id, $start, $size);
if (!empty($arr['total'])) {
# build both grid and carousel for page
$this->buildWhatsNewGrid($arr);
$this->pageVars->whatsNewCarouselBlock = $this->buildWhatsNewCarousel(
$arr,
);
} else {
return null;
}
}
/**
* Build the actual component for WhatsNew Grid view
*
* @param $arr
*/
private function buildWhatsNewGrid($arr) {
# episode
$gridModel = new WhatsNewGridModel();
$gridModel->setData($arr['whatsNewData'] ?? []);
$whatsNewGridBlock = new WhatsNewGridView(
$gridModel->data,
"What's New",
);
$whatsNewGridBlock->setTotal($arr['total'] ?? 0)
->setShowSlug($this->params['slug'])
->setId('whatsnew-grid');
$this->pageVars->whatsNewGridBlock = $whatsNewGridBlock;
}
/**
* Coordinate initialization of NFL WhatsNew Grid section
* The carousel version does not require content to be loaded on page load
*/
private function buildWhatsNewNFL($whatsNewTitle) {
$arr = $this->__getWhatsNewNFLData();
$this->__buildWhatsNewNFLGrid($arr, $whatsNewTitle);
$this->__buildWhatsNewNFLCarousel($whatsNewTitle);
}
/**
* @param array $data
* @param int $total
*/
private function __buildWhatsNewNFLGrid($arr, $whatsNewTitle) {
// grid model
$gridModel = new WhatsNewCarouselNFLModel();
$gridModel->setData($arr['data'] ?? []);
// grid block
$gridBlock = new WhatsNewGridView($gridModel->data, $whatsNewTitle);
$gridBlock
->setId('whatsnew-grid-nfl')
->setTotal($arr['total'] ?? 0)
->setShowSlug($this->params['slug'] ?? '');
// set page var
$this->pageVars->whatsNewGridBlockNFL = $gridBlock;
}
/**
* This will create the JSCarousel block, requires no data
* data will be fetched by XHR
*/
private function __buildWhatsNewNFLCarousel($whatsNewTitle) {
$carousel = new JSCarousel();
$carousel
->setOrientation(Carousel::ORIENTATION_PORTRAIT)
->setId('whatsnew-carousel-nfl')
->pushDataAttribute('slug', $this->show->key);
$carousel->setTitle($whatsNewTitle);
$this->pageVars->whatsNewCarouselBlockNFL = $carousel;
}
/**
* Coordinate initialization of NCAA WhatsNew Grid section
* The carousel version does not require content to be loaded on page load
*/
private function buildWhatsNewNCAA($whatsNewTitle) {
$arr = $this->__getWhatsNewNCAAData();
$this->__buildWhatsNewNCAAGrid($arr, $whatsNewTitle);
$this->__buildWhatsNewNCAACarousel($whatsNewTitle);
}
/**
* @param array $data
* @param int $total
*/
private function __buildWhatsNewNCAAGrid($arr, $whatsNewTitle) {
// grid model
$gridModel = new WhatsNewCarouselNCAAModel();
$gridModel->setData($arr['data'] ?? []);
// grid block
$gridBlock = new WhatsNewGridView($gridModel->data, $whatsNewTitle);
$gridBlock
->setId('whatsnew-grid-ncaa')
->setTotal($arr['total'] ?? 0)
->setShowSlug($this->params['slug'] ?? '');
// set page var
$this->pageVars->whatsNewGridBlockNCAA = $gridBlock;
}
/**
* This will create the JSCarousel block, requires no data
* data will be fetched by XHR
*/
private function __buildWhatsNewNCAACarousel($whatsNewTitle) {
$carousel = new JSCarousel();
$carousel
->setOrientation(Carousel::ORIENTATION_PORTRAIT)
->setId('whatsnew-carousel-ncaa')
->pushDataAttribute('slug', $this->show->key);
$carousel->setTitle($whatsNewTitle);
$this->pageVars->whatsNewCarouselBlockNCAA = $carousel;
}
/**
* Coordinate initialization of NCAA WhatsNew Grid section
* The carousel version does not require content to be loaded on page load
*/
private function buildWhatsNewSEC($whatsNewTitle) {
$arr = $this->__getWhatsNewSECData();
$this->__buildWhatsNewSECGrid($arr, $whatsNewTitle);
$this->__buildWhatsNewSECCarousel($whatsNewTitle);
}
/**
* @param array $data
* @param int $total
*/
private function __buildWhatsNewSECGrid($arr, $whatsNewTitle) {
// grid model
$gridModel = new WhatsNewCarouselSECModel();
$gridModel->setData($arr['data'] ?? []);
// grid block
$gridBlock = new WhatsNewGridView($gridModel->data, $whatsNewTitle);
$gridBlock
->setId('whatsnew-grid-sec')
->setTotal($arr['total'] ?? 0)
->setShowSlug($this->params['slug'] ?? '');
// set page var
$this->pageVars->whatsNewGridBlockSEC = $gridBlock;
}
/**
* This will create the JSCarousel block, requires no data
* data will be fetched by XHR
*/
private function __buildWhatsNewSECCarousel($whatsNewTitle) {
$carousel = new JSCarousel();
$carousel
->setOrientation(Carousel::ORIENTATION_PORTRAIT)
->setId('whatsnew-carousel-sec')
->pushDataAttribute('slug', $this->show->key);
$carousel->setTitle($whatsNewTitle);
$this->pageVars->whatsNewCarouselBlockSEC = $carousel;
}
/**
* Coordinate initialization of Hockey East WhatsNew Grid section
* The carousel version does not require content to be loaded on page load
*/
private function buildWhatsNewHockeyEast($whatsNewTitle) {
$arr = $this->__getWhatsNewHockeyEastData();
$this->__buildWhatsNewHockeyEastGrid($arr, $whatsNewTitle);
$this->__buildWhatsNewHockeyEastCarousel($whatsNewTitle);
}
/**
* @param array $data
* @param int $total
*/
private function __buildWhatsNewHockeyEastGrid($arr, $whatsNewTitle) {
// grid model
$gridModel = new WhatsNewCarouselHockeyEastModel();
$gridModel->setData($arr['data'] ?? []);
// grid block
$gridBlock = new WhatsNewGridView($gridModel->data, $whatsNewTitle);
$gridBlock
->setId('whatsnew-grid-hockey-east')
->setTotal($arr['total'] ?? 0)
->setShowSlug($this->params['slug'] ?? '');
// set page var
$this->pageVars->whatsNewGridBlockHockeyEast = $gridBlock;
}
/**
* This will create the JSCarousel block, requires no data
* data will be fetched by XHR
*/
private function __buildWhatsNewHockeyEastCarousel($whatsNewTitle) {
$carousel = new JSCarousel();
$carousel
->setOrientation(Carousel::ORIENTATION_PORTRAIT)
->setId('whatsnew-carousel-hockey-east')
->pushDataAttribute('slug', $this->show->key);
$carousel->setTitle($whatsNewTitle);
$this->pageVars->whatsNewCarouselBlockHockeyEast = $carousel;
}
/**
* Coordinate initialization of NWSL WhatsNew Grid section
* The carousel version does not require content to be loaded on page load
*/
private function buildWhatsNewNWSL($whatsNewTitle)
{
$arr = $this->__getWhatsNewNWSLData();
$this->__buildWhatsNewNWSLGrid($arr,$whatsNewTitle);
$this->__buildWhatsNewNWSLCarousel($whatsNewTitle);
}
/**
* @param array $data
* @param int $total
*/
private function __buildWhatsNewNWSLGrid($arr,$whatsNewTitle)
{
// grid model
$gridModel = new WhatsNewCarouselNWSLModel();
$gridModel->setData($arr['data'] ?? []);
// grid block
$gridBlock = new WhatsNewGridView($gridModel->data, $whatsNewTitle);
$gridBlock->setId('whatsnew-grid-nwsl')
->setTotal($arr['total'] ?? 0)
->setShowSlug($this->params['slug'] ?? '');
// set page var
$this->pageVars->whatsNewGridBlockNWSL = $gridBlock;
}
/**
* This will create the JSCarousel block, requires no data
* data will be fetched by XHR
*/
private function __buildWhatsNewNWSLCarousel($whatsNewTitle){
$carousel = new JSCarousel();
$carousel->setOrientation(Carousel::ORIENTATION_PORTRAIT)
->setId('whatsnew-carousel-nwsl')
->pushDataAttribute('slug', $this->show->key);
$carousel->setTitle($whatsNewTitle);
$this->pageVars->whatsNewCarouselBlockNWSL = $carousel;
}
/**
* Coordinate initialization of The Masters WhatsNew Grid section
* The carousel version does not require content to be loaded on page load
*/
private function buildWhatsNewMasters($whatsNewTitle) {
$arr = $this->__getWhatsNewMastersData();
$this->__buildWhatsNewMastersGrid($arr, $whatsNewTitle);
$this->__buildWhatsNewMastersCarousel($whatsNewTitle);
}
/**
* @param array $data
* @param int $total
*/
private function __buildWhatsNewMastersGrid($arr, $whatsNewTitle) {
// grid model
$gridModel = new WhatsNewCarouselMastersModel();
$gridModel->setData($arr['data'] ?? []);
// grid block
$gridBlock = new WhatsNewGridView($gridModel->data, $whatsNewTitle);
$gridBlock->setId('whatsnew-grid-masters')
->setTotal($arr['total'] ?? 0)
->setShowSlug($this->params['slug'] ?? '');
// set page var
$this->pageVars->whatsNewGridBlockMasters = $gridBlock;
}
/**
* This will create the JSCarousel block, requires no data
* data will be fetched by XHR
*/
private function __buildWhatsNewMastersCarousel($whatsNewTitle) {
$carousel = new JSCarousel();
$carousel->setOrientation(Carousel::ORIENTATION_PORTRAIT)
->setId('whatsnew-carousel-masters')
->pushDataAttribute('slug', $this->show->key);
$carousel->setTitle($whatsNewTitle);
$this->pageVars->whatsNewCarouselBlockMasters = $carousel;
}
/**
* Build and set page var Lightning carousel
*
*/
protected function buildLightning() {
$this->pageVars->hasLightning = false;
// legacy showcontroller rules
if (!empty($this->show->showMenu->links)) {
foreach ($this->show->showMenu->links as $menuIem) {
if (
property_exists($menuIem, 'videoConfigUniqueName') &&
$menuIem->videoConfigUniqueName ==
"RESPONSIVE_CLIPS_CAROUSEL_SVOD"
) {
$this->pageVars->hasLightning = true;
}
}
}
// this overrides lightning carousel checkbox in show nav items if DEFAULT_LIGHT_SVOD exists for a show (CBSBE-505)
if (
!empty(
$this->show->dynamicShowFlags->hasLightningCarouselVideoConfig
) &&
$this->show->dynamicShowFlags->hasLightningCarouselVideoConfig ===
true
) {
$this->pageVars->hasLightning = true;
}
}
/**
* Build and set page var for Casts
*
*/
private function buildCast()
{
$castModel = new CastModel();
if (!empty($this->content['cast'])) {
$castModel->setSlug($this->configName);
$castModel->setData($this->content['cast']);
}
$castBlock = new Carousel();
$castBlock
->setId('js-cast')
->addClasses(['cast__wrapper'])
->setItems($castModel)
->setAARegion('cast')
->setOrientation(Carousel::ORIENTATION_PORTRAIT);
if ($this->show->id == '44810') {
$castBlock->setTitle('Hosts');
} else if ($this->show->id == '61456442') {
$castBlock->setTitle('Host And Judges');
} else {
$castBlock->setTitle('Cast');
}
$this->pageVars->cast = $castBlock;
}
/**
* Build and set page var for Guests
*
*/
private function buildGuests() {
$year = Input::currentYear();
$week = Input::currentWeek();
# values to send to manager
$use_year = Input::getParam('y', 'int');
$use_week = Input::getParam('w', 'int');
# if query string is null use passed values
if (is_null($use_year) === true) {
if (is_null($year) === false) {
$use_year = $year;
}
}
if (is_null($use_week) === true) {
if (is_null($week) === false) {
$use_week = $week;
}
}
# if both are null use current year/week
if (is_null($use_year) === true) {
$use_year = date('Y');
}
if (is_null($use_week) === true) {
$use_week = date('W');
}
# grouping
$group = true;
$manager = new GuestManager();
$guests = $manager->getWeeklyGuests($use_year, $use_week, $group);
//Checking to make sure theres actual data in the days. If so move on.
if ($guests['items']->Monday) {
$guestsModel = new GuestsModel();
$guestsModel->setData($guests);
$block = new Carousel();
$block
->setId('guests-carousel')
->setItems($guestsModel)
->setTitle("This Week's Guests")
->addClasses(['guest__wrapper'])
->setOrientation(Carousel::ORIENTATION_PORTRAIT);
$this->pageVars->guests = $block;
}
}
/**
* Build and set page var for Related Shows carousel
*
* @throws Exception
*/
private function buildRelatedShows()
{
$manager = new ShowManagerV2($this->show->id);
$manager->overridePlatform(Platform::PLATFORM_DESKTOP);
$relatedShowsResp = $manager->getRelatedShows();
if (!empty($relatedShowsResp)) {
$relatedModel = new RelatedShowsModel();
$relatedModel->setData($relatedShowsResp);
$block = new Carousel();
$block
->setId('related-shows-carousel')
->setItems($relatedModel)
->setTitle(
Localization::getInstance()->getLocale('related_shows'),
)
->setAARegion('related shows')
->setOrientation(Carousel::ORIENTATION_PORTRAIT);
if (in_array($this->show->id, $this->showsWithRelatedUnderClips)) {
$this->pageVars->related_shows_under_clips = $block;
} else {
$this->pageVars->related_shows = $block;
}
}
}
/**
* Build and set page var for FlexUnit (upsell at the bottom of the page)
*
*/
private function buildUpsellUnit() {
if (!empty($this->content['upsellInfo'][0])) {
$flexUnit = new FlexUnit();
$flexUnit->setData($this->content['upsellInfo'][0]);
// TODO: TEMPORARY CHECK, NEED A CHECKBOX ON CMS TO FLAG WHETHER WE NEED TO SHOW THIS LOGO OR NOT
if (
$this->show->id == self::THE_TALK_SHOW_ID ||
$this->show->id == self::BB_CELEBRITY
) {
$flexUnit->setHideAAImage();
}
if ($flexUnit->checkLinkCBS() === false) {
$flexUnit->getActionButton()->setTarget('_blank');
}
$this->pageVars->upsell = $flexUnit;
}
}
/**
* Build and set page var for About
*
*/
private function buildAbout() {
if (!empty($this->content['showPage'][0])) {
$aboutBlock = new About();
if (strpos($this->content['showPage'][0]->str_title, 'About') === 0) {
$cnt = 1;
$this->content['showPage'][0]->str_title = str_replace('About', '', $this->content['showPage'][0]->str_title, $cnt);
}
$this->content['showPage'][0]->title = $this->content['showPage'][0]->str_title ?? '';
$this->content['showPage'][0]->about = $this->content['showPage'][0]->copy ?? '';
$aboutBlock->setData($this->content['showPage'][0])
->setTuneInTime($this->show->tune_in_time);
if (!empty($this->show->available_video_seasons)) {
$aboutBlock->setFullEpisodeGuideLink();
}
$this->pageVars->about = $aboutBlock;
}
}
/**
* Build and set page var for Tweet
*
*/
private function buildTweet() {
//TODO: THIS IF WRAP IS TEMPORARY, NEED A CHECKBOX ON CMS TO FLAG WHETHER WE NEED TO BUILD TWEET MODULE OR NOT
if (in_array($this->show->id, $this->showsWithTweet)) {
$twitter = new TwitterManager();
$tweets = $twitter->getTweets($this->show->id, 'DEFAULT', 1);
if (!empty($tweets)) {
$tweet = new Tweet();
$tweet->setData($tweets[0]);
$this->pageVars->tweet = $tweet;
}
}
}
/**
* Build and set page var for Rain Maker at the bottom of the page
*
*/
private function buildRainMaker() {
if (!empty($this->show->id) && !$this->user->isSubscriber()) {
$rainMaker = new RainMaker($this->show);
$this->pageVars->rainMaker = $rainMaker;
}
}
/**
* Build and set page var for all Ads need to render
*
*/
private function buildAdsBlocks() {
if (Page::hasAdsEnabled()) {
$prestitialAds = new Ads(Ads::$TYPE_PRESTITIAL);
$interstitialAds = new Ads(Ads::$TYPE_INTERSTITIAL);
$this->pageVars->prestitialAds = $prestitialAds;
$this->pageVars->interstitialAds = $interstitialAds;
}
}
private function buildSportsSchedule()
{
$sm = new ScheduleManager();
$currentSeason = date('Y');
// retrieve schedule logos
$pm = new PageAttributesManager();
$pm->setUrl(ltrim($this->basePath, "/"));
$pm->overridePlatform(Platform::PLATFORM_DESKTOP);
$resp = $pm->findAll();
$teamLogoArr = $resp->dynamicProps;
if (
$this->showId == self::NFL_SHOW_ID ||
$this->showId == self::SUPER_BOWL_SHOW_ID
) {
$season = $teamLogoArr['nfl_current_season'];
$sm = new ScheduleManager();
$schedule = $sm->getNFLSchedule($season);
if (sizeof($schedule) > 0) {
$NFLBlock = $this->__buildNFLBlock($schedule = [], $teamLogoArr);
$NFLBlock->enableSeasonFilter();
$this->pageVars->sports_schedule = $NFLBlock;
}
} elseif ($this->showId == self::SEC_ON_CBS_SHOW_ID) {
$resp = $sm->getSECSchedule([
'season' => $currentSeason,
'seasonType' => 'regular',
]);
if (!empty($resp)) {
$schedule = $resp;
$neededSchedule = $sm->filterCurrentSECWeekSchedules($schedule);
$this->pageVars->sports_schedule = $this->__buildSECBlock(
$neededSchedule,
$teamLogoArr,
);
}
} else {
$resp = $sm->getNCAAHoopsSchedule();
if (!empty($resp)) {
$schedule = $resp;
$this->pageVars->sports_schedule = $this->__buildNCAABlock(
$schedule,
);
}
}
}
private function __buildSECBlock($schedule, $teamLogoArr) {
$footballGameModel = new FootballGameModel($teamLogoArr);
$footballGameModel->setData($schedule, 'SEC');
$block = new FootballSchedule();
$block
->setData($schedule)
->addClasses(['schedule-sec'])
->setSlug($this->configName ?? '')
->setItems($footballGameModel);
return $block;
}
private function __buildNCAABlock($schedule) {
$basketballGameModel = new BasketballGameModel();
$basketballGameModel->setData($schedule);
$block = new BasketballSchedule();
$block
->setData($schedule)
->addClasses(['schedule-ncaa'])
->setSlug($this->configName ?? '')
->setItems($basketballGameModel);
return $block;
}
private function buildVideoConfigs() {
// bottom components
$carousels = [];
if (is_array($this->sectionIds) && !empty($this->sectionIds)) {
foreach ($this->sectionIds as $sectionId) {
if (isset($this->sectionMetadata[$sectionId]['title'])) {
$title = $this->sectionMetadata[$sectionId]['title'];
}
$block = new JSCarousel();
$block
->setId($sectionId)
->setTitle($title)
->addClasses(['js-video-carousel'])
->pushDataAttribute('slug', $this->configName)
->pushDataAttribute('sectionid', $sectionId);
$carousels[] = $block;
}
}
$this->pageVars->carousels = $carousels;
}
private function buildYMALShows()
{
$manager = new ShowManagerV2($this->show->id);
$manager->overridePlatform(Platform::PLATFORM_DESKTOP);
$ymalShowsResp = $manager->getYMALShowsData();
if ($ymalShowsResp) {
$ymalModel = new YMALShowsModel();
$ymalModel->setData($ymalShowsResp);
$block = new Carousel();
$block->setId('related-shows-carousel')
->setItems($ymalModel)
->setTitle('Related Shows')
->setAARegion('related shows')
->setOrientation(Carousel::ORIENTATION_PORTRAIT);
if (in_array($this->show->id, $this->showsWithRelatedUnderClips)) {
$this->pageVars->related_shows_under_clips = $block;
} else {
$this->pageVars->related_shows = $block;
}
}
}
}
* Stack Trace...
- /usr/local/deploy/mvc-deploys/mvc-release/htdocs/index.php(168) calling run()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/app/DooWebApp.php(34) calling routeTo()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/app/DooWebApp.php(127) calling showHome()
- /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/core/src/controllers/shows/ShowsHomeController.php(187) calling parseMarquee()
object(DooConfig)#11 (22) {
["AUTOLOAD"] => NULL
["SITE_PATH"] => string(42) "/usr/local/deploy/mvc-deploys/mvc-release/"
["PROTECTED_FOLDER"] => string(46) "/usr/local/deploy/mvc-deploys/mvc-release/src/"
["BASE_PATH"] => string(70) "/usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/"
["LOG_PATH"] => NULL
["APP_URL"] => string(24) "http://test-www.cbs.com/"
["SUBFOLDER"] => string(1) "/"
["APP_MODE"] => string(3) "dev"
["AUTOROUTE"] => bool(false)
["DEBUG_ENABLED"] => bool(true)
["ERROR_404_DOCUMENT"] => NULL
["ERROR_404_ROUTE"] => string(33) "/error/?%2Fshows%2Fbig_brother%2F"
["CACHE_PATH"] => NULL
["AUTO_VIEW_RENDER_PATH"] => string(12) "/shows/:slug"
["MEMCACHE"] => NULL
["TEMPLATE_ENGINE"] => string(7) "DooView"
["TEMPLATE_SHOW_COMMENT"] => NULL
["TEMPLATE_ALLOW_PHP"] => NULL
["TEMPLATE_COMPILE_ALWAYS"] => NULL
["TEMPLATE_GLOBAL_TAGS"] => NULL
["MODULES"] => NULL
["APP_NAMESPACE_ID"] => NULL
}
$_COOKIE Variables
array(15) {
["handl_original_ref"] => string(65) "https://microchipusa.com/discrete-semiconductor-products/page/681"
["supercache_cart"] => string(5) "empty"
["handl_ref"] => string(65) "https://microchipusa.com/discrete-semiconductor-products/page/681"
["handl_url_base"] => string(43) "https://ultatel.com/wp-json/wp/v2/pages/620"
["HandLtestDomainNameServer"] => string(26) "HandLtestDomainValueServer"
["organic_source"] => string(65) "https://microchipusa.com/discrete-semiconductor-products/page/681"
["handl_ip"] => string(13) "3.138.134.221"
["landing"] => string(13) "/shop/t/c/055"
["handl_url"] => string(43) "https://ultatel.com/wp-json/wp/v2/pages/620"
["handl_landing_page"] => string(65) "https://microchipusa.com/discrete-semiconductor-products/page/640"
["user_agent"] => string(103) "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"
["PHPSESSID"] => string(26) "og688v8evnfl4fhc41dgiv89qp"
["supercache-version"] => string(1) "1"
["shop_cart"] => string(32) "72baa76769d14e49874420b5b194dde7"
["organic_source_str"] => string(8) "Internal"
}