You are here

function swftools_profiles_overview in SWF Tools 6.3

Presents an overview of defined profiles.

1 string reference to 'swftools_profiles_overview'
swftools_profiles_menu in profiles/swftools_profiles.module
Implementation of hook_menu().

File

profiles/swftools_profiles.admin.inc, line 11
Configuration settings for SWF Tools profiles.

Code

function swftools_profiles_overview() {

  // Begin a table
  $header = array(
    t('Name'),
    t('Profile Name'),
    t('Description'),
    array(
      'data' => t('Operations'),
      'colspan' => '4',
    ),
  );
  $rows = array();

  // Retrieve available profiles from a fresh cache
  foreach (swftools_profiles_get_profiles(TRUE) as $profile) {

    // Begin a row
    $row = array();

    // Make sure profile name uses - and not _
    $profile_url_str = str_replace('_', '-', $profile['profile']);

    // Build a row
    $row[] = check_plain($profile['name']);
    $row[] = check_plain($profile['profile']);
    $row[] = array(
      'data' => filter_xss_admin($profile['description']),
      'class' => 'description',
    );

    // Build action links
    $links = array();
    $row[] = l(t('Edit'), 'admin/settings/swftools/profile/' . $profile_url_str);
    $row[] = l(t('Configure'), 'admin/settings/swftools/profile/' . $profile_url_str . '/configure');
    $row[] = l(t('Clone'), 'admin/settings/swftools/profile/' . $profile_url_str . '/clone');
    $row[] = l(t('Delete'), 'admin/settings/swftools/profile/' . $profile_url_str . '/delete');

    // Add the row to the table
    $rows[] = $row;
  }

  // If no profiles were found give a meaningful message
  if (!$rows) {
    $rows[] = array(
      'data' => array(
        array(
          'data' => t('No profiles have been created yet.'),
          'colspan' => '4',
          'class' => 'message',
        ),
      ),
    );
  }

  // Theme the output
  $output = theme('table', $header, $rows);

  // Append the "Add a new profile" message
  return $output . theme_swftools_profiles_overview_links();
}