You are here

function tmgmt_handler_field_tmgmt_progress::render in Translation Management Tool 7

Render the field.

Parameters

array $values: The values retrieved from the database.

Overrides views_handler_field::render

1 method overrides tmgmt_handler_field_tmgmt_progress::render()
tmgmt_local_task_handler_field_progress::render in translators/tmgmt_local/views/handlers/tmgmt_local_task_handler_field_progress.inc
Render the field.

File

views/handlers/tmgmt_handler_field_tmgmt_progress.inc, line 34

Class

tmgmt_handler_field_tmgmt_progress
Field handler which shows the progressbar.

Code

function render($values) {

  /** @var TMGMTJobItem|TMGMTJob $object */
  $object = $this
    ->get_value($values);

  // If job has been aborted the status info is not applicable.
  if ($object
    ->isAborted()) {
    return t('N/A');
  }
  $counts = array(
    '@accepted' => $object
      ->getCountAccepted(),
    '@reviewed' => $object
      ->getCountReviewed(),
    '@translated' => $object
      ->getCountTranslated(),
    '@pending' => $object
      ->getCountPending(),
  );
  $id = $object
    ->internalIdentifier();
  if (module_exists('google_chart_tools')) {
    draw_chart($this
      ->build_progressbar_settings($id, $counts));
    return '<div id="progress' . $id . '"></div>';
  }
  $title = t('Accepted: @accepted, reviewed: @reviewed, translated: @translated, pending: @pending.', $counts);
  return sprintf('<span title="%s">%s</span>', $title, implode('/', $counts));
}