本文整理汇总了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;
}
示例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 {
示例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;
}