You are here

function theme_webform_admin_content in Webform 7.3

Same name and namespace in other branches
  1. 5.2 webform.module \theme_webform_admin_content()
  2. 6.3 includes/webform.admin.inc \theme_webform_admin_content()
  3. 6.2 webform.module \theme_webform_admin_content()
  4. 7.4 includes/webform.admin.inc \theme_webform_admin_content()

Generate a list of all webforms avaliable on this site.

1 theme call to theme_webform_admin_content()
webform_admin_content in includes/webform.admin.inc
Menu callback for admin/content/webform. Displays all webforms on the site.

File

includes/webform.admin.inc, line 253
Administration pages provided by Webform module.

Code

function theme_webform_admin_content($variables) {
  $nodes = $variables['nodes'];
  $header = array(
    t('Title'),
    array(
      'data' => t('View'),
      'colspan' => '4',
    ),
    array(
      'data' => t('Operations'),
      'colspan' => '3',
    ),
  );
  $rows = array();
  foreach ($nodes as $node) {
    $rows[] = array(
      l($node->title, 'node/' . $node->nid),
      l(t('Submissions'), 'node/' . $node->nid . '/webform-results'),
      l(t('Analysis'), 'node/' . $node->nid . '/webform-results/analysis'),
      l(t('Table'), 'node/' . $node->nid . '/webform-results/table'),
      l(t('Download'), 'node/' . $node->nid . '/webform-results/download'),
      node_access('update', $node) ? l(t('Edit'), 'node/' . $node->nid . '/edit') : '',
      node_access('update', $node) ? l(t('Components'), 'node/' . $node->nid . '/webform') : '',
      user_access('delete all webform submissions') ? l(t('Clear'), 'node/' . $node->nid . '/webform-results/clear') : '',
    );
  }
  if (empty($rows)) {
    $webform_types = webform_variable_get('webform_node_types');
    if (empty($webform_types)) {
      $message = t('Webform is currently not enabled on any content types.') . ' ' . t('Visit the <a href="!url">Webform settings</a> page and enable Webform on at least one content type.', array(
        '!url' => url('admin/config/content/webform'),
      ));
    }
    else {
      $webform_type_list = webform_admin_type_list();
      $message = t('There are currently no webforms on your site. Create a !types piece of content.', array(
        '!types' => $webform_type_list,
      ));
    }
    $rows[] = array(
      array(
        'data' => $message,
        'colspan' => 7,
      ),
    );
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}