/**
	 * 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' );
		/// }
	}
 protected function getGroups(array $facet)
 {
     $structure = MessageGroups::getGroupStructure();
     return $this->makeGroupFacetRows($structure, $facet);
 }
 public function execute()
 {
     $params = $this->extractRequestParams();
     $filter = $params['filter'];
     $groups = array();
     // Parameter root as all for all pages subgroups
     if ($params['root'] === 'all') {
         $allGroups = MessageGroups::getAllGroups();
         foreach ($allGroups as $group) {
             if ($group instanceof WikiPageMessageGroup) {
                 $groups[] = $group;
             }
         }
     } elseif ($params['format'] === 'flat') {
         if ($params['root'] !== '') {
             $group = MessageGroups::getGroup($params['root']);
             if ($group) {
                 $groups[$params['root']] = $group;
             }
         } else {
             $groups = MessageGroups::getAllGroups();
             foreach (MessageGroups::getDynamicGroups() as $id => $unused) {
                 $groups[$id] = MessageGroups::getGroup($id);
             }
         }
         // Not sorted by default, so do it now
         // Work around php bug: https://bugs.php.net/bug.php?id=50688
         wfSuppressWarnings();
         usort($groups, array('MessageGroups', 'groupLabelSort'));
         wfRestoreWarnings();
     } elseif ($params['root'] !== '') {
         // format=tree from now on, as it is the only other valid option
         $group = MessageGroups::getGroup($params['root']);
         if ($group instanceof AggregateMessageGroup) {
             $groups = MessageGroups::subGroups($group);
             // The parent group is the first, ignore it
             array_shift($groups);
         }
     } else {
         $groups = MessageGroups::getGroupStructure();
         foreach (MessageGroups::getDynamicGroups() as $id => $unused) {
             $groups[$id] = MessageGroups::getGroup($id);
         }
     }
     // Do not list the sandbox group. The code that knows it
     // exists can access it directly.
     if (isset($groups['!sandbox'])) {
         unset($groups['!sandbox']);
     }
     $props = array_flip($params['prop']);
     $result = $this->getResult();
     $matcher = new StringMatcher('', $filter);
     /**
      * @var MessageGroup $mixed
      */
     foreach ($groups as $mixed) {
         if ($filter !== array() && !$matcher->match($mixed->getId())) {
             continue;
         }
         $a = $this->formatGroup($mixed, $props);
         $result->setIndexedTagName($a, 'group');
         // @todo Add a continue?
         $fit = $result->addValue(array('query', $this->getModuleName()), null, $a);
         if (!$fit) {
             $this->setWarning('Could not fit all groups in the resultset.');
             // Even if we're not going to give a continue, no point carrying on
             // if the result is full
             break;
         }
     }
     if (defined('ApiResult::META_CONTENT')) {
         $result->addIndexedTagName(array('query', $this->getModuleName()), 'group');
     } else {
         $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'group');
     }
 }
 /**
  * This funtion renders the default list of groups when no parameters
  * are passed.
  */
 public function groupInformation()
 {
     global $wgOut;
     $structure = MessageGroups::getGroupStructure();
     if (!$structure) {
         $wgOut->addWikiMsg('translate-grouplisting-empty');
         return;
     }
     $wgOut->addWikiMsg('translate-grouplisting');
     $out = '';
     foreach ($structure as $blocks) {
         $out .= $this->formatGroupInformation($blocks);
     }
     $wgOut->addHtml(Html::rawElement('table', array('class' => 'mw-sp-translate-grouplist wikitable'), $out));
 }