public function execute()
 {
     $params = $this->extractRequestParams();
     MessageGroupStats::setTimeLimit($params['timelimit']);
     $cache = $this->getData();
     $result = $this->getResult();
     foreach ($cache as $item => $stats) {
         if ($item < $params['offset']) {
             continue;
         }
         if ($stats[MessageGroupStats::TOTAL] === null) {
             $this->setContinueEnumParameter('offset', $item);
             break;
         }
         $data = $this->makeItem($item, $stats);
         $result->addValue(array('query', $this->getModuleName()), null, $data);
     }
     if (defined('ApiResult::META_CONTENT')) {
         $result->addIndexedTagName(array('query', $this->getModuleName()), 'stats');
     } else {
         $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'stats');
     }
 }
 public function execute()
 {
     $params = $this->extractRequestParams();
     $group = MessageGroups::getGroup($params['group']);
     if (!$group) {
         $this->dieUsageMsg(array('missingparam', 'mcgroup'));
     }
     MessageGroupStats::setTimeLimit($params['timelimit']);
     $cache = MessageGroupStats::forGroup($group->getId());
     $result = $this->getResult();
     foreach ($cache as $code => $stats) {
         if ($code < $params['offset']) {
             continue;
         }
         list($total, $translated, $fuzzy) = $stats;
         if ($total === null) {
             $this->setContinueEnumParameter('offset', $code);
             break;
         }
         $data = array('code' => $code, 'total' => $total, 'translated' => $translated, 'fuzzy' => $fuzzy);
         $result->addValue(array('query', $this->getModuleName()), null, $data);
     }
     $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'messagegroupstats');
 }
	/**
	 * Returns the table itself.
	 * @return \string HTML
	 */
	function getTable() {
		$table = $this->table;

		$this->addWorkflowStatesColumn();
		$out = '';

		if ( $this->purge ) {
			MessageGroupStats::clearLanguage( $this->target );
		}

		MessageGroupStats::setTimeLimit( $this->timelimit );
		$cache = MessageGroupStats::forLanguage( $this->target );

		$structure = MessageGroups::getGroupStructure();
		foreach ( $structure as $item ) {
			$out .= $this->makeGroupGroup( $item, $cache );
		}

		if ( $out ) {
			$table->setMainColumnHeader( wfMessage( 'translate-ls-column-group' ) );
			$out = $table->createHeader() . "\n" . $out;
			$out .= Html::closeElement( 'tbody' );

			$out .= Html::openElement( 'tfoot' );
			$out .= $table->makeTotalRow( wfMessage( 'translate-languagestats-overall' ), $this->totals );
			$out .= Html::closeElement( 'tfoot' );

			$out .= Html::closeElement( 'table' );
			return $out;
		} else {
			$this->nothing = true;
			return '';
		}

		/// @todo: Allow extra message here, once total translated volume goes
		///        over a certain percentage? (former live hack at translatewiki)
		/// if ( $this->totals['2'] && ( $this->totals['1'] / $this->totals['2'] ) > 0.95 ) {
		/// 	$out .= wfMessage( 'translate-somekey' );
		/// }
	}
 /**
  * Overwriten from SpecialLanguageStats
  *
  * @return string
  */
 function getTable()
 {
     $table = $this->table;
     $this->addWorkflowStatesColumn();
     $out = '';
     if ($this->purge) {
         MessageGroupStats::clearGroup($this->target);
     }
     MessageGroupStats::setTimeLimit($this->timelimit);
     $cache = MessageGroupStats::forGroup($this->target);
     $languages = array_keys(TranslateUtils::getLanguageNames($this->getLanguage()->getCode()));
     sort($languages);
     $this->filterPriorityLangs($languages, $this->target, $cache);
     foreach ($languages as $code) {
         if ($table->isBlacklisted($this->target, $code) !== null) {
             continue;
         }
         $out .= $this->makeRow($code, $cache);
     }
     if ($out) {
         $table->setMainColumnHeader($this->msg('translate-mgs-column-language'));
         $out = $table->createHeader() . "\n" . $out;
         $out .= Html::closeElement('tbody');
         $out .= Html::openElement('tfoot');
         $out .= $table->makeTotalRow($this->msg('translate-mgs-totals'), $this->totals);
         $out .= Html::closeElement('tfoot');
         $out .= Html::closeElement('table');
         return $out;
     } else {
         $this->nothing = true;
         return '';
     }
 }