You are here

function scald_admin_dashboard in Scald: Media Management made easy 7

Same name and namespace in other branches
  1. 6 scald.admin.inc \scald_admin_dashboard()

The Scald Admin Dashboard.

Return value

string The Dashboard rendered in XHTML.

1 string reference to 'scald_admin_dashboard'
scald_menu in ./scald.module
Implements hook_menu().

File

includes/scald.admin.inc, line 20

Code

function scald_admin_dashboard() {
  $types = scald_types();
  $content = '';
  $message = '<p>' . t('This is the Scald administration dashboard. It allows to manage <em>Atom Types</em> (entity bundles) and <em>Representation Contexts</em> (entity view modes). In each context, it is possible to choose which <em>transcoder</em> (for Image atoms, it is image style) is used and how atom is rendered using different <em>players</em>. The context settings is for the atom itself, while "manage display" is to controlled how are fields displayed. If you are strange to the terminology, please read the short <a href="@readme">README.txt</a> or the long <a href="@doc">documentation pages</a>.', array(
    '@readme' => 'http://drupalcode.org/project/scald.git/blob/refs/heads/7.x-1.x:/README.txt',
    '@doc' => 'https://drupal.org/node/1652740',
  )) . '</p>';
  drupal_set_message($message);
  $content .= '<h3>' . t('Scald Unified Atom Types') . '</h3>';
  $content .= '<p>' . t('List of Scald Unified Atom Types. Each type is an entity bundle and has different fields, displays and contexts. Multiple providers (e.g. local image provider, Flickr provider) can provide atoms of the same type and share the same transcoders, players.') . '</p>';
  $list = array(
    'type' => 'ul',
    'items' => array(),
  );
  $table = array(
    'header' => array(
      t('Name'),
      array(
        'data' => t('Actions'),
        'colspan' => module_exists('i18n_string') ? 5 : 4,
      ),
    ),
    'rows' => array(),
  );
  foreach ($types as $type) {
    $rows = array(
      check_plain(scald_type_property_translate($type)),
      l(t('edit'), 'admin/structure/scald/' . $type->type),
      l(t('manage fields'), 'admin/structure/scald/' . $type->type . '/fields'),
      l(t('manage display'), 'admin/structure/scald/' . $type->type . '/display'),
      l(t('contexts'), 'admin/structure/scald/' . $type->type . '/contexts'),
    );

    // Add a 'translate' action if Internationalization is enabled.
    if (module_exists('i18n_string')) {
      $rows[] = l(t('translate'), 'admin/structure/scald/' . $type->type . '/translate');
    }
    $table['rows'][] = $rows;
  }
  $content .= theme('table', $table);

  // Tell the user, he can switch to a new export with Features.
  if (!variable_get('scald_switch_feature_export', FALSE) && module_exists('features')) {
    $content .= '<h3>' . t('Scald Context Features Export') . '</h3>';
    $switch_form = drupal_get_form('scald_switch_to_feature_form');
    $content .= drupal_render($switch_form);
  }

  // Display a context listing.
  $content .= '<h3>' . t('Scald Contexts') . '</h3>';
  $content .= '<p>' . t('List of all Scald Contexts, those created through the UI and even those hidden or defined by other modules.') . '</p>';
  $content .= '<ul class="action-links"><li>' . l(t('Add context'), 'admin/structure/scald/context/add') . '</li></ul>';
  $list = array(
    'type' => 'ul',
    'items' => array(),
  );
  $table = array(
    'header' => array(
      t('Context name'),
      t('Atom type'),
      t('Module'),
      t('Property'),
      t('Actions'),
    ),
    'rows' => array(),
  );
  $custom_contexts = variable_get('scald_custom_contexts', array());
  foreach (scald_contexts() as $name => $context) {
    $actions = array();

    // This is a context created through the UI, it could be edit or delete.
    if (array_key_exists($name, $custom_contexts)) {
      $actions[] = l(t('Edit'), 'admin/structure/scald/context/edit/' . $name);
      $actions[] = l(t('Delete'), 'admin/structure/scald/context/delete/' . $name);
    }
    $table['rows'][] = array(
      check_plain($context['title']) . '<div class="description">' . filter_xss_admin($context['description']) . '</div>',
      empty($context['formats']) ? '<em>' . t('not specified') . '</em>' : check_plain(implode(', ', array_keys($context['formats']))),
      $context['provider'],
      empty($context['hidden']) ? '' : t('hidden'),
      implode(' ', $actions),
    );
  }
  $content .= theme('table', $table);
  return $content;
}