You are here

function tmgmt_local_task_statistic in Translation Management Tool 8

Same name and namespace in other branches
  1. 7 translators/tmgmt_local/tmgmt_local.module \tmgmt_local_task_statistic()

Returns a specific statistic of a task.

Parameters

$task: The translation task entity.

$key: One of word_count, loop_count, count_pending, count_accepted and count_translated.

Return value

The requested information as an integer.

4 calls to tmgmt_local_task_statistic()
LocalTask::getCountCompleted in translators/tmgmt_local/src/Entity/LocalTask.php
Count of all completed data items.
LocalTask::getCountTranslated in translators/tmgmt_local/src/Entity/LocalTask.php
Count of all translated data items.
LocalTask::getCountUntranslated in translators/tmgmt_local/src/Entity/LocalTask.php
Count of all untranslated data items.
LocalTask::getWordCount in translators/tmgmt_local/src/Entity/LocalTask.php
Sums up all word counts of this task job items.

File

translators/tmgmt_local/tmgmt_local.module, line 339
Main module file for the local translation module.

Code

function tmgmt_local_task_statistic(LocalTask $task, $key) {
  $statistics = tmgmt_local_task_statistics_load(array(
    $task
      ->id(),
  ));
  if (isset($statistics[$task
    ->id()]->{$key})) {
    return $statistics[$task
      ->id()]->{$key};
  }
  return 0;
}