/**
  * @param string $systemCode
  * @return mixed
  */
 public static function getLocaleBySystemCode( $systemCode )
 {
     return SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), $systemCode );
 }
    /**
     * @param array $parameters
     * @return array
     */
    protected function callEsbWrite( $parameters = null )
    {
        if ( is_null( $parameters ) )
        {
            /* @type $availableDateParams array */
            /* @type $availableParams array */
            $esbParams                  = array();
            $formatDate                 = SolrSafeOperatorHelper::clusterIni('EsbDateConvert', 'FormatDate', 'merck.ini' );
            $availableDateParams        = SolrSafeOperatorHelper::clusterIni('EsbDateConvert', 'AvailableDateParams', 'merck.ini' );
            $availableParams            = SolrSafeOperatorHelper::clusterIni('EsbSettings', 'AvailableParams', 'merck.ini' );
            $skipParametersIfEmptyValue = SolrSafeOperatorHelper::clusterIni('SkipParametersIfEmptyValue', 'SkipParameter', 'merck.ini' );

            foreach ( $availableParams as $esbParam )
            {
                if ( isset( $_POST[$esbParam] ) )
                {
                    if( $this instanceof ServiceUserUUMP && !empty( $availableDateParams ) && isset( $availableDateParams[$esbParam] ) && !empty($_POST[$esbParam]) )
                    {
                        $esbParams[$esbParam] = $this->convertDateforUUMP( $_POST[$esbParam], $formatDate );
                    }
                    else
                    {
                        if($esbParam != 'addressLine1' && $esbParam != 'addressLine2')
                        {
                            $esbParams[$esbParam] = strip_tags($_POST[$esbParam]);
                        }
                        else
                        {
                            $esbParams[$esbParam] = $_POST[$esbParam];
                        }
                    }

                    if( $this instanceof ServiceUserUUMP && !empty( $skipParametersIfEmptyValue ) && isset( $skipParametersIfEmptyValue[$esbParam] ) && empty( $_POST[$esbParam] ) )
                    {
                        unset( $esbParams[$esbParam] );
                    }
                }
            }
            $isHtmlEntitiesAlowed = self::isAddressEncodeAllowedOnCluster();

            $addressLine1 = $this->getBusinessNameMapping( 'addressLine1' );
            if ( isset( $esbParams[$addressLine1] ) && !empty( $esbParams[$addressLine1] ) && $isHtmlEntitiesAlowed )
            {
                $esbParams[$addressLine1] = htmlentities( $esbParams[$addressLine1], ENT_QUOTES, 'UTF-8' );
            }

            $addressLine2 = $this->getBusinessNameMapping( 'addressLine2' );
            if ( isset( $esbParams[$addressLine2] ) && !empty( $esbParams[$addressLine2] ) && $isHtmlEntitiesAlowed )
            {
                $esbParams[$addressLine2] = htmlentities( $esbParams[$addressLine2], ENT_QUOTES, 'UTF-8' );
            }

            if( SolrSafeOperatorHelper::featureIsActive( 'RegistrationSettings' ) )
            {
                if( isset( $_POST['emailAddress'] ) && ClusterTool::clusterIdentifier() == 'cluster_jp' )
                {
                    $usernameField = $this->getBusinessNameMapping( 'userName' );
                    $esbParams[$usernameField] = $_POST['emailAddress'];
                }
            }

            if ( in_array(self::SUBSCRIPTION_PHONE_CONSENT, $availableParams) )
            {
                $phoneConsent = array(
                    'consentCode' => self::SUBSCRIPTION_PHONE_CONSENT,
                    'consentStatus' => !empty( $esbParams[self::SUBSCRIPTION_PHONE_CONSENT] ) ? self::SUBSCRIPTION_STATUS_SUBSCRIBED : self::SUBSCRIPTION_STATUS_UNSUBSCRIBED,
                    'consentLastUpdate' => time(),
                );
                $parametersConsent = array(
                    'data' => array(
                        'profile' => array(
                            'userId'   => $this->getUserId(),
                            'countryOfRegistration' => $this->getCountryOfRegistration(),
                            'consents' => $phoneConsent,
                            'locale' => SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'esb_locale' )
                        )
                    ),
                );
                $this->callWSHandler( $this->getEsbInterface( 'subsupdate' ), $parametersConsent );
                unset( $esbParams[self::SUBSCRIPTION_PHONE_CONSENT] );
            }
            $parameters = $this->getWriteParameters($esbParams);

            if( $this instanceof ServiceUserUUMP )
            {
                $sl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'esb_locale' );
                if ( !is_null( $sl ) )
                {
                    $parameters['data']['profile']['locale'] = $sl;
                }
            }
        }

        $result = $this->callWSHandler( $this->getEsbInterface( 'write' ), $parameters );

        return $result;
    }
예제 #3
0
 /**
  * @return array
  */
 public function toServiceAgreementTicket()
 {
     if(SolrSafeOperatorHelper::featureIsActive('UUMP'))
     {
         $parameters = array(
             'data' => array(
                 'profile' => array(
                     'userId'    => $this->_userName,
                     'privacyPolicy'  => $this->_privacyPolicy,
                     'termsOfUse'    => $this->_termsOfUse,
                     'countryOfRegistration' => $this->_countryOfRegistration,
                 ),
             ),
         );
         $sl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'esb_locale' );
         if ( !is_null( $sl ) )
         {
             $parameters['data']['profile']['locale'] = $sl;
         }
         return $parameters;
     }
     else
     {
         return array(
             'Data' => array(
                 'Username' => $this->_userName,
                 'Params'   => array(
                     'count'           => 2,
                     'Privacy_policy'  => $this->_privacyPolicy,
                     'Terms_of_use'    => $this->_termsOfUse,
                 )
             ),
             'cr' => $this->_countryOfRegistration,
         );
     }
 }
    /**
     * @param $appArticles
     * @param bool $subject
     * @param bool $debug
     * @return array
     */
    protected function constructTemplateAssocArray($appArticles, $subject = false, $debug = false, $supersubject = false, $clusterIdentifier)
    {
        //domains
        $domainsInClusters = eZINI::instance( 'merck.ini' )->variable( 'DomainMappingSettings', 'ClusterDomains' );
        $domain = $domainsInClusters[$clusterIdentifier];

        // Link
        $merckIni = eZINI::instance( 'merck.ini' );
        $urlAdditionalValues = $merckIni->variable( 'RssUrlSettings', 'AdditionalValues' );

        //application
        $applicationInfos = $this->getApplicationInfos($appArticles['applicationDictionaryRow']['application_id'], $clusterIdentifier);
        $applicationTitle = $applicationInfos['headline'];
        $applicationUrl = 'http://' . rtrim($domain, '/') . '/' . $applicationInfos['url'];
        $applicationImage = isset($appArticles['applicationDictionaryRow']['publisher_logo']) && !is_null($appArticles['applicationDictionaryRow']['publisher_logo']) ? $appArticles['applicationDictionaryRow']['publisher_logo'] : '';
        $applicationElementsNumber = $appArticles['applicationDictionaryRow']['number_article_ns'];
        $applicationTopArticlesNumber =  $appArticles['applicationDictionaryRow']['number_article_top'];


        $articles = $appArticles['articles'];

        $orderedListArticles = array();

        //topArticle
        $hasTopArticle = true;
        $hasTopArticles = false;
        $topArticleImage = false;

        //otherArticles
        $otherArticles = array();

        $elementCount = 0;
        $locale = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'exact_target' );

        foreach ( $articles as $article )
        {
            //publisher folder
            $publisherPath = $article['subattr_publisher_folder___source_id____s'][0];
            $publisherId   = PublisherFolderTool::getPathToIDMapping($publisherPath);

            if($applicationElementsNumber != -1)
            {
                if($elementCount >= $applicationElementsNumber)
                {
                    break;
                }
            }

            if(isset($article["is_sdk_b"]) && $article["is_sdk_b"])
            {
                $url = '/' . $applicationInfos['url'] . '/' . $article['meta_url_alias_ms'][0];
            }
            else
            {
                $url = '/' . $applicationInfos['url'] . '/' . $publisherId['pfid'] . '/' . $article['attr_' . $clusterIdentifier . '_url_s'];
            }

            if ( isset( $urlAdditionalValues[$clusterIdentifier] ) )
            {
                $linkUrl = 'http://' . rtrim($domain, '/') . '/' . $urlAdditionalValues[$clusterIdentifier] . $url;
            }
            else
            {
                $linkUrl = 'http://' . rtrim($domain, '/') . $url;
            }

            $image = null;
            $hasImageArray = json_decode( base64_decode($article['attr_has_image_' . $clusterIdentifier . '_bst']) );
            $publishDate = DateTime::createFromFormat("Y-m-d\TH:i:s\Z", $article["attr_online_date_dt"])->format('Y-m-d H:i:s');
            $isEmptyHeadline = trim($article['attr_promo_headline_t']) == "";

            if ( SolrSafeOperatorHelper::hasImageArticleFromSolr( array( 'has_image' => $hasImageArray ), 1) )
            {
                $image = SolrSafeOperatorHelper::getImageArticleUrl(1, $article['meta_id_si'], $article['meta_language_code_ms'], 'm_mosaic');
                $image = 'http://' . rtrim($domain, '/') . $image;
            }

            if(!is_null($article['attr_featured_content_b']) && $article['attr_featured_content_b'] == true)
            {
                $hasTopArticle = true;
                $topArticleImage = false;

                if($image)
                {
                    //$topArticleImage = $this->getImageFromArticleNodeId($image);
                    $topArticleImage = $image;
                }

                //top top articles
                if( !$isEmptyHeadline )
                {
                    $title = $article['attr_headline_s'];
                    if ($subject)
                    {
                        $title = '';
                        if ($this->getRssType() != 'oncology' )
                        {
                            $title = $article['attr_headline_s'];
                        }
                        if (!$isEmptyHeadline) {
                            $title = $article['attr_promo_headline_t'];
                        }
                    }



                    $xmlTitle = $this->escapeStr( $title );

                    if($clusterIdentifier == 'cluster_pt')
                    {
                        $xmlTitle = $this->escapeStr( $article['attr_promo_headline_t']);
                    }


                    $expirationDate = null;
                    if(isset($article['subattr_download_ressource___expiration_date____dt']))
                    {
                        $i=0;
                        foreach($article['subattr_download_ressource___expiration_date____dt'] as $exDate){
                            $expirationDate_tmp[$i] = DateTime::createFromFormat("Y-m-d\TH:i:s\Z", $exDate)->format('Y.m.d H:i');
                            $i++;
                        }
                            $expirationDate = max($expirationDate_tmp);
                    }
                    $orderedListArticles['toptop'][] = array (
                        'title'         => $xmlTitle,
                        'url'           => $this->buildUrl($linkUrl, $locale),
                        'description'   => $article['attr_promo_description_t'],
                        'source'        => $article['attr_source_t'],
                        'image'         => $topArticleImage ? $topArticleImage : '',
                        'publishDate'   => $publishDate,
                        'coreContent'   => $article['attr_core_content_t'],
                        'guid'          => $article['attr_node_remote_s'],
                        'expirationDate'    => $expirationDate,
                        'hasQuizReplies'    => ( isset($article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms']) && count($article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms']) > 0 ),
                        'quizReplies'       => $article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms'],
                        'hasQuizPoints' => isset($article['attr_media_content_quiz_points_' . ClusterTool::clusterIdentifier() . '_i']),
                        'quizPoints'    => $article['attr_media_content_quiz_points_' . ClusterTool::clusterIdentifier() . '_i'],
                        'hasQuizQuestion'   => isset($article['attr_media_content_quiz_question_' . ClusterTool::clusterIdentifier() . '_ms']),
                        'quizQuestion'      => $article['attr_media_content_quiz_question_' . ClusterTool::clusterIdentifier() . '_ms'],
                    );
                }
                //top articles
                else
                {
                    $title = $article['attr_headline_s'];
                    if ($subject)
                    {
                        $title = '';
                        if ($this->getRssType() != 'oncology' )
                        {
                            $title = $article['attr_headline_s'];
                        }
                        if (!$isEmptyHeadline) {
                            $title = $article['attr_promo_headline_t'];
                        }
                    }
                    $expirationDate = null;
                    if(isset($article['subattr_download_ressource___expiration_date____dt']))
                    {
                        $i=0;
                        foreach($article['subattr_download_ressource___expiration_date____dt'] as $exDate){
                            $expirationDate_tmp[$i] = DateTime::createFromFormat("Y-m-d\TH:i:s\Z", $exDate)->format('Y.m.d H:i');
                            $i++;
                        }
                        $expirationDate = max($expirationDate_tmp);
                    }
                    $orderedListArticles['top'][] = array (
                        'title'         => $title,
                        'url'           => $this->buildUrl($linkUrl, $locale),
                        'description'   => $article['attr_promo_description_t'],
                        'source'        => $article['attr_source_t'],
                        'image'         => $topArticleImage ? $topArticleImage : '',
                        'publishDate'   => $publishDate,
                        'coreContent'   => $article['attr_core_content_t'],
                        'guid'          => $article['attr_node_remote_s'],
                        'expirationDate'    => $expirationDate,
                        'hasQuizReplies'    => ( isset($article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms']) && count($article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms']) > 0 ),
                        'quizReplies'       => $article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms'],
                        'hasQuizPoints' => isset($article['attr_media_content_quiz_points_' . ClusterTool::clusterIdentifier() . '_i']),
                        'quizPoints'    => $article['attr_media_content_quiz_points_' . ClusterTool::clusterIdentifier() . '_i'],
                        'hasQuizQuestion'   => isset($article['attr_media_content_quiz_question_' . ClusterTool::clusterIdentifier() . '_ms']),
                        'quizQuestion'      => $article['attr_media_content_quiz_question_' . ClusterTool::clusterIdentifier() . '_ms'],
                    );
                }
            }
            //otherArticles
            else
            {
                $title = $article['attr_headline_s'];
                if ($subject)
                {
                    $title = '';
                    if ($this->getRssType() != 'oncology' )
                    {
                        $title = $article['attr_headline_s'];
                    }
                    if (!$isEmptyHeadline) {
                        $title = $article['attr_promo_headline_t'];
                    }
                }
                $expirationDate = null;
                if(isset($article['subattr_download_ressource___expiration_date____dt']))
                {
                    $i=0;
                    foreach($article['subattr_download_ressource___expiration_date____dt'] as $exDate){
                        $expirationDate_tmp[$i] = DateTime::createFromFormat("Y-m-d\TH:i:s\Z", $exDate)->format('Y.m.d H:i');
                        $i++;
                    }
                    $expirationDate = max($expirationDate_tmp);
                }

                $orderedListArticles['others'][] = array(
                    'title'             => $title,
                    'url'               => $this->buildUrl($linkUrl, $locale),
                    'description'       => $article['attr_promo_description_t'],
                    'source'        => $article['attr_source_t'],
                    'image'             => $image,
                    'isTop'             => false,
                    'publishDate'       => $publishDate,
                    'coreContent'       => $article['attr_core_content_t'],
                    'guid'              => $article['attr_node_remote_s'],
                    'expirationDate'    => $expirationDate,
                    'hasQuizReplies'    => ( isset($article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms']) && count($article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms']) > 0 ),
                    'quizReplies'       => $article['attr_media_content_quiz_replies_' . ClusterTool::clusterIdentifier() . '____ms'],
                    'hasQuizPoints' => isset($article['attr_media_content_quiz_points_' . ClusterTool::clusterIdentifier() . '_i']),
                    'quizPoints'    => $article['attr_media_content_quiz_points_' . ClusterTool::clusterIdentifier() . '_i'],
                    'hasQuizQuestion'   => isset($article['attr_media_content_quiz_question_' . ClusterTool::clusterIdentifier() . '_ms']),
                    'quizQuestion'      => $article['attr_media_content_quiz_question_' . ClusterTool::clusterIdentifier() . '_ms'],
                );
            }

            $elementCount++;
        }

        if($debug)
        {
            var_dump("ORDERED ", $appArticles["applicationDictionaryRow"]["id"], $orderedListArticles);
        }

        //get top article
        if($applicationTopArticlesNumber > 1){
            $hasTopArticles = true;
            for($i = 0; $i < $applicationTopArticlesNumber; $i++){
                if(count($orderedListArticles['toptop']) > 0)
                {
                    $topArticle = array_shift($orderedListArticles['toptop']);
                    
                    $topArticleImage = isset($topArticle['image']) ? $topArticle['image'] : null ;
                    $hasQuizReplies  = isset($topArticle['hasQuizResplies']) ? $topArticle['hasQuizReplies'] : false;
                    $quizReplies     = isset($topArticle['quizReplies']) ? $topArticle['quizReplies'] : null;
                    
                    $topArticles[] = $topArticle;
                }
                else if(count($orderedListArticles['top']) > 0)
                {
                    $topArticle = array_shift($orderedListArticles['top']);
                    
                    $topArticleImage = isset($topArticle['image']) ? $topArticle['image'] : null ;
                    $hasQuizReplies  = isset($topArticle['hasQuizReplies']) ? $topArticle['hasQuizReplies'] : false;
                    $quizReplies     = isset($topArticle['quizReplies']) ? $topArticle['quizReplies'] : null;
                    
                    $topArticles[] = $topArticle;
                }
                else if(count($orderedListArticles['others']) > 0)
                {
                    $topArticle = array_shift($orderedListArticles['others']);
                    
                    $topArticleImage = isset($topArticle['image']) ? $topArticle['image'] : null ;
                    $hasQuizReplies  = isset($topArticle['hasQuizReplies']) ? $topArticle['hasQuizResplies'] : false;
                    $quizReplies     = isset($topArticle['quizReplies']) ? $topArticle['quizReplies'] : null;
                    
                    $topArticles[] = $topArticle;
                }
            }
        }
        else if($applicationTopArticlesNumber == 1){
            if(count($orderedListArticles['toptop']) > 0)
            {
                $topArticle = array_shift($orderedListArticles['toptop']);
                $topArticleImage = isset($topArticle['image']) ? $topArticle['image'] : null ;
                $hasQuizReplies  = isset($topArticle['hasQuizReplies']) ? $topArticle['hasQuizReplies'] : false;
                $quizReplies     = isset($topArticle['quizReplies']) ? $topArticle['quizReplies'] : null;
            }
            else if(count($orderedListArticles['top']) > 0)
            {
                $topArticle = array_shift($orderedListArticles['top']);
                $topArticleImage = isset($topArticle['image']) ? $topArticle['image'] : null ;
                $hasQuizReplies  = isset($topArticle['hasQuizReplies']) ? $topArticle['hasQuizReplies'] : false;
                $quizReplies     = isset($topArticle['quizReplies']) ? $topArticle['quizReplies'] : null;
            }
            else if(count($orderedListArticles['others']) > 0)
            {
                $topArticle = array_shift($orderedListArticles['others']);
                $topArticleImage = isset($topArticle['image']) ? $topArticle['image'] : null ;
                $hasQuizReplies  = isset($topArticle['hasQuizReplies']) ? $topArticle['hasQuizReplies'] : false;
                $quizReplies     = isset($topArticle['quizReplies']) ? $topArticle['quizReplies'] : null;
            }
            $topArticles = array(
                $topArticle
            );
            $hasTopArticles = $topArticle != null;
        }
        
        //othersArticles
        if(count($orderedListArticles['toptop']) > 0)
        {
            $otherArticles = $orderedListArticles['toptop'];
        }

        if(count($orderedListArticles['top']) > 0)
        {
            $otherArticles = array_merge($otherArticles, $orderedListArticles['top']);
        }

        if(count($orderedListArticles['others']) > 0)
        {
            $otherArticles = array_merge($otherArticles, $orderedListArticles['others']);
        }

        return array(
            'applicationTitle'    => $applicationTitle,
            'applicationUrl'      => $this->buildUrl($applicationUrl, $locale),
            'applicationHasImage' => !empty($applicationImage),
            'applicationImage'    => $applicationImage,
            'hasOtherArticle'     => ( count($otherArticles) != 0 ),
            'otherArticles'       => $otherArticles,
            'hasOtherArticles'    => ( count($otherArticles) != 0 ),
            'topArticle'          => ( isset ($topArticle) ? $topArticle : null ),
            'topArticles'         => ( isset ($topArticles) ? $topArticles : null ),
            'topArticleHasImage'  => $topArticleImage,
            'hasTopArticle'       => $hasTopArticle,
            'hasTopArticles'      => $hasTopArticles,
            'hasQuizReplies'      => $hasQuizReplies,
            'quizReplies'         => $quizReplies,
            
        );
    }
예제 #5
0
    /**
     * @param string $uumpId
     * @param string $email
     * @param string $senderComment
     * @param string $appName
     * @param string $articleUrl
     * @param string $articleExtract
     * @param string $articleTitle
     */
    public static function sendToAColleague( $uumpId, $email, $senderComment, $appName, $articleUrl, $articleExtract, $articleTitle )
    {
        $params = self::getParams();
        $username = $params["username"];
        $password = $params["password"];
        $clientId = $params["clientId"];

        $client = new ExactTargetSoapClient( $params["wsdl"], array( 'trace' => 1 ) );
        $client->username = $username;
        $client->password = $password;

        $subscriber = new ExactTarget_Subscriber();
        $subscriber->SubscriberKey = $email;
        $subscriber->EmailAddress = $email;

        $attrSenderComment = new ExactTarget_Attribute();
        $attrSenderComment->Name = 'senderComment';
        $attrSenderComment->Value = $senderComment;

        $attrAppName = new ExactTarget_Attribute();
        $attrAppName->Name = 'appName';
        $attrAppName->Value = $appName;

        $attrArticleUrl = new ExactTarget_Attribute();
        $attrArticleUrl->Name = 'articleUrl';
        $attrArticleUrl->Value = $articleUrl;

        $attrArticleExtract = new ExactTarget_Attribute();
        $attrArticleExtract->Name = 'articleExtract';
        $attrArticleExtract->Value = $articleExtract;

        $attrArticleTitle = new ExactTarget_Attribute();
        $attrArticleTitle->Name = 'articleTitle';
        $attrArticleTitle->Value = $articleTitle;

        $attrUumpId = new ExactTarget_Attribute();
        $attrUumpId->Name = 'uumpId';
        $attrUumpId->Value = $uumpId;

        $attrLocale = new ExactTarget_Attribute();
        $attrLocale->Name = 'Locale';
        $sl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'exact_target' );
        $attrLocale->Value = !is_null( $sl ) ? $sl : eZINI::instance()->variable( 'RegionalSettings', 'ContentObjectLocale' );

        $subscriber->Attributes = array(
            $attrSenderComment,
            $attrAppName,
            $attrArticleUrl,
            $attrArticleExtract,
            $attrArticleTitle,
            $attrUumpId,
            $attrLocale,
        );

        $tsd = new ExactTarget_TriggeredSendDefinition();
        $tsd->CustomerKey = 'trigSendToColleague';

        $ts = new ExactTarget_TriggeredSend();
        $ts->Subscribers = array();
        $ts->Subscribers[] = $subscriber;
        $ts->TriggeredSendDefinition = $tsd;

        $cid = new ExactTarget_ClientID();
        $cid->ID = $clientId;
        $ts->Client = $cid;

        $object = new SoapVar( $ts, SOAP_ENC_OBJECT, 'TriggeredSend', self::SOAP_NAMESPACE);

        $request = new ExactTarget_CreateRequest();

        $request->Options = NULL;
        $request->Objects = array( $object );

        self::sendRequest( $client, $request, 'SEND TO A COLLEAGUE' );
    }
    public function subsupdate()
    {
        $parameters = array(
            'data' => array(
                'profile' => array(
                    'userId'   => $this->getUserId(),
                    'countryOfRegistration' => $this->getCountryOfRegistration(),
                    'consents' => array(),
                )
            ),
        );
        
        $sl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'esb_locale' );
        if ( !is_null( $sl ) )
        {
            $parameters['data']['profile']['locale'] = $sl;
        }
        
        $mappingFormToConsent = self::getMappingFormToConsent();
        
        $inlineConsents = file_get_contents('php://input');
        
        if(json_decode($inlineConsents, true)){
            $parameters['data']['profile']['consents'][] = json_decode($inlineConsents, true);
        }

        foreach ($_POST as $consentCode => $formId)
        {
            if ( is_array($mappingFormToConsent[$consentCode]) )
            {
                $consent                    = array();
                $consent['consentCode']     = $consentCode;
                $consentList                = $mappingFormToConsent[$consentCode][$formId];
                $consentArray               = explode(';',$consentList);
                $consent['consentStatus']   = $consentArray[0];

                if ( count($consentArray) == 2 )
                    $consent['consentFrequency'] = $consentArray[1];

                $parameters['data']['profile']['consents'][] = $consent;
            }
        }

        if ( isset( $_POST['defaultCreateFrequency'] ) )
        {
            $uniSubs = $this->getUnivadisSubscriptions();
            if ( count( $uniSubs ) > 0 )
            {
                foreach ( $uniSubs as $uniSub )
                {
                    foreach ( $parameters['data']['profile']['consents'] as &$fconsent )
                    {
                        if ( $fconsent['consentCode'] == $uniSub['consentCode'] )
                        {
                            if ( isset( $fconsent['consentFrequency'] ) )
                            {
                                if ( $fconsent['consentFrequency'] != $uniSub['consentFrequency'] )
                                {
                                    $fconsent['consentFrequency'] = $uniSub['consentFrequency'];
                                }
                            }
                        }
                    }
                }
            }
        }

        return array_merge( $this->callWSHandler( $this->getEsbInterface( 'subsupdate' ), $parameters ), array( 'SubParams' => $a ) );
    }
    /**
     * @return array
     */
    public function getSocialInfos()
    {
        if( !($this->node instanceof eZContentObjectTreeNode)
            || $this->node->attribute('class_identifier') != 'article' )
            return array();

        /* @type eZContentObjectAttribute[] $dataMap */
        $dataMap     = $this->node->dataMap();
        $headline    = $dataMap["headline"]->content();
        $urlParams   = array();
        $description = "";
        $imageUrl    = "";
        $urlGet      = "";

        if ( ClusterTool::isTwoLangCluster() )
        {
            $urlParams['ll'] = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'exact_target' );
        }

        if($dataMap["promo_description"]->hasContent())
        {
            $description = strip_tags($dataMap["promo_description"]->content());
        }

        if ( count($urlParams) > 0 )
        {
            $urlGet = '?' . http_build_query($urlParams);
        }

        if ( NodeOperatorHelper::hasImageArticle($this->node, ImageArticleTool::SLIDE_APPLICATION_CASE ) )
        {
            $imageUrl = SolrSafeOperatorHelper::getImageArticleUrl(
                ImageArticleTool::SLIDE_APPLICATION_CASE,
                $this->node->attribute('contentobject_id'),
                $this->node->currentLanguage(),
                'dt_full'
            );
            $imageUrl .= $urlGet;
        }

        return array(
            "title"       => $headline,
            "description" => $description,
            "url"         => $this->applicationName()."/".$this->node->remoteID().$urlGet,
            "imageUrl"    => $imageUrl
        );
    }
    protected function relogError()
    {
        if( SolrSafeOperatorHelper::featureIsActive( 'AsynchronousAnalyticsLoginCall' ) && SolrSafeOperatorHelper::feature( 'AsynchronousAnalyticsLoginCall', 'GoogleAnalytics' ) )
        {
            $amq = new ActiveMQManager();
            $domains = eZINI::instance( 'merck.ini' )->variable( 'DomainMappingSettings', 'ClusterDomains' );
            $domain  = isset( $domains[ClusterTool::clusterIdentifier()] ) ? $domains[ClusterTool::clusterIdentifier()] : 'unidentified.univadis.com';
            $gasl = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'ga_visitor_country' );
            $gaCountry = !is_null( $gasl ) ? $gasl : '';
            $gaParams = array(
                'v'   => 1,
                'tid' => 'UA-41415675-2',
                'uid' => 'relog_error_' . time(),
                't'   => 'event',
                'ec'  => 'esb',
                'ea'  => 'autologin-fail',
                'ni'  => 1,
                'cd2' => 'anonymous',
                'cd7' => $gaCountry,
                'dh'  => preg_replace( '#^.*?\.#', '', $domain ),
            );
            $gaParams = 'https://ssl.google-analytics.com/collect?' . http_build_query( $gaParams );
            $amq->sendMessageToQueue( 'portail.analytics.google', $gaParams );
        }

        $domain = preg_replace( '#^https?://#', '', ContextTool::instance()->domain() );
        $domainParts = explode('.', $domain);
        while( count($domainParts) > 1 )
        {
            setcookie( 'remember_me', '', time() - 3600, '/', implode('.', $domainParts ) );
            array_shift( $domainParts );
        }

        $context = isset( $_REQUEST['context'] ) ? $_REQUEST['context'] : ContextTool::instance()->domain().'/';

        return $this->response($context);
    }