diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-04-16 17:43:18 -0400 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-04-16 17:43:18 -0400 |
commit | 628aa953ec150a1ed34680ef1d4f9c81dfc99bb1 (patch) | |
tree | 30e91cb88799a7c81be03759bbcec7d5bf255d1e /engine/lib/annotations.php | |
parent | 309dff2bf948ab191ccb1e8d4a777e49ad498820 (diff) | |
download | elgg-628aa953ec150a1ed34680ef1d4f9c81dfc99bb1.tar.gz elgg-628aa953ec150a1ed34680ef1d4f9c81dfc99bb1.tar.bz2 |
Denormalizing annotation names for calculation functions.
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r-- | engine/lib/annotations.php | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 7a4e62921..cd733c629 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -392,14 +392,14 @@ function elgg_list_entities_from_annotations($options = array()) { * as entity_row_to_elggstar * * @param array $options An options array: - * 'annotation_calculation' => The calculation to use. Must be a valid MySQL function. - * Defaults to sum. Result selected as 'annotation_calculation'. - * 'order_by' => The order for the sorting. Defaults to 'calculation desc'. - * 'annotation_names' => The names of annotations on the entity. - * 'annotation_values' => The values of annotations on the entity. + * 'calculation' => The calculation to use. Must be a valid MySQL function. + * Defaults to sum. Result selected as 'annotation_calculation'. + * 'order_by' => The order for the sorting. Defaults to 'calculation desc'. + * 'annotation_names' => The names of annotations on the entity. + * 'annotation_values' => The values of annotations on the entity. * - * 'metadata_names' => The name of metadata on the entity. - * 'metadata_values' => The value of metadata on the entitiy. + * 'metadata_names' => The name of metadata on the entity. + * 'metadata_values' => The value of metadata on the entitiy. * * @return mixed */ @@ -410,22 +410,18 @@ function elgg_get_entities_from_annotation_calculation($options) { ); $options = array_merge($defaults, $options); - $function = sanitize_string(elgg_extract('calculation', $options, 'sum', false)); + $db_prefix = elgg_get_config('dbprefix'); // you must cast this as an int or it sorts wrong. $options['selects'][] = 'e.*'; $options['selects'][] = "$function(cast(v.string as signed)) as calculation"; - // need our own join to get the values. -// $options['joins'][] = "JOIN {$db_prefix}metastrings msv ON a.value_id = msv.id"; -// $options['joins'][] = "JOIN {$db_prefix}entities ae ON a.entity_guid = ae.guid"; - $options['wheres'][] = get_access_sql_suffix('n_table'); -// $options['wheres'][] = "e.guid = a.entity_guid"; $options['group_by'] = 'n_table.entity_guid'; $options['callback'] = 'entity_row_to_elggstar'; + $options['denormalize'] = 'name'; return elgg_get_annotations($options); } |