You are here

function theme_l10n_update_single_project_wrapper in Localization update 7

Format project translation state with states per language.

Parameters

$variables: An associative array containing:

  • project: Project data object
  • project_status: Project status
  • languages: Available languages.

@return string HTML output.

1 theme call to theme_l10n_update_single_project_wrapper()
theme_l10n_update_project_status in ./l10n_update.admin.inc
Format project update status.

File

./l10n_update.admin.inc, line 373
Admin settings and update page.

Code

function theme_l10n_update_single_project_wrapper($variables) {
  $project = $variables['project'];
  $name = $project->name;
  $project_status = $variables['project_status'];
  $languages = $variables['languages'];
  $history = $variables['history'];
  $updates = $variables['updates'];
  $availables = $variables['available'];

  // Output project title and project summary status.
  $output = theme('l10n_update_single_project_status', array(
    'project' => $project,
    'server' => l10n_update_server($project->l10n_server),
    'status' => $project_status,
  ));

  // Translation status per language is displayed in a table, one language per row.
  // For each language the current translation is listed. And optionally the
  // most recent update.
  $rows = array();
  foreach ($languages as $lang => $language) {

    // Determine current translation status and update status.
    $installed = isset($history[$name][$lang]) ? $history[$name][$lang] : NULL;
    $update = isset($updates[$name][$lang]) ? $updates[$name][$lang] : NULL;
    $available = isset($availables[$name][$lang]) ? $availables[$name][$lang] : NULL;
    if ($installed) {
      if ($update) {
        $status = 'updatable';
        $class = 'messages warning';
      }
      else {
        $status = 'uptodate';
        $class = 'ok';
      }
    }
    elseif ($available) {
      $status = 'available';
      $class = 'warning';
    }
    else {
      $status = 'unknown';
      $class = 'unknown';
    }

    // The current translation version.
    $row = theme('l10n_update_current_release', array(
      'language' => $language,
      'release' => $installed,
      'status' => $status,
    ));

    // If an update is available, add it.
    if ($update) {
      $row .= theme('l10n_update_available_release', array(
        'release' => $update,
      ));
    }
    $rows[] = array(
      'data' => array(
        $row,
      ),
      'class' => array(
        $class,
      ),
    );
  }

  // Output tables with translation status per language.
  $output .= '<div class="fieldset-wrapper">' . "\n";
  $output .= theme('table', array(
    'header' => array(),
    'rows' => $rows,
  ));
  $output .= "</div>\n";
  return $output;
}