You are here

function user_badges_settings_page in User Badges 5

1 string reference to 'user_badges_settings_page'
user_badges_menu in ./user_badges.module
Implementation of hook_menu().

File

./user_badges.module, line 355
@brief User Badges module file

Code

function user_badges_settings_page($op = NULL, $bid = NULL) {
  switch ($op) {
    case 'edit':
      if (is_numeric($bid)) {
        $output = drupal_get_form('user_badges_edit_form', $bid);
        break;
      }
    case 'delete':
      if (is_numeric($bid)) {
        $output = user_badges_delete($bid);
        break;
      }
    default:
      $badges = user_badges_get_badges('all');
      $header = array(
        t('Name'),
        t('Image'),
        t('Operations'),
      );
      if (is_array($badges)) {
        foreach ($badges as $badge) {
          $tablerow[$badge->bid]['name'] = $badge->name;
          $tablerow[$badge->bid]['image'] = theme('image', $badge->image, $badge->image, $badge->image);
          $tablerow[$badge->bid]['ops'] = l(t('edit'), 'admin/user/user_badges/edit/' . $badge->bid) . ' ' . l(t('delete'), 'admin/user/user_badges/delete/' . $badge->bid);
        }
      }
      $output = theme('table', $header, $tablerow, array(
        'style' => 'width:100%',
      ));
      $output .= "<br/><br/>";
      $form[] = array(
        '#type' => 'fieldset',
        '#title' => t('Add another'),
      );
      $output .= drupal_get_form('user_badges_edit_form');
  }
  return $output;
}