list.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Profile fields.
  4. *
  5. * @todo Needs some review
  6. */
  7. // List form elements
  8. $n = 0;
  9. $loaded_defaults = array();
  10. $items = array();
  11. $fieldlist = elgg_get_config('profile_custom_fields');
  12. if ($fieldlist || $fieldlist === '0') {
  13. $fieldlistarray = explode(',', $fieldlist);
  14. foreach ($fieldlistarray as $listitem) {
  15. $translation = elgg_get_config("admin_defined_profile_$listitem");
  16. $type = elgg_get_config("admin_defined_profile_type_$listitem");
  17. if ($translation && $type) {
  18. $item = new stdClass;
  19. $item->translation = $translation;
  20. $item->shortname = $listitem;
  21. $item->name = "admin_defined_profile_$listitem";
  22. $item->type = elgg_echo("profile:field:$type");
  23. $items[] = $item;
  24. }
  25. }
  26. }
  27. ?>
  28. <ul id="elgg-profile-fields" class="mvm">
  29. <?php
  30. foreach ($items as $item) {
  31. echo elgg_view("profile/", array('value' => $item->translation));
  32. //$even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
  33. $url = elgg_view('output/url', array(
  34. 'href' => "action/profile/fields/delete?id={$item->shortname}",
  35. 'text' => elgg_view_icon('delete-alt'),
  36. 'is_action' => true,
  37. 'is_trusted' => true,
  38. ));
  39. $type = elgg_echo($item->type);
  40. $drag_arrow = elgg_view_icon("drag-arrow", "elgg-state-draggable");
  41. echo <<<HTML
  42. <li id="$item->shortname" class="clearfix">
  43. $drag_arrow
  44. <b><span id="elgg-profile-field-{$item->shortname}" class="elgg-state-editable">{$item->translation}</span></b> [$type] $url
  45. </li>
  46. HTML;
  47. }
  48. ?>
  49. </ul>