Tripal v1.0 (6.x-1.0)
|
Go to the source code of this file.
Functions | |
chado_wrapper_split_array_agg_results ($handler, &$values) | |
chado_wrapper_is_aggregated_by_join ($handler) | |
chado_wrapper_is_aggregated_by_result ($handler, $values) | |
chado_wrapper_render_items ($handler, $values) |
TODO: add documentation
Definition in file chado_wrapper_functions.inc.
chado_wrapper_is_aggregated_by_join | ( | $ | handler | ) |
Determines if the current field is generated via the aggregated join handler
$handler | pass in $this from handler::query() |
Definition at line 43 of file chado_wrapper_functions.inc.
{ $aggregated = FALSE; $table = $handler->query->get_table_info($handler->table); if (preg_match('/aggregator/', $table['join']->definition['handler'])) { $aggregated = TRUE; } return $aggregated; }
chado_wrapper_is_aggregated_by_result | ( | $ | handler, |
$ | values | ||
) |
Determines if the current field is generated via the result returned
$handler | pass in $this from handler::pre_render() |
$values | pass in $values from handler::pre_render() |
Definition at line 65 of file chado_wrapper_functions.inc.
{ $aggregated = FALSE; $i = 0; while (empty($values[$i]->{$handler->field_alias}) AND $i <= sizeof($values)) { $i++; } if (preg_match('/^{.*}$/', $values[$i]->{$handler->field_alias})) { $aggregated = TRUE; } return $aggregated; }
chado_wrapper_render_items | ( | $ | handler, |
$ | values | ||
) |
Definition at line 81 of file chado_wrapper_functions.inc.
{ // If it's aggregated (an array), then render each part // using the parent render functionality if ($handler->aggregated) { $items = array(); $parts = $values->{$handler->field_alias}; foreach ($parts as $p) { $v[ $handler->field_alias ] = $p; $val = (object) $v; $items[] = $handler->parent_render($val); unset($v, $val); } if ($handler->options['type'] == 'separator') { return implode(check_plain($handler->options['separator']), $items); } else { return theme('item_list', $items, NULL, $handler->options['type']); } // Otherwise it is not aggragated // Just render like the default handler would } else { return $handler->parent_render($values); } }
chado_wrapper_split_array_agg_results | ( | $ | handler, |
&$ | values | ||
) |
Splits an SQL array of results in a single field into a php array
$field | An SQL array (ie: {"",^(.*)$,646,tripal_analysis_blast} ) |
Definition at line 17 of file chado_wrapper_functions.inc.
{ if ($handler->aggregated) { foreach ($values as $k => $v) { 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; }