protected function TMGMTLocalTaskItemController::count in Translation Management Tool 7
Parse all data items recursively and sums up the counters for accepted, translated and pending items.
Parameters
$item: The current data item.
$entity: The job item the count should be calculated.
1 call to TMGMTLocalTaskItemController::count()
- TMGMTLocalTaskItemController::save in translators/
tmgmt_local/ controller/ tmgmt_local.controller.task_item.inc - @todo Eliminate the need to flatten and unflatten the TaskItem data.
File
- translators/
tmgmt_local/ controller/ tmgmt_local.controller.task_item.inc, line 54 - Contains the task item controller.
Class
- TMGMTLocalTaskItemController
- Controller class for the local task entity.
Code
protected function count(&$item, $entity) {
if (!empty($item['#text'])) {
if (_tmgmt_filter_data($item)) {
// Set default states if no state is set.
if (!isset($item['#status'])) {
$item['#status'] = TMGMT_DATA_ITEM_STATE_UNTRANSLATED;
}
switch ($item['#status']) {
case TMGMT_DATA_ITEM_STATE_TRANSLATED:
$entity->count_untranslated--;
$entity->count_translated++;
break;
}
}
}
else {
foreach (element_children($item) as $key) {
$this
->count($item[$key], $entity);
}
}
}