You are here

function theme_legal_administration in Legal 7

Same name and namespace in other branches
  1. 5 legal.module \theme_legal_administration()
  2. 6.8 legal.admin.inc \theme_legal_administration()
  3. 6.7 legal.module \theme_legal_administration()
  4. 7.2 legal.admin.inc \theme_legal_administration()

File

./legal.admin.inc, line 322
Administration UI for the Legal module.

Code

function theme_legal_administration($variables) {
  $form = $variables['form'];
  $language = '';
  $output = '';
  if (empty($form['current_id']['#value'])) {
    $output .= '<p><strong>' . t('Terms & Conditions will not be shown to users, as no T&C have been saved.') . '</strong></p>';
  }
  else {
    if (module_exists('locale')) {
      $languages = locale_language_list();
      $language = $form['language_value']['#value'];
      $language = check_plain($languages[$language]);
    }
    $output .= '<h4>' . t('Most Recent Version/Revision') . '</h4>';
    $output .= '<p><strong>' . t('Version ID:') . '</strong> ' . $form['current_id']['#value'] . '<br />';
    if (!empty($language)) {
      $output .= '<strong>' . t('Language:') . '</strong> ' . $language . '<br />';
    }
    if (!empty($language)) {
      $output .= '<strong>' . t('Revision:') . '</strong> ' . $form['revision_id']['#value'] . '<br />';
    }
    $output .= '<strong>' . t('Created:') . '</strong> ' . date("l jS \\of F Y h:i:s A", $form['current_date']['#value']) . '</p>';
  }

  // Preview.
  if (empty($form['legal']['conditions']['#markup'])) {
    $output .= drupal_render($form['legal']);
  }
  else {
    $form = theme('legal_display', array(
      'form' => $form,
    ));
    $output .= '<div id="preview">';
    $output .= '<h3>' . t('Preview') . '</h3>';
    $output .= drupal_render($form['legal']);
    $output .= '</div>';
  }
  $output .= '<h4>' . t('Create New Version / Translation') . '</h4>';
  $output .= drupal_render_children($form);
  return $output;
}