/**
     * This method returns list of related publisher folders if custom parameter ShowPublisherLogos is != null
     * @return null|PublisherFolder[]
     */
    protected function getRelatedPublishers()
    {
        $publisherFolders = null;

        if ($this->getCustomParameter('ShowPublisherLogos') == null)
        {
            return $publisherFolders;
        }
        if ($this->node instanceof eZContentObjectTreeNode)
        {
            $dataMap            = $this->node->dataMap();
            $taxonomies         = $dataMap["serialized_taxonomies"]->content();
            $publisherPaths     = $taxonomies["publisher_folder"];

            foreach ($publisherPaths as $publisherPath)
            {
                $publisherFolders[] = $this->applicationLocalized()->getPublisherFolderFromPath( $publisherPath );
            }
        }
        else
        {
            $publisherFolders = $this->applicationLocalized()->publisherFolders;
        }
        return $publisherFolders;
    }
    /**
     * @param eZContentObjectTreeNode $node
     * @return string
     */
    public function getNodeUrl(&$node = null)
    {
        $token = $this->getToken();

        $dataMap                        = $node->dataMap();
        $mediaContentAttribute          = $dataMap['media_content'];
        $mediaContentAttributeContent   = $mediaContentAttribute->content();
        $linkObjectID                   = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
        $linkObject                     = eZContentObject::fetch( $linkObjectID );
        $linkDatamap                    = $linkObject->dataMap();
        $url                            = $linkDatamap['url']->content();

        $queryStringPosition = strpos($url, '?');
        $queryString = substr($url, $queryStringPosition + 1);
        $url = substr($url, 0, $queryStringPosition);

        $queryStringParts = array();

        parse_str($queryString, $queryStringParts);
        $queryStringParts[self::SESSION_ID_FIELD] = $token;

        $queryString = http_build_query($queryStringParts);
        $url .= '?' . $queryString;

        return $url;
    }
    /**
     * @param eZContentObjectTreeNode $node
     * @return string
     */
    public function getNodeUrl(&$node = null)
    {
        $dataMap                        = $node->dataMap();
        $mediaContentAttribute          = $dataMap['media_content'];
        $mediaContentAttributeContent   = $mediaContentAttribute->content();
        $linkObjectID                   = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
        $linkObject                     = eZContentObject::fetch( $linkObjectID );
        $linkDatamap                    = $linkObject->dataMap();
        $url                            = $linkDatamap['url']->content();
        $delimiter                      = ( strpos($url, '?') === false ) ? '?' : '&';
        $url                           .= $delimiter.'ID=mmed45652&PASSWORD=medicus&NEWS=n';

        return $url;
    }
    /**
     * @param eZContentObjectTreeNode $node
     * @return string
     */
    public function getNodeUrl(&$node = null)
    {
        $url = '';
        if ( $node )
        {
            $dataMap                        = $node->dataMap();
            $mediaContentAttribute          = $dataMap['media_content'];
            $mediaContentAttributeContent   = $mediaContentAttribute->content();
            $linkObjectID                   = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
            $linkObject                     = eZContentObject::fetch( $linkObjectID );
            $linkDatamap                    = $linkObject->dataMap();
            $url                            = $linkDatamap['url']->content();
        }

        return $url;
    }
 function addNews(eZContentObjectTreeNode $node)
 {
     $ini = eZINI::instance('xrowsitemap.ini');
     $news = new xrowSitemapItemNews();
     $images = array();
     // Adding the root node
     $object = $node->object();
     $news->publication_date = new DateTime('@' . $object->attribute('published'));
     $news->title = $object->attribute('name');
     $user = eZUser::fetch(eZUser::anonymousId());
     if (!xrowSitemapTools::checkAccess($object, $user, 'read')) {
         $news->access = 'Subscription';
     }
     // Get Genres, if enable
     if ((!$ini->hasVariable('NewsSitemapSettings', 'UseGenres') || $ini->hasVariable('NewsSitemapSettings', 'UseGenres') && $ini->variable('NewsSitemapSettings', 'UseGenres') != 'disable') && $ini->hasVariable('NewsSitemapSettings', 'Genres')) {
         $genres_array = $ini->variable('NewsSitemapSettings', 'Genres');
         // set genre if set
         if (isset($genres_array[$node->ClassIdentifier])) {
             $news->genres = array($genres_array[$node->ClassIdentifier]);
         }
     }
     $dm = $node->dataMap();
     $news->keywords = array();
     foreach ($dm as $attribute) {
         switch ($attribute->DataTypeString) {
             case 'xrowmetadata':
                 if ($attribute->hasContent()) {
                     $keywordattribute = $attribute->content();
                     $news->keywords = array_merge($news->keywords, $keywordattribute->keywords);
                 }
                 break;
             case 'ezkeyword':
                 if ($attribute->hasContent()) {
                     $keywordattribute = $attribute->content();
                     $news->keywords = array_merge($news->keywords, $keywordattribute->KeywordArray);
                 }
                 break;
         }
     }
     if ($ini->hasVariable('NewsSitemapSettings', 'AdditionalKeywordList')) {
         $news->keywords = array_merge($news->keywords, $ini->variable('NewsSitemapSettings', 'AdditionalKeywordList'));
     }
     return $news;
 }
    /**
     * @param eZContentObjectTreeNode $chapterNode
     * @return array
     */
    public static function fetchChapterSection( $chapterNode )
    {
        /* @type $dataMap eZContentObjectAttribute[] */
        $dataMap     = $chapterNode->dataMap();
        $serial      = $dataMap['serialized_taxonomies']->content();
        $remoteID    = $serial['section'][0];

        return self::fetchSection('remote', $remoteID);
    }
 /**
  * @param eZContentObjectTreeNode $node
  * @param bool $check
  *
  * @return bool|string
  */
 public function getAbstract($node, $check = false)
 {
     $has_content = false;
     $text = false;
     $strLenFunc = function_exists('mb_strlen') ? 'mb_strlen' : 'strlen';
     $ini = eZINI::instance('ocoperatorscollection.ini');
     if ($node instanceof eZContentObjectTreeNode) {
         if ($node->hasAttribute('highlight')) {
             $text = $node->attribute('highlight');
             $text = str_replace(' ', ' ', $text);
             $text = str_replace(' ', ' ', $text);
             if ($strLenFunc($text) > 0) {
                 $has_content = true;
             }
         }
         if (!$has_content) {
             $attributes = $ini->hasVariable('Abstract', 'Attributes') ? $ini->variable('Abstract', 'Attributes') : array();
             if (!empty($attributes)) {
                 /** @var eZContentObjectAttribute[] $dataMap */
                 $dataMap = $node->dataMap();
                 foreach ($attributes as $attr) {
                     if (isset($dataMap[$attr])) {
                         if ($dataMap[$attr]->hasContent()) {
                             $tpl = eZTemplate::factory();
                             $tpl->setVariable('attribute', $dataMap[$attr]);
                             $designPath = "design:content/datatype/view/" . $dataMap[$attr]->attribute('data_type_string') . ".tpl";
                             $text = $tpl->fetch($designPath);
                             $text = str_replace(' ', ' ', $text);
                             if ($strLenFunc(strip_tags($text)) > 0) {
                                 $has_content = true;
                             }
                             break;
                         }
                     }
                 }
             }
         }
     }
     if ($check) {
         return $has_content;
     } else {
         return $text;
     }
 }