当前位置: 首页>>代码示例>>PHP>>正文


PHP ClusterTool::getAllClusters方法代码示例

本文整理汇总了PHP中ClusterTool::getAllClusters方法的典型用法代码示例。如果您正苦于以下问题:PHP ClusterTool::getAllClusters方法的具体用法?PHP ClusterTool::getAllClusters怎么用?PHP ClusterTool::getAllClusters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClusterTool的用法示例。


在下文中一共展示了ClusterTool::getAllClusters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processOptions

function processOptions($options)
{

    if ($options['clusterIdentifier'] == null)
    {
        throw new Exception("No clusters given. Should pass argument clusterIdentifier with value 'all' if all clusters are requested");
    }

    $allClusters = ClusterTool::getAllClusters();
    if ($options['clusterIdentifier'] == 'all')
    {
        $clusters = $allClusters;
    } else
    {
        $clusters = explode(',', $options['clusterIdentifier']);
        $clusters = array_filter($clusters, function($v) use ($allClusters) {
            return in_array($v, $allClusters);
        });
    }
    $exclude = isset($options['exclude']) ? filter_var($options['exclude'], FILTER_VALIDATE_BOOLEAN) : false;
    if ($exclude)
    {
        $clusters = array_diff($allClusters, $clusters);
    }
    $parsedOptions = array(
        'clusters' => $clusters,
        'exclude' => $exclude,
    );
    return $parsedOptions;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:quiz_move_to_hall_of_fame.php

示例2: isset

<?php

/* @type $Params string[] */

$applicationIdentifier = $Params['ApplicationIdentifier'];
$bannerType            = $Params['BannerType'];
$clusterAndExtension   = isset( $Params['ClusterIdentifier'] ) ? $Params['ClusterIdentifier'] : ClusterTool::clusterIdentifier();
$properClusters        = ClusterTool::getAllClusters();
$start                 = strrpos( $clusterAndExtension, 'cluster_');
$end                   = strrpos( $clusterAndExtension, '.png');
$clusterIdentifier     = $clusterAndExtension;

if ( !$end )
{
    $clusterIdentifier = substr($cluster, $start, $end - $start);
}
// make sure cluster identifier is correct.
if ( !in_array( $clusterIdentifier, $properClusters ) )
{
    $clusterIdentifier = ClusterTool::clusterIdentifier();
}

if( $applicationIdentifier && $bannerType )
{
    $filename = BannerPathTool::getStaticPath($clusterIdentifier, $applicationIdentifier, $bannerType);
    if( !empty($filename) && file_exists($filename) )
    {
        if (strrpos($filename, 'png', strlen($filename) - 3)) {
            header( 'Content-type: image/png' );
        }
        else {
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:banner.php

示例3: importTrial

    public function importTrial($trialId)
    {
        $url = $this->buildUrl('GetTrialDetails', array(
            'TrialIDnum' => $trialId,
            'username' => self::TRIAL_DETAILS_USERNAME,
            'password' => self::TRIAL_DETAILS_PASSWORD,
        ));

        $contents = $this->executeCurl($url);
        $trialData = $this->buildTrialData($trialId, $contents);
        if ($trialData == null) {
            return null;
        }
        $coreContentFields = array(
            $trialData['title'],
            $trialData['details']['scientific_title'],
            $trialData['details']['sponsor'],
            $trialData['conditions'],
            $trialData['details']['interventions'],
            implode(',', $trialData['country']),
            $trialData['id'],
            implode(',', $trialData['details']['secondary_id']),
        );

        $articleData = array(
            'meta_installation_id_ms'           => keZSolr::installationID(),
            //'meta_path_id_si'                   => self::getMetaPathId(),
            'meta_guid_ms'                      => md5('clinical_trials' . $trialData['id']),
            'meta_remote_id_ms'                 => md5('clinical_trials' . $trialData['id']),
            'meta_section_id_si'                => 1,
            'attr_cluster_uk_url_s'	            => md5('clinical_trials' . $trialData['link']),
            'attr_date_dt'                      => $trialData['details']['update_date'],
            'attr_offline_date_dt'              => '1970-01-01T01:00:00Z',
            'attr_archived_date_dt'	            => '1970-01-01T01:00:00Z',
            'attr_headline_t'                   => $trialData['title'],
            'attr_headline_s'                   => $trialData['title'],
            'attr_headline_lc_s'                => iconv('UTF-8', 'ASCII//TRANSLIT', strtolower($trialData['title'])),
            'attr_is_invisible_cluster_uk_b'    => false,
            'attr_depth_cluster_uk_i'           => 0,
            'attr_relative_depth_i'             => 0,
            'subattr_customer_type___source_id____s'        => self::getCustomerTypes(),
            'subattr_language___source_id____s'             => 'en',
            'subattr_local_application___source_id____s'    => $this->application->id,
            'subattr_publisher_folder___source_id____s'     => "clinical_trials_oncology",
            'meta_language_code_ms'     => 'eng-GB',
            'meta_class_identifier_ms' => 'article',
            'attr_exclude_from_search_cluster_uk_b' => false,
            'attr_hide_in_search_b' => false,
            "attr_clinical_trials_details_s" => json_encode($trialData['details']),
            'attr_core_content_t' => implode(',', $coreContentFields),
            'subattr_recruitment_status___source_id____s' => $trialData['status'],
            'attr_clinical_trials_conditions_s' => $trialData['conditions'],
            'subattr_gender___source_id____s' => $trialData['sex'],
            'attr_clinical_trials_min_age_i' => $trialData['min_age'],
            'attr_clinical_trials_max_age_i' => $trialData['max_age'],
            "attr_clinical_trials_country____s" => $trialData['country'],
        );
        $clusters = ClusterTool::getAllClusters();
        foreach ($clusters as $cluster)
        {
            $articleData["attr_{$cluster}_url_s"] = $trialData['id'];
            $articleData["subattr_language_{$cluster}____s"] = 'en';
            $articleData['subattr_local_application___source_mixed____s'][] = "{$cluster}##unused##{$this->application->id}";
            $articleData["attr_is_invisible_{$cluster}_b"] = false;
        }
        $data = json_encode($articleData);

        $solrIndexationJob = new SolrIndexationJob();
        $solrIndexationJob->setAttribute('data', $data);
        $solrIndexationJob->store();

        return true;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:73,代码来源:import_clinical_trials.php


注:本文中的ClusterTool::getAllClusters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。