本文整理汇总了PHP中SearchResult::get方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchResult::get方法的具体用法?PHP SearchResult::get怎么用?PHP SearchResult::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchResult
的用法示例。
在下文中一共展示了SearchResult::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canHandle
/**
* Determines if there is any data in the data set that can be visualized by this plugin using the provided settings
*
* @param SearchResult $po_data
* @param array $pa_viz_settings Visualization settings
*
* @return bool True if data can be visualized
*/
public function canHandle($po_data, $pa_viz_settings)
{
$vn_cur_pos = $po_data->currentIndex();
if ($vn_cur_pos < 0) {
$vn_cur_pos = 0;
}
$po_data->seek(0);
$o_dm = Datamodel::load();
//
// Make sure sources actually exist
//
$va_sources = $pa_viz_settings['sources'];
foreach ($va_sources as $vs_source_code => $va_source_info) {
$va_tmp = explode('.', $va_source_info['data']);
$t_instance = $o_dm->getInstanceByTableName($va_tmp[0], true);
if (!($t_instance = $o_dm->getInstanceByTableName($va_tmp[0], true))) {
unset($va_sources[$vs_source_code]);
continue;
}
if (!$t_instance->hasField($va_tmp[1]) && !$t_instance->hasElement($va_tmp[1])) {
unset($va_sources[$vs_source_code]);
}
}
$vn_c = 0;
//
// Only check the first 10,000 returned rows before giving up, to avoid timeouts
//
while ($po_data->nextHit() && $vn_c < 10000) {
foreach ($va_sources as $vs_source_code => $va_source_info) {
if (trim($po_data->get($va_source_info['data']))) {
$po_data->seek($vn_cur_pos);
return true;
}
}
$vn_c++;
}
$po_data->seek($vn_cur_pos);
return false;
}
示例2: _evaluateCodeAttribute
/**
*
*/
private static function _evaluateCodeAttribute(SearchResult $pr_res, $po_node, array $pa_options = null)
{
if (!($va_codes = DisplayTemplateParser::_getCodesFromAttribute($po_node, ['includeBooleans' => true]))) {
return [];
}
$pb_include_blanks = caGetOption('includeBlankValuesInArray', $pa_options, false);
$ps_delimiter = caGetOption('delimiter', $pa_options, ';');
$pb_mode = caGetOption('mode', $pa_options, 'present');
// value 'present' or 'not_present'
$pn_index = caGetOption('index', $pa_options, null);
$vb_has_value = null;
foreach ($va_codes as $vs_code => $vs_bool) {
$va_val_list = $pr_res->get($vs_code, ['returnAsArray' => true, 'returnBlankValues' => true, 'convertCodesToDisplayText' => true, 'returnAsDecimal' => true, 'getDirectDate' => true]);
if (!is_array($va_val_list)) {
// no value
$vb_value_present = false;
} else {
if (!is_null($pn_index)) {
if (!isset($va_val_list[$pn_index]) || (is_numeric($va_val_list[$pn_index]) && (double) $va_val_list[$pn_index] == 0 || !strlen(trim($va_val_list[$pn_index])))) {
$vb_value_present = false;
// no value
} else {
$va_val_list = array($va_val_list[$pn_index]);
if (!$pb_include_blanks) {
$va_val_list = array_filter($va_val_list);
}
$vb_value_present = (bool) sizeof($va_val_list);
}
} else {
if (!$pb_include_blanks) {
foreach ($va_val_list as $vn_i => $vm_val) {
if (is_numeric($vm_val) && (double) $vm_val == 0 || !strlen(trim($vm_val))) {
unset($va_val_list[$vn_i]);
}
}
}
$vb_value_present = (bool) sizeof($va_val_list);
}
}
if ($pb_mode !== 'present') {
$vb_value_present = !$vb_value_present;
}
if (is_null($vb_has_value)) {
$vb_has_value = $vb_value_present;
}
$vb_has_value = $vs_bool == 'OR' ? $vb_has_value || $vb_value_present : $vb_has_value && $vb_value_present;
}
return $vb_has_value;
}
示例3: canHandle
/**
* Determines if there is any data in the data set that can be visualized by this plugin using the provided settings
*
* @param SearchResult $po_data
* @param array $pa_viz_settings Visualization settings
*
* @return bool True if data can be visualized
*/
public function canHandle($po_data, $pa_viz_settings)
{
$vn_cur_pos = $po_data->currentIndex();
if ($vn_cur_pos < 0) {
$vn_cur_pos = 0;
}
$po_data->seek(0);
$va_sources = $pa_viz_settings['sources'];
while ($po_data->nextHit()) {
foreach ($va_sources as $vs_source_code => $va_source_info) {
if (trim($po_data->get($va_source_info['data']))) {
$po_data->seek($vn_cur_pos);
return true;
}
}
}
$po_data->seek($vn_cur_pos);
return false;
}
示例4: exportRecordsFromSearchResultToArray
/**
* Export set of records from a given SearchResult object to an array of strings with the individual exports, keyed by primary key.
* The behavior is tailored towards the needs of the OAIPMHService.
*
* @param string $ps_exporter_code defines the exporter to use
* @param SearchResult $po_result search result as object
* @param array $pa_options
* 'start' =
* 'limit' =
* @return array exported data
*/
public static function exportRecordsFromSearchResultToArray($ps_exporter_code, $po_result, $pa_options = null)
{
$vn_start = isset($pa_options['start']) ? (int) $pa_options['start'] : 0;
$vn_limit = isset($pa_options['limit']) ? (int) $pa_options['limit'] : 0;
ca_data_exporters::$s_exporter_cache = array();
ca_data_exporters::$s_exporter_item_cache = array();
require_once __CA_LIB_DIR__ . '/core/Search/SearchResult.php';
if (!$po_result instanceof SearchResult) {
return false;
}
if (!($t_mapping = ca_data_exporters::loadExporterByCode($ps_exporter_code))) {
return false;
}
if (sizeof(ca_data_exporters::checkMapping($ps_exporter_code)) > 0) {
return false;
}
$t_instance = $t_mapping->getAppDatamodel()->getInstanceByTableNum($t_mapping->get('table_num'));
if ($vn_start > 0 && $vn_start < $po_result->numHits()) {
$po_result->seek($vn_start);
}
$va_return = array();
$vn_i = 0;
while ($po_result->nextHit()) {
if ($vn_limit && $vn_i >= $vn_limit) {
break;
}
$vn_pk_val = $po_result->get($t_instance->primaryKey());
$va_return[$vn_pk_val] = ca_data_exporters::exportRecord($ps_exporter_code, $vn_pk_val);
$vn_i++;
}
return $va_return;
}
示例5: _collectCheckoutData
/**
* Roll up by-user data for return
*
* @param SearchResult $qr_res A ca_object_checkouts result set
* @param string $ps_display_template Optional display template; will be returned in _display key in returned array
*
* @return array List of events (checkins, checkouts, etc.)
*/
private static function _collectCheckoutData($qr_res, $ps_display_template = null)
{
$va_checkouts = array();
if ($qr_res) {
while ($qr_res->nextHit()) {
$va_tmp = array('checkout_id' => $qr_res->get('ca_object_checkouts.checkout_id'), 'group_uuid' => $qr_res->get('ca_object_checkouts.group_uuid'), 'object_id' => $qr_res->get('ca_object_checkouts.object_id'), 'created_on' => $qr_res->get('ca_object_checkouts.created_on', array('timeOmit' => true)), 'checkout_date' => $qr_res->get('ca_object_checkouts.checkout_date', array('timeOmit' => true)), 'due_date' => $qr_res->get('ca_object_checkouts.due_date', array('timeOmit' => true)), 'return_date' => $qr_res->get('ca_object_checkouts.return_date', array('timeOmit' => true)), 'checkout_notes' => $qr_res->get('ca_object_checkouts.checkout_notes'));
if ($ps_display_template) {
$va_tmp['_display'] = $qr_res->getWithTemplate($ps_display_template);
}
$va_checkouts[] = $va_tmp;
}
}
return $va_checkouts;
}