You are here

function _webform_page in Webform 5

Generate a list of all webforms avaliable on this site.

1 call to _webform_page()
webform_page in ./webform.module
Menu callback for admin/content/webform. Displays all webforms on the site.

File

./webform.inc, line 14

Code

function _webform_page() {
  $header = array(
    t('Title'),
    array(
      'data' => t('View'),
      'colspan' => '4',
    ),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $result = db_query("SELECT nid, uid, title FROM {node} WHERE type = 'webform'");
  while ($node = db_fetch_object($result)) {
    $row = array(
      l($node->title, 'node/' . $node->nid),
    );
    if (user_access('access webform results')) {
      $row[] = l(t('Submissions'), 'node/' . $node->nid . '/results');
      $row[] = l(t('Analysis'), 'node/' . $node->nid . '/results/analysis');
      $row[] = l(t('Table'), 'node/' . $node->nid . '/results/table');
      $row[] = l(t('Download'), 'node/' . $node->nid . '/results/download');
    }
    else {
      $row = array_merge($row, array(
        '',
        '',
        '',
        '',
      ));
    }
    $row[] = node_access('update', $node) ? l(t('Edit'), 'node/' . $node->nid . '/edit') : '';
    $row[] = user_access('clear webform results') ? l(t('Clear'), 'node/' . $node->nid . '/results/clear') : '';
    $rows[] = $row;
  }
  $content = theme('table', $header, $rows);
  drupal_set_title(check_plain($node->title));
  return $content;
}