/**
     * @return bool
     */
    public function htmlBuildFullResult()
    {
        parent::htmlBuildFullResult();

        /* @type $dataMap eZContentObjectAttribute[] */
        $publishers = $this->applicationLocalized()->getCustomParameter("PublisherWithChildren");
        $dataMap = $this->node->dataMap();
        $taxonomies = $dataMap["serialized_taxonomies"]->content();
        $publisher = $taxonomies["publisher_folder"][0];

        if(is_array($publishers) && in_array($publisher, $publishers))
        {
            $this->resultHandler->sortBy = ContentListSolrQueryHandler::SORT_PRIORITY;
            $this->resultHandler->limit  = 50;

            $solrResult = $this->resultHandler->contentResultMain(false, false, false);
            $solrReturn = $this->resultHandler->articleResult($solrResult, array());

            if($solrReturn["articles_nb"] == 0)
            {
                return false;
            }

            $children = $this->setVariableAndGetTpl($solrReturn);
            if($children)
            {
                $this->pushResult('children', $children);
            }
        }

        return true;
    }
    /**
     * recursively get children for a specific parent path
     *
     * @param array $articles
     * @param string $parentPath
     * @return array
     */
    private function getChildren($articles, $parentPath)
    {
        $result = array();

        foreach($articles as $article)
        {
            if($parentPath.$article["meta_main_node_id_si"]."/" == $article["main_node_meta_path_string_ms"])
            {
                $publisherPath     = $article['subattr_publisher_folder___source_id____s'][0];
                $publisherInfo     = PublisherFolderTool::getPathToIDMapping($publisherPath);
                $publisherFolderId = $publisherInfo['pfid'];

                $result[] = array(
                    "title" => $article["attr_headline_s"],
                    "children" => $this->getChildren($articles, $article["main_node_meta_path_string_ms"]),
                    "url" => sprintf(
                        '%s/%s/%s',
                        $this->_application->applicationLocalized()->applicationUrl(),
                        $publisherFolderId,
                        $article["attr_".ClusterTool::clusterIdentifier()."_url_s"]
                    ),
                );
            }
        }

        return $result;
    }
 /**
  * @return string
  */
 protected function getPagelayoutTemplate()
 {
     switch (true)
     {
         case $this->isFull :
             return $this->_params['ModuleName'].'/'.$this->_params['Block'].'/full/pagelayout.tpl';
         case $this->isSeo :
             return $this->_params['ModuleName'].'/'.$this->_params['Block'].'/seo/pagelayout.tpl';
         case $this->isHomepage :
             return $this->_params['ModuleName'].'/'.$this->_params['Block'].'/list-home/pagelayout.tpl';
         default :
             return parent::getPagelayoutTemplate();
     }
 }
    /**
     * @return array
     */
    private function getFocusOnTaxonomyField()
    {
        $focusOnTaxonomy = false;

        if ( $this->_application->applicationLocalized()->getCustomParameter('FocusOnTaxonomyCategory') )
            $focusOnTaxonomy = $this->_application->applicationLocalized()->getCustomParameter('FocusOnTaxonomyCategory');
        elseif ( $this->_application->applicationObject()->getCustomParameter('FocusOnTaxonomyCategory') )
            $focusOnTaxonomy = $this->_application->applicationObject()->getCustomParameter('FocusOnTaxonomyCategory');

        if ( !$focusOnTaxonomy )
            return false;

        return array ( $focusOnTaxonomy => sprintf("subattr_%s___source_id____s", $focusOnTaxonomy) );
    }
    /**
     * @param ContentListBase $contentList
     * @param int[] $rootNodeIds
     */
    public function __construct( ContentListBase $contentList, $rootNodeIds )
    {
        $this->contentList = $contentList;
        $this->limit       = $this->getConfiguration( 'nb_of_articles_per_page' );
        $this->fragsize    = $this->getConfiguration( 'fragsize' );
        $this->withFeed    = $this->getConfiguration( 'with_feed' );
        $this->sortList    = $this->getConfiguration( 'sorting_list' );
        $this->sortBy      = $this->getConfiguration( 'default_sort' );
        $this->features    = $this->getConfiguration( 'featuring_list' );
        $this->rootNodeIds = $rootNodeIds;

        if(!$this->withFeed && $this->sortBy == self::SORT_MOST_RECENT)
            $this->sortBy = self::SORT_MOST_VIEWED;

        $this->mappingFieldsSolr = array(
            'node_id'              => 'meta_node_id_si',
            'object_id'            => 'meta_id_si',
            'language'             => 'meta_language_code_ms',
            'url'                  => 'attr_'.ClusterTool::clusterIdentifier().'_url_s',
            'headline'             => 'attr_headline_s',
            'promo_description'    => 'attr_promo_description_t',
            'rating'               => 'attr_content_rating_'.ClusterTool::clusterIdentifier().'_f',
            'views'                => 'attr_view_counter_'.ClusterTool::clusterIdentifier().'_i',
            'app_identifiers'      => 'subattr_parent_application___identifier____s',
            'apps'                 => 'subattr_local_application___source_mixed____s',
            'online_date'          => 'attr_online_date_dt',
            'score'                => 'score',
            'publisher_path'       => 'subattr_publisher_folder___source_id____s',
            'has_image'            => 'attr_has_image_'.ClusterTool::clusterIdentifier().'_bst',
            'media_types'          => 'attr_media_content_types_'.ClusterTool::clusterIdentifier().'_bst',
            'internal_id'          => 'attr_publisher_internal_id_s',
            'link_url'             => 'attr_media_content_link_'.ClusterTool::clusterIdentifier().'____ms',
            'source'               => 'attr_source_t'
        );

        if ($contentList->getCustomParameter('PromoTaxonomy') != null)
        {
            $this->mappingFieldsSolr['promo_taxonomy'] = "subattr_{$contentList->getCustomParameter('PromoTaxonomy')}___source_id____s";
        }

        if ($contentList->getCustomParameter('ShowDownloadableResourceIcon') != null)
        {
            $this->mappingFieldsSolr['resource_available'] = 'subattr_download_ressource___expiration_date____dt';
        }
        $this->additionnalTaxonomyFields = $this->getFeatureFields();
    }
    /**
     * @return bool
     */
    public function htmlBuildResult()
    {
        parent::htmlBuildResult();

        $applicationIds = CountryApplicationLibrary::fetchAuthorizedApplicationIds();

        foreach( $applicationIds as $k => $v )
        {
            if(!$v)
                unset($applicationIds[$k]);
        }

        $applicationIds                  = array_values($applicationIds);
        $applications                    = ApplicationLocalized::fetchApplicationList( array('id' => array($applicationIds)) );
        $applicationWebtrendsIdentifiers = array();

        foreach( $applications as $k => $app )
        {
            /* @var $app ApplicationObject */
            $applicationWebtrendsParams = $app->applicationLocalized()->webtrendsParams();

            if( trim($applicationWebtrendsParams['cg_n']) != '' )
                $applicationWebtrendsIdentifiers[strval($app->attribute('id'))] = $applicationWebtrendsParams['cg_n'];
        }

        $this->tpl()->setVariable( 'apps_wb_labels', $applicationWebtrendsIdentifiers );

        /* @var $app ApplicationLocalized */
        foreach( CacheApplicationTool::clusterApplications() as $app )
        {
            if( $app->applicationObject->identifier == 'merck-connect' )
            {
                $this->tpl()->setVariable( 'merck_connect_results', true );
                break;
            }
        }

        return true;
    }
    /**
     * @return void
     */
    public function htmlBuildResult()
    {
        if(!$this->isFull)
        {
            $facetData = $this->resultHandler->getEvrikaCityAndSpecialty();
            if (is_array($facetData))
            {  
                $facetData['cities'] = array_filter($facetData['cities'], function($count) { return $count > 0; }); 
                $facetData['specialties'] = array_filter($facetData['specialties'], function($count) { return $count > 0; });    
                $this->pushResult('cities', $facetData['cities']);
                $this->pushResult('specialties', $facetData['specialties']);
            }
            $this->pushResult( 'years', array(
                date('Y', strtotime('-2 years')),
                date('Y', strtotime('-1 years')),
                date('Y'),
                date('Y', strtotime('+1 years')),
                date('Y', strtotime('+2 years'))
            ) );
        }

        parent::htmlBuildResult();
    }
    public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized )
    {
        parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );

        foreach( $this->applicationLocalized()->publisherFolders as $publisherFolder )
        {
            /* @var $publisherFolder PublisherFolder */
            $publisherFolderObject  = eZContentObject::fetchByRemoteID( 'publisher_folder-'.$publisherFolder->attribute('path') );
            /* @var $publisherFolderNode eZContentObjectTreeNode */
            $publisherFolderNode    = $publisherFolderObject->mainNode();

            foreach( $publisherFolderNode->children() as $child )
            {
                /* @var $child eZContentObjectTreeNode */
                if( $child->classIdentifier() == 'article' )
                {
                    $this->node     = $child;
                    $this->isFull   = true;
                    header('x-ez-node: ' . 'P'.$this->node->attribute('node_id').'P' );
                }
            }
        }
    }
    /**
     * @return bool
     */
    public function htmlBuildResult()
    {
        if( !$this->isFull )
        {
            $solrResult     = $this->resultHandler->contentResultMain( true );
            $articleNodeIDs = array();

            foreach ( $solrResult['response']['docs'] as $doc )
                $articleNodeIDs[] = $doc['meta_node_id_si'][0];

            $this->pushResult('features', $this->getConfiguration('featuring_list'));
            $this->pushResult('articles', $articleNodeIDs);

            $solrReturn = $this->getResultHandler()->articleResult($solrResult, array());
            if($solrReturn["article_informations"] && $solrReturn["article_informations"]["articles_solrdata"])
            {
                $this->pushResult('articles_solrdata', $solrReturn["article_informations"]["articles_solrdata"]);
            }
        }
        
        parent::htmlBuildResult();

        return true;
    }
    public function __construct($params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized)
    {
        ContentListBase::__construct($params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized);

        $this->facets[1] = new FacetAnatomicalIllustrationsLayer();
    }
Esempio n. 11
0
    /**
     * @param ContentListBase $app
     * @param ChannelBlockConfiguration $configuration
     */
    private function addParamsConfiguration(ContentListBase &$app, ChannelBlockConfiguration $configuration)
    {
        $applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByLocalizedId($configuration->attribute("application_localized_id"));
        if(!$applicationLocalized)
        {
            return;
        }

        // Add filter q
        if($configuration->attribute("q"))
        {
            $app->getResultHandler()->searchQuery = $configuration->attribute("q");
        }

        // Add filter fq
        if($configuration->attribute("fq"))
        {
            $app->getResultHandler()->specialFilterChannel = $configuration->getSolrFq();
        }
        else {
            $useDepth = $applicationLocalized->getCustomParameter('ShowParentArticleOnly');
            if (!$useDepth)
            {
                $useDepth = $applicationLocalized->applicationObject()->getCustomParameter('ShowParentArticleOnly');
            }
            if ($useDepth) {
                $app->getResultHandler()->specialFilterChannel = 'attr_relative_depth_i: 0';
            }
        }

        // Sorting
        if($configuration->getChannelBlock()->attribute("sorting_method"))
        {
            $app->getResultHandler()->sortBy = $configuration->getChannelBlock()->attribute("sorting_method");
            if($app->getResultHandler()->sortBy == ContentListSolrQueryHandler::SORT_RANDOM)
            {
                $app->getResultHandler()->randomSortId = "channel_".$configuration->attribute("id")."_random";
            }
        }

        // Limit
        $app->getResultHandler()->limit = $this->getLimit($configuration->getChannelBlock());
    }
 public function __construct($params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized)
 {
     parent::__construct($params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized);
 }
    /**
     * @return string
     */
    protected function articleTemplate()
    {
        if( $this->displayLast )
            return $this->tpl()->fetch( 'design:'.$this->templateRootDirectory() . '/train-the-brain/main.tpl' );

        return parent::articleTemplate();
    }
 /**
  * @return bool
  */
 public function htmlBuildResult()
 {
     return ContentListBase::htmlBuildResult();
 }