function execute()
 {
     $this->out->setPageTitle($this->app->runFunction('wfMsg', 'spellchecker-info'));
     // get information about enchant
     $dict = new SpellCheckerDictionary();
     // show list of all supported lanuages
     $languages = $dict->getLanguages();
     $rows = array();
     foreach ($languages as $lang) {
         $rows[] = array($lang);
     }
     $this->out->addHtml(Xml::buildTable($rows, array('class' => 'wikitable'), array($this->app->runFunction('wfMsg', 'spellchecker-info-languages', count($languages)))));
     // list providers
     $providers = $dict->getProviders();
     $rows = array();
     foreach ($providers as $provider => $dictionaries) {
         sort($dictionaries);
         $count = count($dictionaries);
         $rows[] = array($provider, implode(', ', $dictionaries) . " ({$count})");
     }
     $this->out->addHtml(Xml::buildTable($rows, array('class' => 'wikitable'), array($this->app->runFunction('wfMsg', 'spellchecker-info-provider'), $this->app->runFunction('wfMsg', 'spellchecker-info-dictionaries'))));
     // spell checking demo
     $this->out->addHtml(Xml::element('hr'));
     $this->spellCheckingForm($languages);
 }
Exemplo n.º 2
0
 private function displayStats()
 {
     global $wgOut;
     if (empty($this->mGroup)) {
         $wgOut->addHTML(wfMsg('transstats-select-group'));
         return true;
     }
     if (empty($this->mLanglist)) {
         $data['total'] = MessageGroupStatistics::forGroup($this->mGroup);
     } else {
         foreach ($this->mLanglist as $lang) {
             $data['total'][$lang] = MessageGroupStatistics::forItem($this->mGroup, $lang);
         }
     }
     if (empty($data)) {
         $wgOut->addHTML(wfMsg('transstats-error'));
         return true;
     }
     $displayData = array();
     foreach ($data['total'] as $type => $row) {
         $processed = $this->processRow($row, $type);
         if ($processed) {
             $displayData[$type] = $processed;
         }
     }
     $headers = array(wfMsg('transstats-language'), wfMsg('transstats-translated'), wfMsg('transstats-percentage'));
     $attribs = array('class' => 'wikitable');
     $table = Xml::buildTable($displayData, $attribs, $headers);
     $this->renderHeader();
     $wgOut->addHTML($table);
     $this->renderFooter();
     return true;
 }
Exemplo n.º 3
0
function efImageReviewDisplayStatus($imagePage, &$html)
{
    global $wgCityId, $wgExternalDatawareDB, $wgUser;
    if (!$wgUser->isAllowed('imagereviewstats')) {
        return true;
    }
    $html .= Xml::element('h2', array(), wfMsg('imagereview-imagepage-header'));
    $reviews = array();
    $headers = array('Reviewer', 'State', 'Time');
    $where = array('wiki_id' => $wgCityId, 'page_id' => $imagePage->getId());
    $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalDatawareDB);
    $res = $dbr->select('image_review_stats', '*', $where);
    if ($dbr->numRows($res) == 0) {
        //check if image is in the queue at all!
        $imgCurState = $dbr->selectField('image_review', 'state', $where);
        if (false === $imgCurState) {
            // oh oh, image is not in queue at all
            $html .= wfMsg('imagereview-imagepage-not-in-queue');
        } else {
            // image is in the queue but not reviewed yet
            $html .= wfMsg('imagereview-state-0');
        }
    } else {
        // go through the list and display review states
        while ($row = $dbr->fetchObject($res)) {
            $data = array();
            $data[] = User::newFromId($row->reviewer_id)->getName();
            $data[] = wfMsg('imagereview-state-' . $row->review_state);
            $data[] = $row->review_end . ' (UTC)';
            $reviews[] = $data;
        }
        $html .= Xml::buildTable($reviews, array('class' => 'wikitable filehistory sortable', 'style' => 'width: 60%'), $headers);
    }
    return true;
}
 private function displayStats()
 {
     global $wgOut;
     if (empty($this->mGroup)) {
         $wgOut->addHTML(wfMsg('transstats-select-group'));
         return true;
     }
     $data['total'] = MessageGroupStatistics::forGroup($this->mGroup);
     // need to get child groups for this meta group
     if (!empty($this->mBreakdown)) {
         $data[] = MessageGroupStatistics::forGroup($this->mBreakdown);
     }
     if (empty($data)) {
         $wgOut->addHTML(wfMsg('transstats-error'));
         return true;
     }
     foreach ($data['total'] as $type => &$row) {
         $this->processRow($row, $type);
     }
     $headers = array(wfMsg('transstats-language'), wfMsg('transstats-translated'), wfMsg('transstats-untranslated'));
     $attribs = array('class' => 'wikitable');
     $table = Xml::buildTable($data['total'], $attribs, $headers);
     $this->renderHeader();
     $wgOut->addHTML($table);
     $this->renderFooter();
     return true;
 }
Exemplo n.º 5
0
function efImageReviewDisplayStatus(ImagePage $imagePage, &$html)
{
    global $wgCityId, $wgExternalDatawareDB, $wgUser;
    if (!$wgUser->isAllowed('imagereviewstats')) {
        return true;
    }
    if (!$imagePage->getTitle()->exists()) {
        return true;
    }
    $html .= Xml::element('h2', array(), wfMsg('imagereview-imagepage-header'));
    $reviews = array();
    $headers = array(wfMessage('imagereview-imagepage-table-header-reviewer')->text(), wfMessage('imagereview-imagepage-table-header-state')->text(), wfMessage('imagereview-imagepage-table-header-time')->text());
    $where = array('wiki_id' => $wgCityId, 'page_id' => $imagePage->getId());
    $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalDatawareDB);
    $res = $dbr->select('image_review_stats', '*', $where);
    if ($dbr->numRows($res) == 0) {
        //check if image is in the queue at all!
        $imgCurState = $dbr->selectField('image_review', 'state', $where);
        if (false === $imgCurState) {
            /**
             * If the file is a local one and is older than 1 hour - send it to ImageReview
             * since it's probably been restored, and is not just a fresh file.
             */
            $lastTouched = new DateTime($imagePage->getRevisionFetched()->getTimestamp());
            $now = new DateTime();
            $file = $imagePage->getDisplayedFile();
            if ($file instanceof WikiaLocalFile && $lastTouched < $now->modify('-1 hour')) {
                $scribeEventProducer = new ScribeEventProducer('edit');
                $user = User::newFromName($file->getUser());
                if ($scribeEventProducer->buildEditPackage($imagePage, $user, null, null, $file)) {
                    $logParams = ['cityId' => $wgCityId, 'pageId' => $imagePage->getID(), 'pageTitle' => $imagePage->getTitle()->getText(), 'uploadUser' => $user->getName()];
                    \Wikia\Logger\WikiaLogger::instance()->info('ImageReviewLog', ['message' => 'Image moved back to queue', 'params' => $logParams]);
                    $scribeEventProducer->sendLog();
                }
            }
            // oh oh, image is not in queue at all
            $html .= wfMsg('imagereview-imagepage-not-in-queue');
        } else {
            // image is in the queue but not reviewed yet
            $html .= wfMsg('imagereview-state-0');
        }
    } else {
        // go through the list and display review states
        while ($row = $dbr->fetchObject($res)) {
            $data = array();
            $data[] = User::newFromId($row->reviewer_id)->getName();
            $data[] = wfMsg('imagereview-state-' . $row->review_state);
            $data[] = $row->review_end . ' (UTC)';
            $reviews[] = $data;
        }
        $html .= Xml::buildTable($reviews, array('class' => 'wikitable filehistory sortable', 'style' => 'width: 60%'), $headers);
    }
    return true;
}
 /**
  * Get all Interwiki Links - the heart of the function
  * @param $prefix string Prefix to search for in list
  * @return string HTML
  */
 private function getInterwikis($prefix = null)
 {
     global $wgScript;
     $dbr = wfGetDB(DB_SLAVE);
     $conds = array();
     if (!is_null($prefix)) {
         $conds[] = "iw_prefix " . $dbr->buildLike($prefix, $dbr->anyString());
     }
     $results = $dbr->select('interwiki', array('iw_prefix', 'iw_url'), $conds);
     $form = Xml::openElement('form', array('action' => $wgScript, 'method' => 'get', 'id' => 'interwikilist-search')) . Html::Hidden('title', $this->mTitle->getPrefixedText()) . Xml::inputLabel(wfMsg('interwikilist-prefix'), 'iwsearch', 'interwikilist-prefix', false, $prefix) . Xml::submitButton(wfMsg('search')) . Xml::closeElement('form');
     $text = Xml::fieldSet(wfMsg('interwikilist-filter'), $form);
     $interwikiList = array();
     foreach ($results as $row) {
         $interwikiList["mw-iwlist-" . $row->iw_prefix] = array($row->iw_prefix, $row->iw_url);
     }
     $dbr->freeResult($results);
     $text .= Xml::buildTable($interwikiList, array('id' => 'sv-software'), array(wfMsg('interwikilist-linkname'), wfMsg('interwikilist-target')));
     return $text;
 }
Exemplo n.º 7
0
 function showHints()
 {
     global $wgOut;
     $wgOut->addHTML(Xml::element('p', null, wfMsg('masseditregex-hint-intro')));
     $wgOut->addHTML(Xml::buildTable(array(array('/$/', 'abc', wfMsg('masseditregex-hint-toappend')), array('/$/', '\\n[[Category:New]]', wfMsg('masseditregex-hint-toappend')), array('{{OldTemplate}}', '', wfMsg('masseditregex-hint-remove')), array('\\[\\[Category:[^]]+\\]\\]', '', wfMsg('masseditregex-hint-removecat'))), array('class' => 'wikitable'), array(wfMsg('masseditregex-hint-headmatch'), wfMsg('masseditregex-hint-headreplace'), wfMsg('masseditregex-hint-headeffect'))));
     // Xml::buildTable
 }
 /**
  * Display response message to user with submitted user-supplied data
  *
  * @param $data Array: array of posted data from form
  * @param $responseMsg String: message supplied by fnPayflowDisplayResults function
  */
 function fnPayflowDisplayApprovedResults($data, $responseMsg)
 {
     global $wgOut;
     $thankyoupage = $this->adapter->getGlobal('ThankYouPage');
     if ($thankyoupage) {
         $wgOut->redirect($thankyoupage);
     } else {
         // display response message
         $wgOut->addHTML('<h3 class="response_message">' . $responseMsg . '</h3>');
         // translate country code into text
         $countries = GatewayForm::getCountries();
         $rows = array('title' => array(wfMsg('donate_interface-post-transaction')), 'amount' => array(wfMsg('donate_interface-donor-amount'), $data['amount']), 'email' => array(wfMsg('donate_interface-donor-email'), $data['email']), 'name' => array(wfMsg('donate_interface-donor-name'), $data['fname'], $data['mname'], $data['lname']), 'address' => array(wfMsg('donate_interface-donor-address'), $data['street'], $data['city'], $data['state'], $data['zip'], $countries[$data['country']]));
         // if we want to show the response
         $wgOut->addHTML(Xml::buildTable($rows, array('class' => 'submitted-response')));
     }
 }
 private function blockWikia($wikiId)
 {
     $oWiki = WikiFactory::getWikiById($wikiId);
     if (!is_object($oWiki)) {
         return false;
     }
     // process block data for display
     $data = array('wiki_id' => $oWiki->city_id, 'sitename' => WikiFactory::getVarValueByName("wgSitename", $oWiki->city_id), 'url' => WikiFactory::getVarValueByName("wgServer", $oWiki->city_id), 'last_timestamp' => $this->wg->Lang->timeanddate($oWiki->city_last_timestamp));
     // we have a valid id, change title to use it
     $this->wg->Out->setPageTitle(wfMsg('phalanx-stats-title') . ': ' . $data['url']);
     $headers = array(wfMsg('phalanx-stats-table-wiki-id'), wfMsg('phalanx-stats-table-wiki-name'), wfMsg('phalanx-stats-table-wiki-url'), wfMsg('phalanx-stats-table-wiki-last-edited'));
     $tableAttribs = array('border' => 1, 'class' => 'wikitable', 'style' => "font-family:monospace;");
     $table = Xml::buildTable(array($data), $tableAttribs, $headers);
     $this->setVal('table', $table);
     $pager = new PhalanxStatsWikiaPager($wikiId);
     $this->setVal('statsPager', $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar());
 }
Exemplo n.º 10
0
 private function block_wikia($par)
 {
     global $wgOut, $wgLang, $wgUser, $wgRequest;
     $oWiki = WikiFactory::getWikiById($par);
     if (!is_object($oWiki)) {
         return false;
     }
     $url = WikiFactory::getVarValueByName("wgServer", $oWiki->city_id);
     $sitename = WikiFactory::getVarValueByName("wgSitename", $oWiki->city_id);
     #we have a valid id, change title to use it
     $wgOut->setPageTitle(wfMsg('phalanx-stats-title') . ': ' . $url);
     // process block data for display
     $data['wiki_id'] = $oWiki->city_id;
     $data['sitename'] = $sitename;
     $data['url'] = $url;
     $data['last_timestamp'] = $wgLang->timeanddate($oWiki->city_last_timestamp);
     $html = '';
     $headers = array(wfMsg('phalanx-stats-table-wiki-id'), wfMsg('phalanx-stats-table-wiki-name'), wfMsg('phalanx-stats-table-wiki-url'), wfMsg('phalanx-stats-table-wiki-last-edited'));
     $tableAttribs = array('border' => 1, 'class' => 'wikitable', 'style' => "font-family:monospace;");
     #use magic to build it
     $table = Xml::buildTable(array($data), $tableAttribs, $headers);
     $html .= $table . "<br />\n";
     $wgOut->addHTML($html);
     $pager = new PhalanxWikiStatsPager($par);
     $html = '';
     $html .= $pager->getNavigationBar();
     $html .= $pager->getBody();
     $html .= $pager->getNavigationBar();
     $wgOut->addHTML($html);
 }
Exemplo n.º 11
0
 function table($opts)
 {
     global $wgOut;
     $data = $this->getData($opts);
     $legend = array_shift($data);
     array_unshift($legend, 'Date');
     foreach ($data[0] as $date => &$row) {
         array_unshift($row, $date);
     }
     $wgOut->addHTML(Xml::buildTable($data[0], array('class' => 'wikitable'), $legend));
 }
Exemplo n.º 12
0
Year">
			<?php 
    for ($i = 2012; $i <= $currentYear; ++$i) {
        echo Xml::option($i, $i, $i == ${$prefix . "Year"});
    }
    ?>
		</select>
	</fieldset>
<?php 
}
?>

	<?php 
echo Xml::submitButton('Show stats');
?>
	<?php 
echo Xml::submitButton('Download as CSV', array('formaction' => 'csvstats', 'class' => 'secondary'));
?>
</form>

<h2>Summary</h2>

<?php 
echo Xml::buildTable(array($summary), array('class' => 'wikitable'), $summaryHeaders);
?>

<h2>Breakdown by user</h2>

<?php 
echo Xml::buildTable($data, array('class' => 'wikitable sortable'), $headers);