function tmgmt_job_item_load_all_latest in Translation Management Tool 7
Same name and namespace in other branches
- 8 tmgmt.module \tmgmt_job_item_load_all_latest()
Loads all latest job entities that have a job item with the identifiers.
Parameters
$plugin: The source plugin.
$item_type: The source item type.
$item_id: The source item id.
string $source_language: The source language of the item.
Return value
array An array of job entities.
Related topics
1 call to tmgmt_job_item_load_all_latest()
- TMGMTJob::cleanSuggestionsList in entity/
tmgmt.entity.job.inc - Removes all suggestions from the given list which should not be processed.
File
- ./
tmgmt.module, line 405 - Main module file for the Translation Management module.
Code
function tmgmt_job_item_load_all_latest($plugin, $item_type, $item_id, $source_language) {
$query = db_select('tmgmt_job_item', 'tji');
$query
->innerJoin('tmgmt_job', 'tj', 'tj.tjid = tji.tjid');
$result = $query
->condition('tj.source_language', $source_language)
->condition('tji.state', TMGMT_JOB_ITEM_STATE_ACCEPTED, '<>')
->condition('tji.plugin', $plugin)
->condition('tji.item_type', $item_type)
->condition('tji.item_id', $item_id)
->fields('tji', array(
'tjiid',
))
->fields('tj', array(
'target_language',
))
->orderBy('tji.changed', 'DESC')
->groupBy('tj.target_language')
->groupBy('tji.tjiid')
->execute();
if ($items = $result
->fetchAllKeyed()) {
$return = array();
foreach (tmgmt_job_item_load_multiple(array_keys($items)) as $key => $item) {
$return[$items[$key]] = $item;
}
return $return;
}
return FALSE;
}