You are here

function profile_admin_overview in Drupal 4

Same name and namespace in other branches
  1. 5 modules/profile/profile.module \profile_admin_overview()
  2. 6 modules/profile/profile.admin.inc \profile_admin_overview()
  3. 7 modules/profile/profile.admin.inc \profile_admin_overview()

Menu callback; display a listing of all editable profile fields.

1 string reference to 'profile_admin_overview'
profile_menu in modules/profile.module
Implementation of hook_menu().

File

modules/profile.module, line 370
Support for configurable user profiles.

Code

function profile_admin_overview() {
  $result = db_query('SELECT * FROM {profile_fields} ORDER BY category, weight');
  $rows = array();
  while ($field = db_fetch_object($result)) {
    $rows[] = array(
      check_plain($field->title),
      check_plain($field->name),
      _profile_field_types($field->type),
      $field->category,
      l(t('edit'), "admin/settings/profile/edit/{$field->fid}"),
      l(t('delete'), "admin/settings/profile/delete/{$field->fid}"),
    );
  }
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => t('No fields defined.'),
        'colspan' => '6',
      ),
    );
  }
  $header = array(
    t('Title'),
    t('Name'),
    t('Type'),
    t('Category'),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $output = theme('table', $header, $rows);
  $output .= '<h2>' . t('Add new field') . '</h2>';
  $output .= '<ul>';
  foreach (_profile_field_types() as $key => $value) {
    $output .= '<li>' . l($value, "admin/settings/profile/add/{$key}") . '</li>';
  }
  $output .= '</ul>';
  return $output;
}