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

        if ( $this->applicationObject && !empty($this->applicationObject->configurationContentService) )
            $this->pushResult('content_service_configuration', $this->applicationObject->configurationContentService);
    }
 public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized )
 {
     $ini = eZINI::instance( 'merck.ini' );
     $this->createSessionURL = $ini->variable( self::CHANGEPASSWORD_SETTING_BLOCK_NAME, 'CreateSessionURL' );
     $this->passwordResetURL = $ini->variable( self::CHANGEPASSWORD_SETTING_BLOCK_NAME, 'PasswordResetURL' );
     parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );
 }
    /**
     * @return string
     */
    protected function getEntryPointTemplate()
    {
        if($this->isFull)
            return $this->templateRootDirectory() . '/application-library/full.tpl';

        return parent::getEntryPointTemplate();
    }
    public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized )
    {
        $ini = eZINI::instance( 'merck.ini' );
        $this->fromEmail = $ini->variable( self::FULLTEXT_SETTING_BLOCK_NAME, 'FromEmail' );
        $this->toEmail = $ini->variable( self::FULLTEXT_SETTING_BLOCK_NAME, 'ToEmail' );

        parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );
    }
    protected function getEntryPointTemplate()
    {
        if($this->isFull)
        {
            return $this->templateRootDirectory() . '/3d-anatomy/child.tpl';
        }

        return parent::getEntryPointTemplate();
    }
    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 );
    }
Example #7
0
    public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized )
    {
        parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );
        $this->user = MMUsers::getCurrentUserObject();

        $ini = eZINI::instance( 'merck.ini' );
        $this->applicationId = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'ApplicationId' );
        $this->clientId = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'ClientId' );
        $this->clientSecret = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'ClientSecret' );
        $this->tokenRequestUrl = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'TokenRequestUrl' );
        $this->tokenFileName = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'TokenFileName' );
        $this->serviceUrl = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'ServiceUrl' );
        $this->smsRecipients = $ini->variable( self::SMS_SETTING_BLOCK_NAME, 'SmsRecipients' );
    }
Example #8
0
 /**
  * @return string
  */
 protected function getEntryPointTemplate()
 {
     if ( $this->page )
     {
         if ($this->page->attribute('type') == MMStaticPage::TYPE_EMPTY_LAYOUT)
         {
             return 'esibuild/app_content/page/empty_view.tpl';
         }
         if ($this->page->attribute('type') == MMStaticPage::TYPE_CONTENT_ONLY)
         {
             return 'esibuild/app_content/page/content_only.tpl';
         }
     }
     return parent::getEntryPointTemplate();
 }
    /**
     * @param eZContentObjectTreeNode $node
     * @return array
     */
    public function getGTMTags()
    {
        $gtmVariables = parent::getGTMTags($this->applicationLocalized());
        
        $gtmVariables['sponsorName'] = '';
        $gtmVariables['sponsorPage'] = false;
        
        $sponsorName = $this->applicationLocalized()->attribute("sponsor");
        
        if ($sponsorName)
        {
            $gtmVariables['sponsorName'] = $sponsorName;
            $gtmVariables['sponsorPage'] = true;
        }

        return $gtmVariables;
    }
    /**
     * @return bool
     */
    public function htmlBuildResult()
    {
        $ela = array();

        foreach( CacheApplicationTool::clusterApplications() as $app )
        {
            if
            (
                $app->applicationObject->applicationType->attribute('type_identifier') == 'e-learning'
                && $app->getCustomParameter('HasLearningTracker')
                && ApplicationFactory::fetchByUri($app->attribute('url_alias'))->canRead()
            )
            {
                $ela[] = array(
                    'headline' => $app->headline,
                    'url'      => $app->applicationUrl(),
                );
            }
        }
        $this->pushResult( 'ela', $ela );
        $this->pushResult( 'content_service_configuration', $this->applicationObject->configurationContentService );
        $this->pushResult( 'is_mobile', ContextTool::instance()->isMobile() );
		$this->pushResult( 'isApplicationAllowedToUser', MMLimitedApplicationsAllowedUsers::hasCurrentUserAccessToApp(CacheApplicationTool::buildLocalizedApplicationByIdentifier('learning-needs-assessment')->application_id) );

        $uuid = $this->user()->attribute('uuid');
        $this->pushResult( 'userId', $uuid );

        //LNA Dashboard url
        $lmtBaseUrl = SolrSafeOperatorHelper::feature('LearningNeedsAssessment', 'LMTBaseUrl');
        $lmtPrefix = SolrSafeOperatorHelper::feature('LearningNeedsAssessment', 'LMTPrefix');
        $this->pushResult( 'dashboardUrl', $lmtBaseUrl . $lmtPrefix );

        $environment = new MMEnvironment();
        $this->pushResult( 'environment', $environment->env );
        
        $userData = CertificatesWebservice::readUserData();
        $this->pushResult( 'companyCode', $userData['CID'] );

        $countryPrefix = preg_replace( "~cluster|_~", "", ClusterTool::clusterIdentifier() );
        $this->pushResult( 'dashBoardCountryPrefix', strtolower( $countryPrefix ) . '_' );

        parent::htmlBuildResult();

        return true;
    }
    public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized )
    {
        $this->redirectUrl = $applicationLocalized->getCustomParameter( 'ConfirmationPageURL' );

        if ( SolrSafeOperatorHelper::featureIsActive( 'ContactForm' ) )
        {
           $this->fromEmail =  SolrSafeOperatorHelper::feature( 'ContactForm', 'fromEmail');
           $this->toEmail = SolrSafeOperatorHelper::feature( 'ContactForm', 'toEmail');
        }
        if ( !$this->fromEmail )
        {
           $this->fromEmail = SolrSafeOperatorHelper::clusterIni( self::CONTACTUS_SETTING_BLOCK_NAME, 'FromEmail', 'merck.ini' );
        }
        if ( !$this->toEmail )
        {
           $this->toEmail = SolrSafeOperatorHelper::clusterIni( self::CONTACTUS_SETTING_BLOCK_NAME, 'ToEmail', 'merck.ini' );
        }

        $this->additionalMsg = SolrSafeOperatorHelper::clusterIni( self::CONTACTUS_SETTING_BLOCK_NAME, 'AdditionalEmailParameters', 'merck.ini' );

        parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );
    }
    /**
     * @return string
     */
    protected function getEntryPointTemplate()
    {
        if( $this->node instanceof eZContentObjectTreeNode )
        {
            $templateRootDirectory = $this->templateRootDirectory();

            switch( $this->fullContext )
            {
                case 'section':
                    $template = $templateRootDirectory . '/merck-manual-section/block_view.tpl';
                    break;
                case 'chapter':
                case 'topic':
                    if( $this->node->fetchParent()->ClassIdentifier == 'application_folder' )
                        $template = $templateRootDirectory . '/merck-manual-chapter/merck-manual-chapter.tpl';
                    else
                        $template = $templateRootDirectory . '/merck-manual-chapter/merck-manual-topic.tpl';
                    break;
                case 'image':
                case 'image-file':
                case 'video':
                case 'audio':
                case 'table':
                    $template = "$templateRootDirectory/merck-manual-media/merck-manual-media-{$this->fullContext}.tpl";
                    break;
                default:
                    $template = parent::getEntryPointTemplate();
            }
        }
        else
        {
            $template = parent::getEntryPointTemplate();
        }

        return $template;
    }
    /**
     * @return bool
     */
    public function canRead()
    {
        header('Pragma: no-cache');
        header('cache-Control: no-cache, must-revalidate');
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
        //header('X-Frame-Options: SAMEORIGIN');
        header('X-Frame-Options: ALLOW-FROM https://*.facebook.com/');
        $appsWithoutHeader = array(
            'social-register',
            'social-register-confirmation',
        );
        if ( in_array( $this->getApplicationIdentifier(), $appsWithoutHeader ) )
        {
            header('X-Frame-Options:');
        }
        header('Content-Security-Policy: frame-ancestors https://*.facebook.com/');

        return parent::canRead();
    }
    /**
     * @return bool
     */
    public function canRead()
    {
        $canRead = $this->applicationLocalized->getPermissionHandler()->canRead(
            array(
                'isFull' => $this->isFull,
                'isPublic' => $this->isPublic,
                'node' => $this->node,
            )
        );

        if ($canRead === null) {
            return parent::canRead();
        }

        return $canRead;
    }
 /**
  * @param array $params
  * @param string $outputType
  * @param string $blockName
  * @param string $applicationName
  * @param ApplicationObject $applicationObject
  * @param ApplicationLocalized $applicationLocalized
  */
 public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized )
 {
     parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );
 }
    /**
     * @param eZTemplate $tpl
     * @param string $operatorName
     * @param array $operatorParameters
     * @param string $rootNamespace
     * @param string $currentNamespace
     * @param mixed $operatorValue
     * @param array $namedParameters
     */
    function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
    {
        switch ($operatorName)
        {
            case 'timestampToDateISO':
                $operatorValue = date('c', $namedParameters['timestamp']);
                break;
            case 'ezstr_replace':
                $operatorValue = str_replace(
                    $namedParameters['search'],
                    $namedParameters['replace'],
                    $namedParameters['text']
                );
                break;
            case 'hash_set':
                $hash                          = $namedParameters['hash'];
                $hash[$namedParameters['key']] = $namedParameters['val'];
                $operatorValue                 = $hash;
                break;
            case 'currentApplication':
                $operatorValue = ApplicationDefault::instance();
                break;
            case 'getApplicationName':
                if ($namedParameters['application'] instanceof ApplicationDefault)
                {
                    $operatorValue = $namedParameters['application']->applicationName();
                }
                break;
            case 'getTableEmbeddedName':
                $pattern = '/<td class="MMTableCellHead" ?.*>(.*)<\/td>/';
                preg_match_all($pattern, $namedParameters['htmlCode'], $matches);

                $operatorValue = $matches[1][0];
                break;
            case 'external_app_cookie_key':
                $operatorValue = ExternalApplication::createExternalApplicationCookieKey(
                    $namedParameters['localized_application']
                );
                break;
            case 'getCurrentCluster':
                $operatorValue = ClusterTool::clusterIdentifier();
                break;
            case 'checkIfSiteMatchesType':
                $contexts = array(
                    ContextTool::APP_MOBILE_DESIGN,
                    ContextTool::FRONT_DESIGN,
                    ContextTool::MOBILE_DESIGN
                );

                $operatorValue = (in_array($namedParameters['site_type'], $contexts)) ? ContextTool::instance(
                )->siteIsTypeOf($namedParameters['site_type']) : false;
                break;
            case 'import_status_xml_mdd':
                $statusXmlMdd = array(
                    1 => 'COMPLETE_SUCCESS',
                    2 => 'SUCCESS_WITH_WARNINGS',
                    3 => 'BLOCKING_ERROR',
                    4 => 'CRITICAL_ERROR',
                    5 => 'FATAL_ERROR'
                );

                $operatorValue = (isset($statusXmlMdd[$namedParameters['status']]) ? $statusXmlMdd[$namedParameters['status']] : $namedParameters['status']);
                break;
            case 'import_status_mdd_ez':
                $statusMddEz = array(
                    '-1' => 'DO_NOT_TREAT',
                    0    => 'INITIAL',
                    1    => 'SYNCHRO',
                    2    => 'ARTICLE_REF',
                    4    => 'CRITICAL_ERROR',
                    8    => 'FATAL_ERROR'
                );

                $operatorValue = (isset($statusMddEz[$namedParameters['status']]) ? $statusMddEz[$namedParameters['status']] : $namedParameters['status']);
                break;
            case 'getUserCustomerType':
                $user          = MMUsers::getCurrentUserObject();
                $operatorValue = ($user) ? $user->attribute('customer_type') : 'User not logged in';
                break;
            case 'isUserDataMissing':
                $instance      = MMUserData::instance();
                $operatorValue = $instance->isUserDataMissing($namedParameters['name']);
                break;
            case 'isMobile':
                $operatorValue = ContextTool::instance()->isMobile();
                break;
            case 'getExternalConfiguration':
                $operatorValue = ApplicationExternalConfiguration::getExternalConfiguration($namedParameters['id']);
                break;
            case 'getLocalizedApplicationByIdentifier':
                $operatorValue = CacheApplicationTool::buildLocalizedApplicationByIdentifier(
                    $namedParameters['identifier']
                );
                break;
            case 'getWebtrendsTimezone':
                $d = new DateTime('now', new DateTimeZone(eZINI::instance()->variable('TimeZoneSettings', 'TimeZone')));

                $operatorValue = ($d->getOffset() / 3600);
                break;
            case 'getChinaProvinceCity':
                $operatorValue = ChinaLocation::fetchProvincesAndCities();
                break;
            case 'isCatchUpAppNameEnabled':
                $operatorValue = MMGlobalSearch::isCatchUpAppNameEnabled();
                break;
            case 'gmdate':
                $operatorValue = gmdate($namedParameters['format'], $namedParameters['duration']);
                break;
            case 'mb_strtoupper':
                $operatorValue = mb_strtoupper($namedParameters['str']);
                break;
            case 'preg_replace':
                $operatorValue = preg_replace(
                    $namedParameters['pattern'],
                    $namedParameters['replacement'],
                    $namedParameters['subject'],
                    $namedParameters['$limit']
                );
                break;
            case 'html_entity_decode':
                $operatorValue = html_entity_decode($namedParameters['string']);
                break;
            case 'urlencode':
                $operatorValue = urlencode($namedParameters['string']);
                break;
            case 'json_encode':
                $operatorValue = json_encode($namedParameters['value']);
                break;
            case 'domain':
                $operatorValue = ContextTool::instance()->domain();
                break;
            case 'getUumpDateFormat':
                $operatorValue = SolrSafeOperatorHelper::clusterIni('EsbDateConvert', 'FormatDate', 'merck.ini' );
                break;
            case 'html_contains_image':
                $operatorValue = SolrSafeOperatorHelper::htmlContainsImage($namedParameters['string']);
                break;
            case 'preg_match':
                $operatorValue = preg_match (
                    $namedParameters['pattern'],
                    $namedParameters['subject']
                );
                break;
        }
    }
 /**
  * @return array
  */
 public function getHtmlResult()
 {
     $result = parent::getHtmlResult();
     header_remove('Set-Cookie');
     return $result;
 }
    /**
     * 
     * @param string $nodePath
     * @param ApplicationDefault $app
     * @return null
     */
    static public function findNodeFromPath ($nodePath, $app )
    {
        $uri             = explode( '/', ltrim( $nodePath, '/' ) );
        $rootNodes       = array();
        $applicationName = $app->applicationName();

        if( count( $uri ) > 1 && is_numeric($uri[0]) )
        {
            $publisherFolderId = $uri[0];
            array_shift($uri);
            $uriArticle = implode ('/', $uri);
        }
        else
            $uriArticle = ltrim( $nodePath, '/' );
        
        $uriArticle = urldecode($uriArticle);

        if($applicationName)
        {
            $publishers = $app->applicationLocalized()->publisherFolders;

            /* @var $publisher PublisherFolder */
            foreach ($publishers as $publisher)
            {
                $pfids = PublisherFolderTool::getPathToIDMapping( $publisher->attribute('path') );

                // If PublisherFolderId is included in url, we only take care about this publisher folder
                if ( isset($publisherFolderId) && $pfids['pfid'] == $publisherFolderId )
                {
                    $rootNodes[] = eZContentObjectTreeNode::fetch($pfids['nid']);
                    $articlePath = $uriArticle;

                    break;
                }
                elseif( !isset($publisherFolderId) )
                {
                    $node = eZContentObjectTreeNode::fetch($pfids['nid']);
                    if($node) {
                        $rootNodes[] = $node;
                        $articlePath = $uriArticle;
                    }
                }
            }
        }

        if ( isset($publisherFolderId) != false && trim($uriArticle) == '' )
            return $app;
        
        if ( !isset($articlePath) || count($rootNodes) == 0 )
            return null;

        $node = self::getNodeFromPath ($articlePath, $rootNodes);

        if ( !$node )
            return null;
        
        $cluster   = $app->applicationLocalized()->attribute( 'cluster_identifier' );
        $isVisible = ObjectVisibilityManager::isVisible( $node->attribute('contentobject_id'), $cluster );

        if ( !$isVisible )
            return null;

        return $node;
    }
    /**
     * @return string
     */
    public function getEntryPointTemplate()
    {
        if (isset($this->_params['UserParameters']['token']))
        {
            $this->pushResult('token', $this->_params['UserParameters']['token']);
            return $this->templateRootDirectory().'/reset-password/new_password.tpl';
        }

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

        $applicationLocalized = $this->applicationLocalized();
        $this->getParams = array();
        $this->sesamePath = $applicationLocalized->applicationUrl();

        $this->appDomain = $applicationLocalized->getCustomParameter( 'AppDomain' );
        if ($this->appDomain === false)
        {
            //TODO: error handle
        }
        
        $this->applicationEntryPoint = $applicationLocalized->getCustomParameter( 'EntryPoint' );
        if ($this->applicationEntryPoint !== false)
        {
            $this->currentPath = $this->applicationEntryPoint;
        }

        $defaultGetParams = $applicationLocalized->getCustomParameter( 'DefaultGetParams' );
        if ($defaultGetParams !== false && is_array($defaultGetParams))
        {
            $this->defaultGetParams = $defaultGetParams;
            $this->getParams = $defaultGetParams;
        }

        $proxyUrlHandlerClass = $applicationLocalized->getCustomParameter( 'ProxyUrlHandlerClass' );
        if ($proxyUrlHandlerClass !== false)
        {
            $this->proxyUrlHandler = new $proxyUrlHandlerClass();
        }

        $this->templatePath = $applicationLocalized->getCustomParameter( 'TemplatePath' );
        if ($this->templatePath === false)
        {
            //TODO: error handle
        }
    }
 public function __construct($params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized)
 {
     $this->anonymousUrl = SolrSafeOperatorHelper::feature( 'merckConnectWebServices', 'baseURL' );
     parent::__construct($params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized);
 }
 /**
  * @return string
  */
 protected function getEntryPointTemplate()
 {
     return $this->fullContext == 'topic' ? $this->templateRootDirectory() . '/merck-manual-chapter/merck-manual-topic.tpl' : parent::getEntryPointTemplate();
 }
 public function __construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized )
 {
     $this->redirectUrl = $applicationLocalized->getCustomParameter( 'ConfirmationPageURL' );
     parent::__construct( $params, $outputType, $blockName, $applicationName, $applicationObject, $applicationLocalized );
 }
 /**
  * @param ApplicationDefault $app
  */
 public static function setInstance($app)
 {
     self::$_instance = $app;
 }
 /**
  * @return array
  */
 public function getSpecialities()
 {
     return ApplicationDefault::user()
         ?  ApplicationDefault::user()->getSpecialities()
         :  array();
 }
    /**
     * @return bool
     */
    public static function appHasSpeciality()
    {
        /** @var $application ContentListBase */
        $application = ApplicationDefault::instance();
        $facets = $application->facets;

        foreach($facets as $facet)
            if($facet instanceof FacetFieldTagSpeciality)
                return true;

        return false;
    }
    public function htmlBuildResult()
    {
        $lessFiles = SolrSafeOperatorHelper::getLessFiles(
            ($this->app) ? $this->app->applicationObject()->attribute('identifier') : $this->applicationName(),
            $this->app
        );
        $this->tpl()->setVariable( 'applicationLessFiles', $lessFiles );

        if ( !$this->app )
            return;

        if ( $this->app->isFull )
        {
            if ( $this->app->node && $this->app->node instanceof eZContentObjectTreeNode )
            {
                $dataMap     = $this->app->node->dataMap();
                if($dataMap["serialized_taxonomies"]){
                    $taxonomies = $dataMap["serialized_taxonomies"]->content();
                    $publisherPath = $taxonomies["publisher_folder"][0];
                    $publisherFolder = $this->app->applicationLocalized()->getPublisherFolderFromPath($publisherPath);

                    if (isset($taxonomies['language']) && $publisherFolder instanceof PublisherFolder) {
                        $publisherLanguages = $publisherFolder->getLanguages();
                        $languageList = $taxonomies['language'];
                        //$languageTranslations = FacetFilteringTool::getTaxonomyTranslation('language');

                        $availableLanguages = array();

                        foreach (array_keys($this->app->node->object()->allLanguages()) as $locale) {
                            if (is_array($publisherLanguages) && in_array($locale, $publisherLanguages)) {
                                $key = LocaleTool::languageISO639Code($locale);
                                $availableLanguages[$key] = $locale;
                            }
                        }
                    }

                    $uri = eZURI::instance();
                    $uriParams = $uri->UserParameters();
                    if(isset($uriParams['language']))
                        $uriLang = $uriParams['language'];

                    if ($uriLang) {
                        $this->app->node->setCurrentLanguage($uriLang);
                    }
                    if (in_array($publisherLanguages[0], $availableLanguages)){
                        if ($this->app->node->currentLanguage() != $publisherLanguages[0]) {
                            $this->app->node->setCurrentLanguage($publisherLanguages[0]);
                        }
                    }
                }
            }
            
            if ( SolrSafeOperatorHelper::featureIsActive( "SocialSharing" ) && SolrSafeOperatorHelper::feature( "SocialSharing", "EntryExit" ) )
            {
                $this->pushResult( "socialInfos", $this->app->getSocialInfos() );
            }

            if ( $this->app->node instanceof eZContentObjectTreeNode )
                $this->pushResult( "current_node", $this->app->node );
        }
        else if ( $this->app->isSeo )
        {
            $goToSpeciality = null;
            if ( is_null( $this->app->seoParams["speciality"] ) && $this->app->seoParams["noSpeciality"] )
            {
                $goToSpeciality = "all/speciality";
            }

            $this->pushResult( "seoMetas", $this->app->getSeoMetas() );
            $this->pushResult( "doSpecialityRedirect", $goToSpeciality );
        }

    }