function flexprofile_get_data_for_summary_display($form, $user)
{
    $form_id = $form->getGUID();
    $data = form_get_data_from_profile($form_id, $user);
    $area_data = array();
    $maps = form_get_maps($form_id);
    if ($maps) {
        foreach ($maps as $map) {
            $field = get_entity($map->field_id);
            //print($field->internal_name.','.$field->field_type.','.$field->choice_type.','.$field->default_value.'<br />');
            $internalname = $field->internal_name;
            if (isset($data[$internalname]) && $data[$internalname]->value) {
                $area = $field->area;
                if ($area) {
                    if (!isset($area_data[$area])) {
                        $area_data[$area] = array();
                    }
                    $item = new StdClass();
                    $item->internalname = $internalname;
                    $item->title = form_field_t($form, $field, 'title');
                    $item->description = form_field_t($form, $field, 'description');
                    if ($field->field_type == 'choices') {
                        $item->fieldtype = $field->choice_type;
                        $choices = form_get_field_choices($field->getGUID());
                        $this_choice = '';
                        foreach ($choices as $choice) {
                            if ($choice->value == $data[$internalname]->value) {
                                $this_choice = $choice;
                                break;
                            }
                        }
                        $item->value = form_choice_t($form, $field, $this_choice);
                    } else {
                        $item->fieldtype = $field->field_type;
                        $item->value = $data[$internalname]->value;
                    }
                    $area_data[$area][] = $item;
                }
            }
        }
    }
    return $area_data;
}
function form_get_data_for_profile_summary_display($form, $entity)
{
    $form_id = $form->getGUID();
    $data = form_get_data_from_profile($form_id, $entity);
    $area_data = array();
    $maps = form_get_maps($form_id);
    if ($maps) {
        foreach ($maps as $map) {
            $field = get_entity($map->field_id);
            $internalname = $field->internal_name;
            if (isset($data[$internalname]) && $data[$internalname]->value) {
                $area = $field->area;
                if ($area) {
                    if (!isset($area_data[$area])) {
                        $area_data[$area] = array();
                    }
                    $item = new StdClass();
                    $item->internalname = $internalname;
                    $item->title = form_field_t($form, $field, 'title');
                    $item->description = form_field_t($form, $field, 'description');
                    $item->value = form_get_field_output($form, $field, $data[$internalname]->value);
                    $area_data[$area][] = $item;
                }
            }
        }
    }
    return $area_data;
}
function form_get_tabbed_output_display($form, $data)
{
    $form_id = $form->getGUID();
    $tab_data = array();
    $maps = form_get_maps($form_id);
    if ($maps) {
        foreach ($maps as $map) {
            $field = get_entity($map->field_id);
            if ($field->field_type != 'access') {
                $internalname = $field->internal_name;
                if (isset($data[$internalname]) && $data[$internalname]->value) {
                    if (!$field->tab) {
                        if ($form->translate) {
                            $tab = form_tab_t($form, elgg_echo('form:basic_tab_label'));
                        } else {
                            $tab = elgg_echo('form:basic_tab_label');
                        }
                    } else {
                        $tab = form_tab_t($form, $field->tab);
                    }
                    if (!isset($tab_data[$tab])) {
                        $tab_data[$tab] = '';
                    }
                    $title = form_field_t($form, $field, 'title');
                    $value = form_get_field_output($form, $field, $data[$internalname]->value);
                    $tab_data[$tab] .= elgg_view('form/extended_display_field', array('title' => $title, 'value' => $value));
                }
            }
        }
    }
    return $tab_data;
}