function chado_wrapper_split_array_agg_results
1.x chado_wrapper_functions.inc | chado_wrapper_split_array_agg_results($handler, &$values) |
Splits an SQL array of results in a single field into a php array
Parameters
$field: An SQL array (ie: {"",^(.*)$,646,tripal_analysis_blast} )
Return value
A PHP version of the SQL array (ie: array('','^(.*)$','646','tripal_analysis_blast') )
9 calls to chado_wrapper_split_array_agg_results()
- chado_views_handler_field::pre_render in tripal_views/
views/ handlers/ chado_views_handler_field.inc - Splits the aggregated values up for use in rendering
- chado_views_handler_field_boolean::pre_render in tripal_views/
views/ handlers/ chado_views_handler_field_boolean.inc - Splits the aggregated values up for use in rendering
- chado_views_handler_field_counter::pre_render in tripal_views/
views/ handlers/ chado_views_handler_field_counter.inc - Splits the aggregated values up for use in rendering
- chado_views_handler_field_custom::pre_render in tripal_views/
views/ handlers/ chado_views_handler_field_custom.inc - Splits the aggregated values up for use in rendering
- chado_views_handler_field_date::pre_render in tripal_views/
views/ handlers/ chado_views_handler_field_date.inc - Splits the aggregated values up for use in rendering
File
- tripal_views/
views/ handlers/ chado_wrapper_functions.inc, line 17 - TODO: add documentation
Code
function chado_wrapper_split_array_agg_results($handler, &$values) {
if ($handler->aggregated) {
foreach ($values as $k => $v) {
// Some custom handlers re-use the same field
// This ensures that an already split value doesn't get re-split
if (!is_array($v->{$handler->field_alias})) {
if (preg_match('/^{(.*)}$/', $v->{$handler->field_alias}, $matches)) {
$values[$k]->{$handler->field_alias} = str_getcsv($matches[1]);
}
else {
$values[$k]->{$handler->field_alias} = array();
}
}
}
}
return $values;
}