/** * @param $group * @param $cache * @param $parent bool * @return string */ protected function makeGroupRow( $group, $cache, $parent = false ) { $groupId = $group->getId(); if ( $this->table->isBlacklisted( $groupId, $this->target ) !== null ) { return ''; } # These are hidden, and the code in MessageGroupStats makes sure that # these are not counted in the aggregate groups they may belong. if ( MessageGroups::getPriority( $group ) === 'discouraged' ) { return ''; } $stats = $cache[$groupId]; list( $total, $translated, $fuzzy ) = $stats; if ( $total === null ) { $this->incomplete = true; $extra = array(); } else { if ( $this->noComplete && $fuzzy === 0 && $translated === $total ) { return ''; } if ( $this->noEmpty && $translated === 0 && $fuzzy === 0 ) { return ''; } if ( $translated === $total ) { $extra = array( 'task' => 'reviewall' ); } else { $extra = array(); } } if ( !$group instanceof AggregateMessageGroup ) { $this->totals = MessageGroupStats::multiAdd( $this->totals, $stats ); } $rowParams = array(); $rowParams['data-groupid'] = $groupId; if ( is_string( $parent ) ) { $rowParams['data-parentgroups'] = $parent; } elseif ( $parent === true ) { $rowParams['data-ismeta'] = '1'; } $out = "\t" . Html::openElement( 'tr', $rowParams ); $out .= "\n\t\t" . Html::rawElement( 'td', array(), $this->table->makeGroupLink( $group, $this->target, $extra ) ); $out .= $this->table->makeNumberColumns( $fuzzy, $translated, $total ); $out .= $this->getWorkflowStateCell( $groupId ); $out .= "\n\t" . Html::closeElement( 'tr' ) . "\n"; return $out; }
/** * @param $code * @param $cache * @return string */ protected function makeRow($code, $cache) { $stats = $cache[$code]; $total = $stats[MessageGroupStats::TOTAL]; $translated = $stats[MessageGroupStats::TRANSLATED]; $fuzzy = $stats[MessageGroupStats::FUZZY]; if ($total === null) { $this->incomplete = true; $extra = array(); } else { if ($this->noComplete && $fuzzy === 0 && $translated === $total) { return ''; } if ($this->noEmpty && $translated === 0 && $fuzzy === 0) { return ''; } // Skip below 2% if "don't show without translations" is checked. if ($this->noEmpty && $translated / $total < 0.02) { return ''; } if ($translated === $total) { $extra = array('action' => 'proofread'); } else { $extra = array(); } } $this->totals = MessageGroupStats::multiAdd($this->totals, $stats); $out = "\t" . Html::openElement('tr'); $out .= "\n\t\t" . $this->getMainColumnCell($code, $extra); $out .= $this->table->makeNumberColumns($stats); $state = $this->getWorkflowStateValue($code); $out .= $this->getWorkflowStateCell($code, $state); $out .= "\n\t" . Html::closeElement('tr') . "\n"; return $out; }
/** * Actually creates the table for single message group, unless it * is blacklisted or hidden by filters. * @param MessageGroup $group * @param array $cache * @param MessageGroup $parent * @return string */ protected function makeGroupRow(MessageGroup $group, array $cache, MessageGroup $parent = null) { $groupId = $group->getId(); if ($this->table->isBlacklisted($groupId, $this->target) !== null) { return ''; } $stats = $cache[$groupId]; $total = $stats[MessageGroupStats::TOTAL]; $translated = $stats[MessageGroupStats::TRANSLATED]; $fuzzy = $stats[MessageGroupStats::FUZZY]; // Quick checks to see whether filters apply if ($this->noComplete && $fuzzy === 0 && $translated === $total) { return ''; } if ($this->noEmpty && $translated === 0 && $fuzzy === 0) { return ''; } // Calculation of summary row values if (!$group instanceof AggregateMessageGroup) { if (!isset($this->statsCounted[$groupId])) { $this->totals = MessageGroupStats::multiAdd($this->totals, $stats); $this->statsCounted[$groupId] = true; } } $state = $this->getWorkflowStateValue($groupId); $params = $stats; $params[] = $state; $params[] = $groupId; $params[] = $this->getLanguage()->getCode(); $params[] = $this->target; $cachekey = wfMemcKey(__METHOD__, implode('-', $params)); $cacheval = wfGetCache(CACHE_ANYTHING)->get($cachekey); if (!$this->purge && is_string($cacheval)) { return $cacheval; } $extra = array(); if ($total === null) { $this->incomplete = true; } elseif ($translated === $total) { $extra = array('action' => 'proofread'); } $rowParams = array(); $rowParams['data-groupid'] = $groupId; $rowParams['class'] = get_class($group); if ($parent) { $rowParams['data-parentgroup'] = $parent->getId(); } $out = "\t" . Html::openElement('tr', $rowParams); $out .= "\n\t\t" . Html::rawElement('td', array(), $this->table->makeGroupLink($group, $this->target, $extra)); $out .= $this->table->makeNumberColumns($stats); $out .= $this->getWorkflowStateCell($groupId, $state); $out .= "\n\t" . Html::closeElement('tr') . "\n"; wfGetCache(CACHE_ANYTHING)->set($cachekey, $out, 3600 * 24); return $out; }
/** * @param $code * @param $cache * @return string */ protected function makeRow($code, $cache) { $stats = $cache[$code]; list($total, $translated, $fuzzy) = $stats; if ($total === null) { $this->incomplete = true; $extra = array(); } else { if ($this->noComplete && $fuzzy === 0 && $translated === $total) { return ''; } if ($this->noEmpty && $translated === 0 && $fuzzy === 0) { return ''; } if ($translated === $total) { $extra = array('task' => 'reviewall'); } else { $extra = array(); } } $this->totals = MessageGroupStats::multiAdd($this->totals, $stats); $out = "\t" . Html::openElement('tr'); $out .= "\n\t\t" . $this->getMainColumnCell($code, $extra); $out .= $this->table->makeNumberColumns($fuzzy, $translated, $total); $out .= $this->getWorkflowStateCell($code); $out .= "\n\t" . Html::closeElement('tr') . "\n"; return $out; }