You are here

public function TMGMTFileFormatHTML::export in Translation Management Tool 7

Return the file content for the job data.

Parameters

$job: The translation job object to be exported.

array $conditions: (optional) An array containing list of conditions.

Return value

String with the file content.

Overrides TMGMTFileFormatInterface::export

File

translators/file/tmgmt_file.format.html.inc, line 28

Class

TMGMTFileFormatHTML
Export into HTML.

Code

public function export(TMGMTJob $job, $conditions = array()) {
  $items = array();
  foreach ($job
    ->getItems($conditions) as $item) {
    $data = array_filter(tmgmt_flatten_data($item
      ->getData()), '_tmgmt_filter_data');
    foreach ($data as $key => $value) {
      $items[$item->tjiid][$this
        ->encodeIdSafeBase64($item->tjiid . '][' . $key)] = $value;
    }
  }
  return theme('tmgmt_file_html_template', array(
    'tjid' => $job->tjid,
    'source_language' => $job
      ->getTranslator()
      ->mapToRemoteLanguage($job->source_language),
    'target_language' => $job
      ->getTranslator()
      ->mapToRemoteLanguage($job->target_language),
    'items' => $items,
  ));
}