edit.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * Edit profile form
  4. *
  5. * @uses vars['entity']
  6. */
  7. ?>
  8. <div>
  9. <label><?php echo elgg_echo('user:name:label'); ?></label>
  10. <?php echo elgg_view('input/text', array('name' => 'name', 'value' => $vars['entity']->name)); ?>
  11. </div>
  12. <?php
  13. $sticky_values = elgg_get_sticky_values('profile:edit');
  14. $profile_fields = elgg_get_config('profile_fields');
  15. if (is_array($profile_fields) && count($profile_fields) > 0) {
  16. foreach ($profile_fields as $shortname => $valtype) {
  17. $metadata = elgg_get_metadata(array(
  18. 'guid' => $vars['entity']->guid,
  19. 'metadata_name' => $shortname,
  20. 'limit' => false
  21. ));
  22. if ($metadata) {
  23. if (is_array($metadata)) {
  24. $value = '';
  25. foreach ($metadata as $md) {
  26. if (!empty($value)) {
  27. $value .= ', ';
  28. }
  29. $value .= $md->value;
  30. $access_id = $md->access_id;
  31. }
  32. } else {
  33. $value = $metadata->value;
  34. $access_id = $metadata->access_id;
  35. }
  36. } else {
  37. $value = '';
  38. $access_id = ACCESS_DEFAULT;
  39. }
  40. // sticky form values take precedence over saved ones
  41. if (isset($sticky_values[$shortname])) {
  42. $value = $sticky_values[$shortname];
  43. }
  44. if (isset($sticky_values['accesslevel'][$shortname])) {
  45. $access_id = $sticky_values['accesslevel'][$shortname];
  46. }
  47. ?>
  48. <div>
  49. <label><?php echo elgg_echo("profile:{$shortname}") ?></label>
  50. <?php
  51. $params = array(
  52. 'name' => $shortname,
  53. 'value' => $value,
  54. );
  55. echo elgg_view("input/{$valtype}", $params);
  56. $params = array(
  57. 'name' => "accesslevel[$shortname]",
  58. 'value' => $access_id,
  59. );
  60. echo elgg_view('input/access', $params);
  61. ?>
  62. </div>
  63. <?php
  64. }
  65. }
  66. elgg_clear_sticky_form('profile:edit');
  67. ?>
  68. <div class="elgg-foot">
  69. <?php
  70. echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid));
  71. echo elgg_view('input/submit', array('value' => elgg_echo('save')));
  72. ?>
  73. </div>