/**
     * @param string $username
     * @param ESBResult $esbResult
     * @return array
     */
    public static function readCall( $username, $esbResult )
    {
        $countryOfRegistration = self::getCountryOfRegistration();
        $params = eZINI::instance('merck.ini')->variable( 'EsbSettings', 'AvailableParams' );

        if ( !isset( $params ) || !is_array( $params ) )
        {
            MMUserLogin::logError( $username, null, $esbResult->toTicket(), 'Missing esb login parameters. Check merck.ini configuration.' );
            return;
        }

        if( !in_array( 'Registration_date', $params ) && SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) )
        {
            $params[] = 'Registration_date';
        }
        
        // List of needed profile information
        $readParameters = array(
            'Data' => array(
                'Username' => $username,
                'Params' => $params
            ),
            'cr' => $countryOfRegistration
        );

        // Fires a request to get user profile data
        return WSHelper::call( "read", $readParameters );
    }
Exemplo n.º 2
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);
        }
    }
    /**
     * @return array
     */
    public function additionalSolrFilters()
    {
        $filters = array();
        
        if( !$this->contentList->isFull )
        {
            //Show only last article (HTML)
            if( $this->contentList->getOutputType() == 'html' )
            {
                $this->limit = 99;
                $filters[]   = 'attr_date_dt:[NOW-7DAY/DAY TO NOW]';
            }
            //Exclude last articles (JSON)
            elseif( count( $this->excludeIds ) > 0 )
            {
                if (!SolrSafeOperatorHelper::featureIsActive('jamaNetworkListView'))
                {
                    $filters[] = '-meta_node_id_si:(' . implode(' OR ', $this->excludeIds) . ')';
                }
            }

        }

        return $filters;
    }
    /**
     * @return array User FirstName, LastName and Address.
     */
    public static function readUserData()
    {
        $service = ESBFactory::getUserService();

        $result = $service->form();
        if ( SolrSafeOperatorHelper::featureIsActive('UUMP') )
        {
            $params = $result['data']["profile"];
        }
        else
        {
            $params = $result['Data']["Params"];
        }
        $addressLines = array();
        $addressLine1 = $params[$service->getBusinessNameMapping( 'addressLine1' )];
        $addressLine2 = $params[$service->getBusinessNameMapping( 'addressLine2' )];
        if ( $addressLine1 )
        {
            $addressLines[] = $addressLine1;
        }
        if ( $addressLine2 )
        {
            $addressLines[] = $addressLine2;
        }
        $address = implode("\n", $addressLines);

        return array(
            'FirstName'   => $params[$service->getBusinessNameMapping( 'firstName' )],
            'LastName'    => $params[$service->getBusinessNameMapping( 'lastName' )],
            'UserAddress' => $address,
        );
    }
    /**
     * @return string
     */
    protected function validateToU()
    {
        if( !self::user() )
            return false;

        self::user()->toUValidated(true);

        $context = ContextTool::instance()->backUrl();
        $context = isset( $_POST['context'] ) ? $_POST['context'] : '/';

        // @todo: update ESB by sending validation status
        $esbResult = new ESBResult();
        $userService = ESBFactory::getUserService();

        if(SolrSafeOperatorHelper::featureIsActive('UUMP'))
        {
            
            $result = $userService->read(self::user()->attribute('uuid'));
            ServiceLoginUUMP::populateESBResult($esbResult, $result);
        }
        else
        {
            $result = ServiceLogin::readCall(self::user()->attribute('uuid'), $esbResult);
            ServiceLogin::populateESBResult($esbResult, $result);
        }

        $esbResult->userName = self::user()->attribute('uuid');
        $esbResult->termsOfUse = 'Y';
        $esbResult->privacyPolicy = 'Y';

        if( SolrSafeOperatorHelper::featureIsActive('UUMP') || (ClusterTool::clusterIdentifier() == "cluster_at") )
        {
            $esbResult->termsOfUse = '1';
            $esbResult->privacyPolicy = '1';
        }
        $esbResult->countryOfRegistration = self::user()->attribute( 'country' );

        $userService->write($esbResult->toServiceAgreementTicket());

        // if the ESB call fails, we still validate the user input to let him access the content
        $esbResult->forceToUValidated = true;
        $esbResult->sessionID = $_COOKIE[self::iniMerck()->variable('TIBCOCookieSettings', 'TIBCOCookieName')];

        $loginResult = MMUserLogin::esbLogin( self::user()->attribute('uuid'), $esbResult, false, $context );
        if ( $loginResult )
        {
            // Stringify params
            $strParams = json_encode( $loginResult['params'] );

            // Encrypts params
            $encryptedParams = MMUserLogin::encryptText( $strParams );
            // Redirect to PHP-ESI
            $redirectURL = ContextTool::instance()->domain()."/loginActions.php?context=" . urlencode( $loginResult['destUrl'] ) . "&params=" . urlencode( $encryptedParams );
        
            return $redirectURL;
        }
    }
    /**
     * @param string $facetAttribute attribute field from FacetField class
     * @return string[] list of taxonomies
     */
    static function getForcedCheckedTaxonomy( $facetAttribute )
    {
        if (SolrSafeOperatorHelper::featureIsActive('FacetTaxonomy')) {
            $forcedCheckedFeatureValues = SolrSafeOperatorHelper::feature('FacetTaxonomy','ForcedCheckedFacetTaxonomy');

            if ( isset($forcedCheckedFeatureValues[$facetAttribute]) ) {
                return explode(';', $forcedCheckedFeatureValues[$facetAttribute][0]);
            }
        }

        return array();
    }
    /**
     * @param eZContentObjectTreeNode $node
     * @return string
     */
    public function getNodeUrl(&$node = null)
    {
        if(!SolrSafeOperatorHelper::featureIsActive("GPNotebook"))
        {
            return $this->application()->applicationLocalized()->attribute( 'external_url' );
        }

        $urlParams = array(
            'data' => SolrSafeOperatorHelper::getAndStoreGPNotebookHS(),
        );

        return array( 'url' => $this->application()->applicationLocalized()->attribute( 'external_url' ), 'params' => $urlParams );
    }
    public function __construct($params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized)
    {
        $ini = eZINI::instance( 'merck.ini' );
        if ( SolrSafeOperatorHelper::featureIsActive( 'ContactForm' ) )
        {
            $this->senderEmail =  SolrSafeOperatorHelper::feature( 'ContactForm', 'fromEmail');
        }
        else
        {
            $this->senderEmail = $ini->variable( self::FULLTEXT_SETTING_BLOCK_NAME, 'FromEmail' );
        }

        parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );
    }
    /**
     * @param string $attribute
     * @return array
     */
    public static function getMapping($attribute)
    {
        $solrField = "attr_{$attribute}_dt";

        $overrideFacetPublischedIsActive = SolrSafeOperatorHelper::featureIsActive('PublishedDateFacetCustom');
        if ($overrideFacetPublischedIsActive)
        {
            $appIdentifier = SolrSafeOperatorHelper::feature('PublishedDateFacetCustom', 'ApplicationIdentifier');
            if($appIdentifier[0] == self::$applicationIdentifier)
            {
                return array(
                    array(
                        'label' => 'date-3',
                        'query' => "$solrField:[NOW-3DAYS/DAY TO *]"
                    ),
                    array(
                        'label' => 'date-7',
                        'query' => "$solrField:[NOW-7DAYS/DAY TO *]"
                    ),
                    array(
                        'label' => 'all',
                        'query' => "$solrField:[NOW-15DAYS/DAY TO *]"
                    ),
                );
            }
        }
        else
        {
            return array(
                array(
                    'label' => 'date-7',
                    'query' => "$solrField:[NOW-7DAYS/DAY TO *]"
                ),
                array(
                    'label' => 'date-30',
                    'query' => "$solrField:[NOW-30DAYS/DAY TO *]"
                ),
                array(
                    'label' => 'date-90',
                    'query' => "$solrField:[NOW-90DAYS/DAY TO *]"
                ),
                array(
                    'label' => 'date-365',
                    'query' => "$solrField:[NOW-1YEAR/DAY TO *]"
                ),
            );
        }
    }
 /**
  * @return void
  */
 public function htmlBuildResult()
 {
     $this->initChannelInformations();
     $this->pushChannelResult();
     
     if( SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) )
     {
         $this->pushResult( 'gtm_variables', $this->getGTMTags());
     }
     
     switch (true)
     {
         case $this->isSearchPage():
             return $this->htmlBuildListResult();
             break;
         case $this->isDetailsPage():
             return $this->htmlBuildFullResult();
             break;
     }
 }
    /**
     * @param array $postData
     * @throws Exception
     * @throws ezcLogWriterException
     */
    private static function configCurlClient($postData)
    {
        if( SolrSafeOperatorHelper::featureIsActive( 'OverrideWSHandler' ) )
        {
            $hostUrl = SolrSafeOperatorHelper::feature('OverrideWSHandler', 'Url');
            self::instance()->logger->log("BaseUrl :" .$hostUrl, ezcLog::INFO);

            curl_setopt_array(self::instance()->client(), array(
                CURLOPT_URL => $hostUrl,
                CURLOPT_POST => TRUE,
                CURLOPT_HTTP_VERSION =>	CURL_HTTP_VERSION_1_1,
                CURLOPT_RETURNTRANSFER => TRUE,
                CURLOPT_HTTPHEADER => array(
//                    $hostUrl,
                    'Content-Type: application/json',
                    'AuthKey: dcec0748-e4a4-40da-bcee-b2f9f794af55'
                ),
                CURLOPT_POSTFIELDS => json_encode(self::mapESBDataToWS($postData))
            ));
        }
    }
    /**
     * @param int $uxType
     * @param string $key
     * @param string $field
     */
    public function __construct($uxType, $key, $field)
    {
        parent::__construct($uxType, $key, $field);

        $this->canBeHidden     = true;
        $this->hideEmptyValues = false;

        if ( self::isForcedLanguage() )
        {
            $this->forcedValues = array( LocaleTool::languageISO639Code(LocaleTool::mainLanguage()) );
        }

        $defaultValues = array( LocaleTool::languageISO639Code() );
        foreach( LocaleTool::languageList() as $locale )
        {
            $language = LocaleTool::languageISO639Code( $locale );
            if( !isset($defaultValues[$language]) )
                $defaultValues[] = $language;
        }

        $this->defaultValues = $defaultValues;

        $overrideLanguageFacetIsActive = SolrSafeOperatorHelper::featureIsActive('DefaultLanguageFacetValues');
        if ($overrideLanguageFacetIsActive)
        {
            $forcedLanguageOverrides = SolrSafeOperatorHelper::feature('DefaultLanguageFacetValues', 'ApplicationDefaultLanguage');
            if (!empty($forcedLanguageOverrides))
            {
                $identifier = self::$applicationIdentifier;

                if (!empty($identifier) && isset($forcedLanguageOverrides[$identifier]))
                {
                    $this->forcedValues = $forcedLanguageOverrides[$identifier];
                }
            }
        }
    }
    /**
     * @return array
     */
    protected function getCourseCompletion()
    {
        if( !$this->user() )
            return false;
        
        $regexp = array(
            'options' => array(
                'regexp'    =>  "/^[a-zA-Z0-9]*$/",
            )
        );
        $courseId       = (isset($_REQUEST['cid']) && filter_var($_REQUEST['cid'], FILTER_VALIDATE_REGEXP, $regexp)) ? $_REQUEST['cid'] : null;
        $uuid           = $this->user()->attribute('uuid');
        $completion     = 0;
        $status         = '';
        $found          = false;
        $inError        = false;
        $countryUuid    = $uuid;
        $dueDate        = null;

        //if learning tracker is enabled
        if( SolrSafeOperatorHelper::featureIsActive( 'MyLearningTracker' ) && SolrSafeOperatorHelper::getCustomParameter($this->getApplicationIdentifier(), 'HasLearningTracker', 'application_localized') )
        {
            $xml = LearningTrackerWebservice::getUserCoursesStatus($courseId);

            if( $xml !== false )
            {
                if( $xml->CourseStatus != null)
                {
                    $found          = true;
                    $status         = (string)$xml->CourseStatus;
                    $dueDate        = (string)$xml->DueDate;
                }
            }
            else
            {
                $inError = true;
            }
        }
        else
        {
        	/*$url            = $this->getCustomParameter('WSCompletionUrl');
        	$timeout        = 5;
        	$countryUuid    = $uuid;

		    if( $this->getCustomParameter('WSTimeout') )
		    {
		        $timeout = $this->getCustomParameter('WSTimeout');
		    }

		    $ch = curl_init();
		    curl_setopt( $ch, CURLOPT_URL, $url );
		    curl_setopt( $ch, CURLOPT_HEADER, 0 );
		    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
		    curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
		    curl_setopt( $ch, CURLOPT_POST, 1 );
		    curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( array(
		        'AuthenticationKey' => 'medicusconnect',
		        'UserID'            => $countryUuid,
		        'CourseID'          => $courseId
		    )) );

		    $x          = curl_exec($ch);
		    $inError    = false;

            if( $x === false )
            {
                $inError = true;
                eZDebug::writeError( print_r(array($url, curl_errno($ch), curl_error($ch)), true ), 'Call to eLearning WS failed' );
            }
            else
            {
                $xml = simplexml_load_string($x);

                if( $xml !== false )
                {
                    if( $xml->Course != null && $xml->Course->coursecompletion != null )
                    {
                        $completion     = (string)$xml->Course->coursecompletion;
                        $status         = (string)$xml->Course->coursestatus;
                        $found          = true;
                        $dueDate        = (string)$xml->Course->duedate;
                    }
                }
            }*/
        }

        return array(
            'uuid'          => $countryUuid,
            'completion'    => $completion,
            'status'        => $status,
            'found'         => $found,
            'courseId'      => $courseId,
            'inError'       => $inError,
            'errorMsg'      => $inError ? ezpI18n::tr( 'merck', 'NO COMPLETION AVAILABLE' ) : '',
            'dueDate'       => $dueDate,
        );
    }
    /**
     * @param array $solrResult
     * @return array
     */
    public function facetResult( &$solrResult )
    {
        $translations = FacetFilteringTool::getTaxonomyTranslation ( $this->attribute );
        $result       = parent::facetResult($solrResult);

        //sorting
        $keysById = array();

        foreach ( $result as $k => $f )
            $keysById[$f['id']] = $k;

        $sortedResult = array();

        foreach($this->defaultValues as $id)
        {
            if( isset($keysById[$id]))
            {
                $visible = true;
                if (SolrSafeOperatorHelper::featureIsActive('Univadis18Redesign'))
                {
                    $hiddenValues = SolrSafeOperatorHelper::feature('Univadis18Redesign', 'SpecialtyFacetHiddenValues');
                    if (in_array($id, $hiddenValues)) {
                        $visible = false;
                    }
                }
                $f                              = $result[$keysById[$id]];
                $f['visible'] = $visible;
                $sortedResult[$keysById[$id]]   = $f;

            }
            else
            {
                if ( isset($translations[$id]) )
                {
                    $visible = true;
                    if (SolrSafeOperatorHelper::featureIsActive('Univadis18Redesign'))
                    {
                        $hiddenValues = SolrSafeOperatorHelper::feature('Univadis18Redesign', 'SpecialtyFacetHiddenValues');
                        if (in_array($id, $hiddenValues)) {
                            $visible = false;
                        }
                    }
                    $sortedResult[$translations[$id]] = array(
                        'count'    => 0,
                        'id'       => $id,
                        'checked'  => 0,
                        'visible' => $visible,
                    );
                }
            }
        }

        return $sortedResult;
    }
<?php

/**
 * The CRON will parse all clusters and check if feature is active
 * Make a CURL on the URL
 * If the content is valid and has at least 1 entry -> erase all children of the NodeID
 * Create a child for each entries with the HTML provided by UltraNoir and with info provided by the RSS
 */

$xmlUrl = '';

if(SolrSafeOperatorHelper::featureIsActive('CongressReportRss'))
{
    $xmlUrl = SolrSafeOperatorHelper::feature('CongressReportRss', 'Url');
}
else
{
    $cli = eZCLI::instance();
    $cli->output( 'Feature "CongressReportRss" not found' );
}

$congressReportRss = new CongressReportRss($xmlUrl);
$congressReportRss->importXMLToDatabase();
    /**
     * @return bool
     */
    public function jsonBuildResult()
    {
        $this->initChannelInformations();

        $editorsChoice = $this->getEditorsChoice();

        $this->resultHandler->parseRequestParams(true);
        $solrResult = $this->resultHandler->contentResultMain();
        if ($this->getCustomParameter('IncludeChildrenInSearch'))
        {
            $this->resultHandler->getChildArticles($solrResult);
        }

        $facets     = array();

        $this->pushResult('num_found', (int)$solrResult['response']['numFound']);
        $this->pushResult('with_feed', $this->resultHandler->withFeed);

        if ( $this->resultHandler->withFacets )
        {
            foreach ( $this->facets as $facet)
            {
                /* @var $facet FacetBase */
                $f = array(
                    'uxtype'    => $facet->uxtype,
                    'list'      => ( $facet->isFiltered() ) ? $this->resultHandler->filteredFacetResult( $facet  ) : $facet->facetResult( $solrResult )
                );

                // JsonBuildResult is called again with facet with no result unchecked (state change via $this->facets)
                if ( $facet->needsRefresh )
                    return $this->jsonBuildResult();

                $facets[$facet->key] = $f;
            }

            $this->pushResult('facets', $facets);
        }

        if (!empty($editorsChoice))
        {
            $editorsChoice = $this->resultHandler->articleResult($editorsChoice, $facets);
            $this->pushResult('editors_choice' , $this->getEditorsChoiceView($editorsChoice));
        }


        $solrReturn = $this->resultHandler->articleResult($solrResult, $facets);

        $this->pushResult('articles', $this->setVariableAndGetTpl($solrReturn));
        if ( isset($solrReturn['all_specialities_informations'] ) )
        {
            $allSpecialitiesInformations = $solrReturn['all_specialities_informations'];
            unset( $solrReturn['all_specialities_informations'] );
            if (SolrSafeOperatorHelper::featureIsActive('SpecialityPopin') && SolrSafeOperatorHelper::feature('SpecialityPopin', 'CustomGroupsEnabled')) {
                $flatSpecialitiesList = array();
                foreach($allSpecialitiesInformations['all_specialities'] as $value) {
                    foreach($value as $name => $data) {
                        $name = StringTool::trim($name);
                        $flatSpecialitiesList[$name] = $data;
                    }
                }

                $customGroups = SolrSafeOperatorHelper::feature('SpecialityPopin', 'Groups');
                $allSpecialities = array();

                foreach ($customGroups as $name => $specialities) {
                    $name = StringTool::trim($name);
                    $allSpecialities[$name] = array();
                    foreach($specialities as $speciality) {
                        $speciality = StringTool::trim($speciality);
                        if (isset($flatSpecialitiesList[$speciality])) {
                            $allSpecialities[$name][$speciality] = $flatSpecialitiesList[$speciality];
                            unset($flatSpecialitiesList[$speciality]);
                        }
                    }
                }

                $allSpecialitiesInformations['all_specialities'] = $allSpecialities;
            }

            foreach ($allSpecialitiesInformations as $templateVariable => $templateValue)
                $this->tpl()->setVariable($templateVariable, $templateValue);

            $this->pushResult('all_specialities', $this->tpl()->fetch('design:'.$this->templateRootDirectory().'/content_service/specialities_list.tpl'));
        }
        
        $t3Facet = array();
        
        if ( isset($solrReturn['t3_facet_informations'] ) )
        {
            if ( count($solrReturn['t3_facet_informations']) > 0 )
            {
                $t3FacetInformations = $solrReturn['t3_facet_informations'];

                foreach ($t3FacetInformations as $templateVariable => $templateValue)
                    $this->tpl()->setVariable($templateVariable, $templateValue);

                $t3Facet[$t3FacetInformations['t3_key']] = $this->tpl()->fetch('design:'.$this->templateRootDirectory().'/content_service/t3_facet_list.tpl');

            }
            unset( $solrReturn['t3_facet_informations'] );
        }
        $this->pushResult('t3_facets', $t3Facet);
        
        foreach ( $solrReturn as $resultVariable => $resultValue )
            $this->pushResult($resultVariable, $resultValue);

        return true;
    }
Exemplo n.º 17
0
            $value = 'fr_CA'; 
            break;
        case 'eng-CA':
            $value = 'en_CA';
            break;
    }
    
    if( $value )
        setcookie( substr($value, -2) . '_Login', $value, 0, '/', CookieTool::getCookieDomain() );
    
}

$userId = MMUsers::getCurrentUserId();
if ( !MMUsers::isAnonymous($userId) )
{
    if ( SolrSafeOperatorHelper::featureIsActive( 'ToUPPPopin' ) )
    {
        if (
            ( !ContextTool::instance()->isMobile() && SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'useDedicatedPage' ) )
            ||
            ( ContextTool::instance()->isMobile() && SolrSafeOperatorHelper::feature('ToUPPPopin','showOnMobile') && SolrSafeOperatorHelper::feature('ToUPPPopin','useDedicatedPageMobile') )
        )
        {
            $serviceLogin = ESBFactory::getLoginService( ServiceLoginBase::ESB_METHOD_AUTOLOGIN, $_REQUEST );
            if ( $serviceLogin->checkTouPPPopin( ESBFactory::getUserService()->form() ) )
            {
                CookieTool::destroyCookie( 'displayToUPPPopin' );
                CookieTool::destroyCookie( 'displayToUPPPopin', '/', null );
                $serviceLogin->login();
                eZExecution::cleanExit();
            }
Exemplo n.º 18
0
    /**
     * @return eZTemplate
     */
    public function tpl()
    {
        if(is_null($this->_tpl))
        {
            eZTemplate::resetInstance();
            $this->_tpl = eZTemplate::factory();

            if (SolrSafeOperatorHelper::featureIsActive('showMedicalNewsDemo') && SolrSafeOperatorHelper::feature('ShowMedicalNewsDemo', 'showDemo')){
                $showMedicalNewsDemo = true;
                
            }else {
                $showMedicalNewsDemo = false;
            }
            
            $this->_tpl->setVariable('showMedicalNewsDemo',$showMedicalNewsDemo);
            
            $this->_tpl->setVariable('language'          , LocaleTool::languageISO639Code());
            $this->_tpl->setVariable('application_class' , get_class($this) );
            $this->_tpl->setVariable('view_parameters'   , $this->_params['UserParameters']);
            $this->_tpl->setVariable('cluster_identifier', ClusterTool::clusterIdentifier());
            $this->_tpl->setVariable('application_url'   , $this->applicationName());
            $this->_tpl->setVariable('consult'           , $this->isConsult);
            $this->_tpl->setVariable('httpcontext'       , array(
                'host'  => ContextTool::instance()->domain(),
            ));

            $environment = new MMEnvironment();
            $this->_tpl->setVariable('environment'       , $environment->env);

            $applicationLocalized = CacheApplicationTool::buildLocalizedApplication($this->applicationName());

            if (empty($applicationLocalized))
                $this->_tpl->setVariable('application_name'  , $this->applicationName());
            else
            {
                $applicationIdentifier = $applicationLocalized->applicationObject->attribute('identifier');

                $this->_tpl->setVariable('application_name' , $applicationIdentifier );
                $this->_tpl->setVariable('current_localized' , $applicationLocalized );
                $this->_tpl->setVariable('current_application' , $applicationLocalized->applicationObject );
            }
        }

        return $this->_tpl;
    }
    /**
     * @return bool
     */
    public static function isCatchUpAppNameEnabled()
    {
        $isFeatureActive  = SolrSafeOperatorHelper::featureIsActive( 'GlobalSearch' );
        $isFeatureEnabled = SolrSafeOperatorHelper::feature( 'GlobalSearch', 'CatchAppNameEnabled' );

        return $isFeatureActive && $isFeatureEnabled;
    }
    /**
     * @return array
     */
    protected function getUnivadisSubscriptions()
    {
        $newsletterSettings = null;
        if ( SolrSafeOperatorHelper::featureIsActive( 'RegistrationSettings' ) )
        {
            $newsletterSettings = SolrSafeOperatorHelper::feature( 'RegistrationSettings', 'NewsletterDefaultFrequency' );
        }

        if ( !empty( $_POST[self::UNI_EMAIL_OPTIN] ) )
        {
            $subsFields = $this->getSubscriptionsFields();

            $costens = array(
                array(
                    $subsFields['emailOffId'] => self::SUBSCRIPTION_UNI_MEDICAL_UPDATES,
                    $subsFields['status']     => self::SUBSCRIPTION_STATUS_SUBSCRIBED,
                    $subsFields['freq']       => $newsletterSettings != null ? strtoupper( $newsletterSettings['news'][0] ) : self::SUBSCRIPTION_FREQUENCY_DAILY
                ),
                array(
                    $subsFields['emailOffId'] => self::SUBSCRIPTION_UNI_MEDICAL_EDUCATION,
                    $subsFields['status']     => self::SUBSCRIPTION_STATUS_SUBSCRIBED,
                    $subsFields['freq']       => $newsletterSettings != null ? strtoupper( $newsletterSettings['education'][0] ) : self::SUBSCRIPTION_FREQUENCY_WEEKLY
                ),
                array(
                    $subsFields['emailOffId'] => self::SUBSCRIPTION_UNI_ANNOUNCEMENT,
                    $subsFields['status']     => self::SUBSCRIPTION_STATUS_SUBSCRIBED
                )
            );

            if( SolrSafeOperatorHelper::featureIsActive( 'Oncology' ) && SolrSafeOperatorHelper::feature( 'Oncology', 'EnabledOncologyConsent' ) ){
                $oncologyConsentFreq = SolrSafeOperatorHelper::feature( 'Oncology', 'ConsentFreq' );
                $allowedValues = array( self::SUBSCRIPTION_FREQUENCY_DAILY, self::SUBSCRIPTION_FREQUENCY_WEEKLY );

                if( in_array( $oncologyConsentFreq, $allowedValues ) ){
                    $oncologyConsent= array(
                        $subsFields['emailOffId'] => self::SUBSCRIPTION_UNI_ONCOLOGY,
                        $subsFields['status']     => self::SUBSCRIPTION_STATUS_SUBSCRIBED,
                        $subsFields['freq']       => $oncologyConsentFreq
                    );
                }
                else{
                    $oncologyConsent= array(
                        $subsFields['emailOffId'] => self::SUBSCRIPTION_UNI_ONCOLOGY,
                        $subsFields['status']     => self::SUBSCRIPTION_STATUS_UNSUBSCRIBED
                    );
                }
                $costens = array($costens, $oncologyConsent);
            }

            return $costens;
        }

        return array();
    }
    public function contentBuildResult()
    {
        $oldSkipPage = SolrSafeOperatorHelper::getCustomParameter($this->applicationObject->identifier, 'SkipExitPage', 'application');
        $skipPage = $oldSkipPage || !$this->exitStrategy();

        $this->pushResult('user' , self::user());
        $this->pushResult('country', LocaleTool::countryISO3166Code());

        if ( $skipPage )
        {
            $_REQUEST['proceed'] = 'proceed';
            $_COOKIE[$this->cookieKey()] = '1';
            if ( ContextTool::instance()->isMobile() )
                $_REQUEST['r'] = 1;
        }

        if( isset($_REQUEST['proceed']) && isset($_COOKIE[$this->cookieKey()]) && filter_var($_COOKIE[$this->cookieKey()], FILTER_VALIDATE_INT))
        {
            // proceed to iframe view
            $this->iframeBuildResult( );
        }
        elseif( isset($_REQUEST['proceed']) )
        {
            // proceed requested but no cookie, we ask again and force redirect to make sure we the proper layout
            header('Location: '.ContextTool::instance()->domain().$this->applicationLocalized()->applicationUrl());
            eZExecution::cleanExit();
        }
        else
        {
            // normal exit page vie
            $isMobile   = ContextTool::instance()->isMobile();
            $urlToRedirect = isset($_REQUEST['r']) ? trim($_REQUEST['r']) : null;
            if ($this->isExitApplication() && $this->displayIframe())
            {
                $serverUrl  = ContextTool::instance()->domain();
                $params = array(
                    'r' => urlencode($urlToRedirect),
                    'exit_strategy' => 0,
                    'display_iframe' => $this->displayIframe(),
                    'new_window' => $this->newWindow()
                );

                $urlToRedirect = $serverUrl . '/external/exit/?' . http_build_query($params);
                $this->pushResult('decode_url', false);
                $this->pushResult('server_url', $serverUrl);
            }
            if($isMobile){
                if($this->applicationObject()->externalLinkHandler())
                {
                    $externalUrl = $this->applicationObject()->externalLinkHandler()->getNodeUrl( $this->node );
                    $urlToRedirect = isset($externalUrl) ? $externalUrl : $urlToRedirect ;

                    if(SolrSafeOperatorHelper::getCustomParameter($this->applicationObject->identifier, 'usePostMethod', 'application' )){

                        $url = $this->applicationObject()->externalLinkHandler()->getNodeUrl( $this->node );
                        $url = $this->getDeeplink( $url );

                        if ($url == null && isset($_REQUEST['r']))
                        {
                            $url = urldecode($_REQUEST['r']);
                        }

                        $url = in_array('arg', array_keys($this->_params['UserParameters'])) ? $url . $this->_params['UserParameters']['arg'] : $url;

                        $this->pushResult('postParams', $url);
                    }
                }
                else
                {
                    $urlToRedirect = '/bad_config';
                }
            }
            $this->pushResult('back_url', ContextTool::instance()->backUrl());
            $this->pushResult('url', $urlToRedirect);
            $this->pushResult('deeplink', urlencode( $this->getDeeplink() ));
            // Because we are passing boolean parameters to final URL, we need to make isset check.
            if ( $this->isDeeplinkApplication() || $this->isExitApplication() )
            {
                if ( isset( $_GET['display_iframe'] ) )
                {
                    $this->pushResult('display_iframe', $this->displayIframe());
                }
                if ( isset( $_GET['new_window'] ) )
                {
                    $this->pushResult('new_window', $this->newWindow());
                }
                if ( isset( $_GET['exit_strategy'] ) )
                {
                    $this->pushResult('exit_strategy', $this->exitStrategy());
                }
            }
        }

        if($this->node && $this->node->attribute('url_alias') != "")
        {
            $this->pushResult('article_url', end(explode("/", $this->node->attribute('url_alias'))));
            /* @type $pfDM eZContentObjectAttribute[] */
            $pf   = NodeTool::getPublisherNodeFromNode( $this->node );
            $pfDM = $pf->DataMap();
            $pfID = PublisherFolderTool::getPathToIDMapping( $pfDM['path']->content() );
            $this->pushResult( 'pfid', $pfID['pfid'] . '/' );
        }

        $oldOpenInNewWindow = SolrSafeOperatorHelper::getCustomParameter($this->applicationObject()->identifier, 'openInNewWindow', 'application');
        $openInNewWindow = $this->newWindow() || $oldOpenInNewWindow;
        $this->pushResult('application', $this->applicationObject);
        $this->pushResult('open_in_new_window', $openInNewWindow);
        $this->pushResult('cookie_key', $this->cookieKey());
        $this->pushResult('node', $this->node);
        
        if( SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) )
        {
            $this->pushResult( 'gtm_variables', $this->getGTMTags( $this->node ) );
            if( $this->node )
            {
                $publisherNodeId = PublisherFolderTool::getPublisherNodeIdFromArticleNode($this->node);

                if ($publisherNodeId)
                {
                    $publisherInfos  = PublisherFolderTool::getNodeIdToPathMapping( $publisherNodeId );
                    $publisherPath   = $publisherInfos['path'];

                    $this->pushResult( 'publisher', $this->applicationLocalized()->getPublisherFolderFromPath( $publisherPath ) );
                }
            }
        }
    }
Exemplo n.º 22
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,
         );
     }
 }
Exemplo n.º 23
0
    protected function checkRead( $username )
    {
        $postData = array(
            'Username'      => $username,
            'Params'    => $this->_clusterMerckIni->variable( 'EsbSettings', 'AvailableParams' )
        );
        if( !in_array( 'Registration_date', $postData['Parameters']) && \SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) )
            $postData['Params'][] = 'Registration_date';

        return $this->checkESBMethod( '/Profile/Read', json_encode( array( 'Data' => $postData ) ) );
    }
 /**
  * @param string $type
  * @param string $uumpId
  * @param bool|string $email
  * @param string $url
  * @param bool $isConsult
  */
 protected function sendMailWrapper($type, $uumpId, $email = false, $url = '', $isConsult = false)
 {
     if( SolrSafeOperatorHelper::featureIsActive( 'ExactTarget' ) && SolrSafeOperatorHelper::featureIsActive( 'UUMP' ) )
     {
         $this->callET($type, $uumpId, $email, $url, $isConsult);
     }
     else
     {
         $this->callLyris($type, $uumpId, $email, $url);
     }
 }
    /**
     * @param bool $forAnonmyous
     * @param null $processedUserCustomerType
     * @return int[]
     */
    public static function fetchAuthorizedApplicationIds( $forAnonmyous = false, $processedUserCustomerType = null )
    {
        if( !$forAnonmyous && !is_null(self::$_authorizedApplications) )
            return self::$_authorizedApplications;
        $db = MMDB::instance();

        $customerType   = null;
        $mainSpeciality = null;

        $whereString = sprintf(
            "     cluster_identifier='%s' 
              AND environment & %d",
            $db->escapeString(ClusterTool::clusterIdentifier()),
            ContextTool::instance()->environment()
        );
        
        $user = $forAnonmyous ? false : MMUsers::getCurrentUserObject();

        if( $user )
        {
            /* @var $user MMUsers */
            $user = MMUsers::getCurrentUserObject();

            $customerType   = $user->attribute('customer_type');
            $mainSpeciality = $user->attribute('main_speciality');

            if( $user->hasAttribute('prefered_language'))
            {
                $language = $user->attribute('prefered_language');

                $whereString.= sprintf(
                    " AND ( language = '%s' OR language IS NULL OR language = '0' )",
                    $db->escapeString($language)
                );
            }

            if( $user->hasAttribute('country'))
            {
                $country = $user->attribute('country');

                $whereString.= sprintf(
                    " AND ( country = '%s' OR country IS NULL OR country = '0' )",
                    $db->escapeString($country)
                );
            }
        }

        if (!$customerType && $processedUserCustomerType) {
            $customerType = $processedUserCustomerType;
        }
        $whereString .= is_null($customerType)
            ? ' AND customer_type IS NULL '
            : sprintf( " AND ( customer_type IS NULL OR customer_type = '0' OR customer_type='%s') ", $db->escapeString($customerType) );
        $whereString .= is_null($mainSpeciality)
            ? ' AND main_speciality IS NULL '
            : sprintf( " AND ( main_speciality IS NULL OR main_speciality = '0' OR main_speciality='%s') ", $db->escapeString($mainSpeciality) );

        $sql = "SELECT *
            FROM mm_country_application_library
            WHERE
            ".$whereString."
            ORDER BY country DESC, language DESC, customer_type DESC, main_speciality DESC";

        $lastProfile    = null;
        $excludedApps   = array();
        $applicationIds = array();

        foreach( $db->arrayQuery($sql) as $row )
        {
            $profile = serialize( array($row['customer_type'], $row['main_speciality']) );
            if( !is_null($lastProfile) && $profile != $lastProfile )
                break;

            $lastProfile = $profile;

            if( $user && $user->hasAttribute('state') && !is_null($user->attribute('state')) && $row['state'] === $user->attribute('state') )
            {
                $excludedApps[] = (int)$row['application_id'];
                continue;
            }

            $applicationIds[] = (int) $row['application_id'];
        }

        if( !empty($excludedApps) )
        {
            foreach ( $applicationIds as $k => $appId )
            {
                if( in_array($appId, $excludedApps ) )
                    unset( $applicationIds[$k] );
            }
            $applicationIds = array_values($applicationIds);
        }
        
        if(SolrSafeOperatorHelper::featureIsActive('LearningNeedsAssessment'))
        {
            $applicationIds[] = ApplicationObject::fetchByIdentifier('learning-needs-assessment')->attribute('id');
        }

        $applicationIds = array_unique( $applicationIds );

        if( !$forAnonmyous )
            self::$_authorizedApplications = $applicationIds;

        return $applicationIds;
    }
    /**
     * @param bool $forceExternal
     * @return string
     */
    public function applicationUrl( $forceExternal = false )
    {
        $skipPage = (bool) $this->getCustomParameter( 'SkipExitPage' ) && ( is_object( MMUsers::getCurrentUserObject() ) );
        // Direct redirect without exit page
        if( $this->getCustomParameter( 'DirectLinkOpen' ) == 1 )
        {
            return $this->attribute( 'external_url' );
        }

        $baseUrl    = eZINI::instance()->variable( 'SiteAccessSettings', 'BaseUrl' );
        $urlAlias   = $this->attribute( 'url' );
        if( !$urlAlias )
            $urlAlias = $this->applicationObject()->attribute( 'url' );

        // external
        if ( $forceExternal || ( $this->applicationObject->applicationType()->attribute('internal_type') == ApplicationObject::APPLICATION_TYPE_EXTERNAL ) )
        {
            // Production
            //if(SolrSafeOperatorHelper::clusterIni("SocialSharing", "EntryExit", "merck.ini") == "enabled")
            if(SolrSafeOperatorHelper::featureIsActive("SocialSharing") && SolrSafeOperatorHelper::feature("SocialSharing", "EntryExit") && !$skipPage)
                return $baseUrl. $this->attribute( 'url' );
            else
                return $baseUrl.'external/' . $this->attribute( 'url' );
            /* Dev
             * return $baseUrl.'esibuild/main_view/app_content/' . $this->attribute( 'url' );
             */
        }

        return $baseUrl . $urlAlias;
    }
    /**
     * Checks if send to coleague
     *
     * @return boolean
     */
    public static function isSendToColleagueDisabled()
    {
        if ( SolrSafeOperatorHelper::featureIsActive( 'DisableSendToColleague' ) )
            return SolrSafeOperatorHelper::feature( 'DisableSendToColleague', 'IsDisabled' );

        return false;
    }
Exemplo n.º 28
0
    /**
     * @return array
     */
    public static function getApplicationLists()
    {
        $userAppList = AppBarControl::instance()->applicationIds();
        $orderedAppList = $userAppList;
        $apps = array();

        sort($orderedAppList);

        $rawApps = ApplicationLocalized::fetchApplicationList(array('id' => array($orderedAppList)));

        foreach ( $rawApps as $k => $app )
        {
            $force = false;
            if(SolrSafeOperatorHelper::featureIsActive('LearningNeedsAssessment') && $app->identifier == 'learning-needs-assessment')
            {
                $force = true;
            }

            if ( $app->attribute('application_library') || $force )
            {
                /* @var $app ApplicationLocalized */
                $apps['#' . $app->attribute('id')] = $app;
            }
            else
            {
                unset($userAppList[array_search($app->attribute('id'), $userAppList)]);
                $userAppList = array_values($userAppList);

                unset($orderedAppList[array_search($app->attribute('id'), $orderedAppList)]);
                $orderedAppList = array_values($orderedAppList);
            }
        }

        // we check if some apps were deleted in the meantime
        if ( self::user() )
        {
            $applistToUpdate = false;

            foreach ( $userAppList as $k => $id )
            {
                if ( !isset($apps['#' . $id]) )
                {
                    // we remove the application from the app bar only if it is not available for the anonymous
                    // display rights are handled at application level
                    if ( !in_array($id, CountryApplicationLibrary::fetchAuthorizedApplicationIds(true)) )
                    {
                        unset($userAppList[$k]);
                        $applistToUpdate = true;
                    }
                    else
                    {
                        $apps['#' . $id] = CacheApplicationTool::buildLocalizedApplicationByApplication($id);
                    }
                }
            }
            if ( $applistToUpdate )
            {
                $userAppList = array_values($userAppList);
                $user = MMUsers::getCurrentUserObject();
                $orderedAppList = $userAppList;

                sort($orderedAppList);

                $user->setApplicationList($userAppList);
            }
        }

        return array(
            'app_list' => self::user() ? $orderedAppList : $userAppList,
            'apps'     => $apps
        );
    }
Exemplo n.º 29
0
<?php

return array(
    'name' => 'Univadis',
    'apiVersion' => 0.3,
    'baseUrl' => (\SolrSafeOperatorHelper::featureIsActive('UUMP') ? \SolrSafeOperatorHelper::clusterIni('WebService', 'BaseUrlUUMP', 'merck.ini') . \SolrSafeOperatorHelper::clusterIni('WebService', 'Prefix', 'merck.ini') : \SolrSafeOperatorHelper::clusterIni('WebService', 'BaseUrl', 'merck.ini')),
    'description' => 'RESTful Webservice for ESB',
    'operations' => array(
        'abstract' => array(
            'httpMethod' => 'POST'
        ),
        'createtoken' => array(
            'extends' => 'abstract',
            'uri' => '/createtoken',
            'summary' => 'Creates token for given username',
            'parameters' => array(
                'data' => array(
                    'email' => 'string',
                    'countryOfRegistration' => 'string'
                )
            )
        )
    )
);
    /**
     * @return bool
     */
    public function htmlBuildResult()
    {
        if ( $this->fullContext == 'section' )
            $this->pushResult( 'section', $this->section );
        else
        {
            if ( $this->node instanceof eZContentObjectTreeNode )
            {
                $this->pushResult( 'node', $this->node );
                $this->pushResult( 'rightColumnContext', $this->fullContext );
            }
            else
                $this->pushResult( 'rightColumnContext', 'showcase' );
        }

        $this->pushResult('article_parameters', $this->_params['UserParameters']);
        $this->pushResult('fullContext', $this->fullContext);

        if ( $this->node instanceof eZContentObjectTreeNode && $this->node->classIdentifier() == 'article' )
        {
            /* @type $publisherDM eZContentObjectAttribute[] */
            /* @type $node eZContentObjectTreeNode */
            $node            = $this->node->object()->mainNode();
            $parent          = $node->fetchParent();
            $publisher       = ($parent && $parent->classIdentifier() == 'article' ) ? $parent->fetchParent() : $parent;
            $publisherDM     = $publisher->dataMap();
            $publisherPath   = $publisherDM['path']->content();
            $publisherFolder = $this->applicationLocalized()->getPublisherFolderFromPath($publisherPath);

            $this->pushResult('publisher', $publisherFolder);
        }

        if ( $this->mediaName )
        {
            $this->pushResult('mediaName', $this->mediaName);
            $this->pushResult('oscarFolder', $this->oscarFolder);
        }

        $this->pushResult( 'user', self::user() );

        if( SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) )
            $this->pushResult( 'gtm_variables', $this->getGTMTags( $this->node ) );
    }