コード例 #1
0
    public function htmlBuildResult()
    {
        $channelConfiguration = ChannelConfiguration::getChannelConfigurationByApplicationLocalizedId($this->applicationLocalized()->attribute("id"));

        if($channelConfiguration)
        {
            $this->pushResult("subtitle", $channelConfiguration->attribute("subtitle"));
            $this->pushResult("icon", StaticData::externalUrl(ClusterTool::clusterIdentifier(), $channelConfiguration->attribute("icon")));
            $this->pushResult("color", $channelConfiguration->attribute("color"));
        }
        
        if( SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) )
        {
            $this->pushResult( 'gtm_variables', $this->getGTMTags());
        }

        if ($this->getCustomParameter('TaxonomiesFilter') != false)
        {
            $taxonomiesFilter = array();
            $taxonomyCategoriesFilter = $this->getCustomParameter('TaxonomiesFilter');
            foreach($taxonomyCategoriesFilter as $category)
            {
                $taxonomies = FacetFilteringTool::getTaxonomyTranslationsByCategory($category);
                $taxonomiesFilter[$category] = $taxonomies;
            }
            $this->pushResult('filters', $taxonomiesFilter);
        }
    }
コード例 #2
0
    /**
     * @param null $customerType
     * @param null $speciality
     * @param null $limit
     * @return array
     */
    public static function fetchBanners($customerType = null, $speciality = null, $limit = null)
    {
        $user = MMUsers::getCurrentUserObject();
        if($user)
        {
            $speciality = $user->attribute("user_speciality");
            $customerType = $user->customerTypeId();
        }

        $channels = self::fetchFeaturedByProfile($customerType, $speciality, $limit);
        $banners = array();

        $environment = ContextTool::instance()->environment();
        /** @var FeaturedChannel $channel */
        foreach($channels as $channel)
        {
            $application = $channel->application();
            if ($application == null) {
                continue;
            }
            $applicationLocalized = $application->applicationLocalized();
            if (!$applicationLocalized || !($applicationLocalized->attribute('environment') & $environment))
            {
                continue;
            }

            $channelConfiguration = ChannelConfiguration::getChannelConfigurationByApplicationLocalizedId($applicationLocalized->attribute("id"));

            $title = $channel->attribute("title");
            $subtitle = $channel->attribute("subtitle");

            if(!$title)
            {
                $title = $applicationLocalized->attribute("headline");
            }
            
            if(!$subtitle)
            {
                $subtitle = $channelConfiguration->attribute("subtitle");
            }

            $banners[] = array(
                "title" => $title,
                "subtitle" => $subtitle,
                "url"   => "/".$applicationLocalized->attribute("url"),
                "cover" => $channel->getCoverPath($channelConfiguration),
                "icon_small" => $channel->getIconSmallPath($channelConfiguration),
                "new" => $channel->getNewImage($channelConfiguration),
                "color" => $channel->getColor($channelConfiguration),
            );
        }

        return $banners;
    }