You are here

function tmgmt_job_statistic in Translation Management Tool 8

Same name and namespace in other branches
  1. 7 tmgmt.module \tmgmt_job_statistic()

Returns a specific statistic of a job.

Parameters

$job: The translation job entity.

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

Return value

The requested information as an integer.

Related topics

6 calls to tmgmt_job_statistic()
Job::getCountAccepted in src/Entity/Job.php
Sums up all accepted counts of this jobs job items.
Job::getCountPending in src/Entity/Job.php
Sums up all pending counts of this jobs job items.
Job::getCountReviewed in src/Entity/Job.php
Sums up all reviewed counts of this jobs job items.
Job::getCountTranslated in src/Entity/Job.php
Sums up all translated counts of this jobs job items.
Job::getTagsCount in src/Entity/Job.php
Sums up all HTML tags counts of this jobs job items.

... See full list

File

./tmgmt.module, line 369
Main module file for the Translation Management module.

Code

function tmgmt_job_statistic(JobInterface $job, $key) {
  $statistics = tmgmt_job_statistics_load(array(
    $job
      ->id(),
  ));
  if (isset($statistics[$job
    ->id()]->{$key})) {
    return $statistics[$job
      ->id()]->{$key};
  }
  return 0;
}