本文整理汇总了PHP中MessageGroups::getGroupStructure方法的典型用法代码示例。如果您正苦于以下问题:PHP MessageGroups::getGroupStructure方法的具体用法?PHP MessageGroups::getGroupStructure怎么用?PHP MessageGroups::getGroupStructure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageGroups
的用法示例。
在下文中一共展示了MessageGroups::getGroupStructure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTable
/**
* 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' );
/// }
}
示例2: getGroups
protected function getGroups(array $facet)
{
$structure = MessageGroups::getGroupStructure();
return $this->makeGroupFacetRows($structure, $facet);
}
示例3: execute
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');
}
}
示例4: groupInformation
/**
* 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));
}