You are here

function cmf_build_header in Content Management Filter 7

Same name and namespace in other branches
  1. 5 cmf.module \cmf_build_header()
  2. 6.2 cmf.module \cmf_build_header()
  3. 6 cmf.module \cmf_build_header()

Build the header of the result table.

Parameters

$user_page_user: if we are on a user page, the user that page belongs to, not the current user

Return value

array respecting tablesort_sql()

3 calls to cmf_build_header()
cmf_admin_both_form in ./both.inc
Defines the form for mixed content administration filter results.
cmf_admin_comments_form in ./comment.inc
Defines the form for comments administration filter results.
cmf_admin_nodes_form in ./node.inc
Defines the form for nodes administration filter results.

File

./cmf.module, line 749
@brief Content management filter module file

Code

function cmf_build_header($user_page_user = NULL) {
  $header = array();
  if (user_access('filter and manage site content')) {
    $header[] = theme('table_select_header_cell');
  }
  if ($_SESSION['cmf_show_nid']) {
    $header[] = array(
      'data' => t('ID'),
      'field' => 'nid',
    );
  }
  switch ($_SESSION['cmf_content_kind']) {
    case 'node':
      $header[] = array(
        'data' => t('Title'),
        'field' => 'title',
      );
      $header[] = array(
        'data' => t('Kind'),
      );
      $header[] = array(
        'data' => t('Node Type'),
        'field' => 'type',
      );
      if (!_cmf_valid_user($user_page_user)) {
        $header[] = array(
          'data' => t('Author'),
          'field' => 'username',
        );
      }
      $header[] = array(
        'data' => t('Status'),
        'field' => 'status',
      );
      $header[] = array(
        'data' => t('Time'),
        'field' => 'created',
        'sort' => 'desc',
      );
      if (module_exists('locale')) {
        $header[] = array(
          'data' => t('Language'),
          'field' => 'language',
        );
      }
      break;
    case 'comment':
      $header[] = array(
        'data' => t('Subject'),
        'field' => 'subject',
      );
      $header[] = array(
        'data' => t('Kind'),
      );
      $header[] = array(
        'data' => t('Node Type'),
        'field' => 'type',
      );
      if (!_cmf_valid_user($user_page_user)) {
        $header[] = array(
          'data' => t('Author'),
          'field' => 'username',
        );
      }
      $header[] = array(
        'data' => t('Status'),
        'field' => 'status',
      );
      $header[] = array(
        'data' => t('Time'),
        'field' => 'created',
        'sort' => 'desc',
      );
      break;
    case 'both':
      $header[] = array(
        'data' => t('Title') . '/' . t('Subject'),
        'field' => 'title',
      );
      $header[] = array(
        'data' => t('Kind'),
      );
      $header[] = array(
        'data' => t('Node Type'),
        'field' => 'type',
      );
      if (!_cmf_valid_user($user_page_user)) {
        $header[] = array(
          'data' => t('Author'),
          'field' => 'username',
        );
      }
      $header[] = array(
        'data' => t('Node Status'),
        'field' => 'status',
      );
      $header[] = array(
        'data' => t('Time'),
        'field' => 'created',
        'sort' => 'desc',
      );
      if (module_exists('locale')) {
        $header[] = array(
          'data' => t('Language'),
          'field' => 'language',
        );
      }
      break;
  }
  if (user_access('filter and manage site content')) {
    $header[] = array(
      'data' => t('Operations'),
    );
  }
  return $header;
}