You are here

function notifications_custom_admin_page in Notifications 6

Same name and namespace in other branches
  1. 6.4 notifications_custom/notifications_custom.admin.inc \notifications_custom_admin_page()

Page callback, administer custom subscriptions

1 string reference to 'notifications_custom_admin_page'
notifications_custom_menu in notifications_custom/notifications_custom.module
Implementation of hook_menu().

File

notifications_custom/notifications_custom.admin.inc, line 7

Code

function notifications_custom_admin_page($op = NULL) {
  $output = '';
  $base_path = 'admin/messaging/customsubs';
  if ($op == 'new') {
    drupal_set_title(t('Add custom subscription'));
    $subs = (object) array(
      'csid' => 0,
      'type' => 'custom',
      'name' => '',
      'title' => '',
      'type' => 'custom_',
      'module' => 'notifications_custom',
      'event_type' => '',
      'description' => '',
      'weight' => 0,
      'visibility' => 0,
      'fields' => array(),
    );
    $output .= drupal_get_form('notifications_custom_form', $subs);
  }
  else {
    notifications_custom_rebuild();
    if ($custom = notifications_custom_list()) {
      $header = array(
        t('Type'),
        t('Name'),
        t('Title'),
        t('Operations'),
      );
      foreach ($custom as $subs) {
        $ops = array(
          l(t('edit'), "{$base_path}/csid/{$subs->csid}/edit"),
          l(t('fields'), "{$base_path}/csid/{$subs->csid}/fields"),
        );
        $rows[] = array(
          l($subs->type, "{$base_path}/csid/{$subs->csid}/edit"),
          check_plain($subs->name),
          check_plain($subs->title),
          implode(' | ', $ops),
        );
      }
      $output .= theme('table', $header, $rows);
    }
    else {
      $output .= '<p>' . t('There are no custom subscriptions defined.') . '</p>';
    }
  }
  $output .= l(t('Add new custom subscription.'), "{$base_path}/new");
  return $output;
}