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_field_output($form, $field, $value) { $form_id = $form->getGUID(); if ($form->profile) { $profile = $form->profile; } else { $profile = 0; } $type_array = array('form_data', 'user', 'group'); if (strtolower($field->field_type) == "choices") { $choices = form_get_field_choices($field->getGUID()); if (is_array($value)) { $value_array = array(); foreach ($value as $value2) { $this_choice = ''; foreach ($choices as $choice) { if ($choice->value == $value2) { $this_choice = $choice; break; } } if ($this_choice) { $value_array[$value2] = form_choice_t($form, $field, $this_choice); } else { $value_array[$value2] = $value2; } } return elgg_view("form/output/choice", array('form_id' => $form_id, 'type' => $type_array[$profile], 'internalname' => $field->internal_name, 'value' => $value_array)); } else { $this_choice = ''; foreach ($choices as $choice) { if ($choice->value == $value) { $this_choice = $choice; break; } } if ($this_choice) { return elgg_view("form/output/choice", array('form_id' => $form_id, 'type' => $type_array[$profile], 'internalname' => $field->internal_name, 'value' => $value, 'label' => form_choice_t($form, $field, $this_choice))); } else { return elgg_view("form/output/choice", array('form_id' => $form_id, 'type' => $type_array[$profile], 'internalname' => $field->internal_name, 'value' => $value)); } } } else { $view = form_field_type_to_view($field->field_type, "output"); return elgg_view($view, array('form_id' => $form_id, 'type' => $type_array[$profile], 'internalname' => $field->internal_name, 'value' => $value)); } }