本文整理汇总了PHP中XmlSelect类的典型用法代码示例。如果您正苦于以下问题:PHP XmlSelect类的具体用法?PHP XmlSelect怎么用?PHP XmlSelect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlSelect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showToolbar
protected function showToolbar() {
$langSelector = Xml::languageSelector( $this->lang );
$fontSelector = new XmlSelect();
$fontSelector->setAttribute( 'id', 'webfonts-font-chooser' );
$sizeSelector = new XmlSelect();
$sizeSelector->setAttribute( 'id', 'webfonts-size-chooser' );
for ( $size = 8; $size <= 28; $size += 2 ) {
$sizeSelector->addOption( $size , $size );
}
$sizeSelector->setDefault( 16 );
$bold = Html::Element( 'button', array( 'id' => 'webfonts-preview-bold' ) , 'B' );
$italic = Html::Element( 'button', array( 'id' => 'webfonts-preview-italic' ) , 'I' );
$underline = Html::Element( 'button', array( 'id' => 'webfonts-preview-underline' ) , 'U' );
$download = Html::Element( 'a', array( 'id' => 'webfonts-preview-download', 'href' => '#' ) ,
wfMsg( 'webfonts-preview-download' ) );
return Html::openElement( 'div', array( 'id' => 'webfonts-preview-toolbar' ) )
. $langSelector[1]
. $fontSelector->getHtml()
. $sizeSelector->getHtml()
. $bold
. $italic
. $underline
. $download
. Html::closeElement( 'div' );
}
示例2: getInputHTML
function getInputHTML($value)
{
$datalist = new XmlSelect(false, $this->mName . '-datalist');
$datalist->setTagName('datalist');
$datalist->addOptions($this->getOptions());
return parent::getInputHTML($value) . $datalist->getHTML();
}
示例3: displayNavigation
private function displayNavigation()
{
global $wgOut;
$groupSelector = new XmlSelect('group', 'group-select');
// pull groups
$groups = MessageGroups::singleton()->getGroups();
foreach ($groups as $group) {
if (!$group->isMeta()) {
continue;
}
$groupSelector->addOption($group->getLabel(), $group->getId());
}
$fields = array();
$fields['transstats-choose-group'] = $groupSelector->getHTML();
$fields['transstats-group-mode-all'] = Xml::radio('mode', 0, empty($this->mMode));
$fields['transstats-group-mode-supress0'] = Xml::radio('mode', 1, $this->mMode == 1);
$fields['transstats-group-mode-supress100'] = Xml::radio('mode', 2, $this->mMode == 2);
$fields['transstats-group-mode-only100'] = Xml::radio('mode', 3, $this->mMode == 3);
$fields['transstats-group-langlist'] = Xml::input('langlist', false, $this->mLanglistPlain);
$out = Xml::openElement('form');
$out .= Xml::buildForm($fields);
$out .= Html::hidden('title', 'Special:' . $this->getName());
// FIXME: this is silly...
$out .= Xml::submitButton(wfMsg('transstats-submit'));
$out .= Xml::closeElement('form');
$wgOut->addHTML($out);
}
示例4: execute
function execute($params)
{
global $wgOut, $wgUser, $wgRequest;
$wgOut->setPageTitle('WikiFactory Reporter');
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->setArticleRelated(false);
if (!$wgUser->isAllowed('wikifactory')) {
$this->displayRestrictionError();
return;
}
$this->varid = $wgRequest->getInt('varid');
$this->disable_limit = $wgRequest->getBool('nolimit');
/***********************************************/
$vars = WikiFactory::getVariables("cv_name", 0, 0);
$select = new XmlSelect('varid', false, $this->varid);
if (!empty($this->varid)) {
//the cast is because the Xml select uses === to detect the default
$select->setDefault((string) $this->varid);
//change the name, using the var name
$variable = WikiFactory::getVarById($this->varid, 0);
$wgOut->setPageTitle('WikiFactory Reporter: ' . $variable->cv_name);
}
foreach ($vars as $variable) {
$select->addOption("{$variable->cv_name} ({$variable->cv_id})", $variable->cv_id);
}
$action = self::getTitle()->getLocalURL();
$wgOut->addHTML("<form action='{$action}' method='get'>\n");
$wgOut->addHTML($select->getHTML());
$wgOut->addHTML("<input type='submit'>\n");
$wgOut->addHTML("</form>\n");
/***********************************************/
if (!empty($this->varid)) {
$wgOut->addHTML($this->getCustomSettings());
}
}
示例5: getInputHTML
function getInputHTML($value)
{
$valInSelect = false;
if ($value !== false) {
$value = strval($value);
$valInSelect = in_array($value, HTMLFormField::flattenOptions($this->getOptions()), true);
}
$selected = $valInSelect ? $value : 'other';
$select = new XmlSelect($this->mName, $this->mID, $selected);
$select->addOptions($this->getOptions());
$select->setAttribute('class', 'mw-htmlform-select-or-other');
$tbAttribs = array('id' => $this->mID . '-other', 'size' => $this->getSize());
if (!empty($this->mParams['disabled'])) {
$select->setAttribute('disabled', 'disabled');
$tbAttribs['disabled'] = 'disabled';
}
if (isset($this->mParams['tabindex'])) {
$select->setAttribute('tabindex', $this->mParams['tabindex']);
$tbAttribs['tabindex'] = $this->mParams['tabindex'];
}
$select = $select->getHTML();
if (isset($this->mParams['maxlength'])) {
$tbAttribs['maxlength'] = $this->mParams['maxlength'];
}
if ($this->mClass !== '') {
$tbAttribs['class'] = $this->mClass;
}
$textbox = Html::input($this->mName . '-other', $valInSelect ? '' : $value, 'text', $tbAttribs);
return "{$select}<br />\n{$textbox}";
}
示例6: moduleSelector
/**
* Helper function get module selector.
*
* @param $selectedId \string Which value should be selected by default
* @return \string HTML5-compatible select-element.
*/
protected function moduleSelector($selectedId)
{
$selector = new XmlSelect('module', 'module', $selectedId);
foreach ($this->aModules as $code) {
$selector->addOption(wfMsg('translate-magic-' . $code), $code);
}
return $selector->getHTML();
}
示例7: typeSelector
public static function typeSelector($name = 'type', $value = '', $id = false)
{
$s = new XmlSelect($name, $id, $value);
$s->addOption(wfMsg('userrestrictiontype-none'), '');
$s->addOption(wfMsg('userrestrictiontype-page'), UserRestriction::PAGE);
$s->addOption(wfMsg('userrestrictiontype-namespace'), UserRestriction::NAMESPACE);
return $s->getHTML();
}
示例8: buildSelect
protected function buildSelect($list, $name, $default = '')
{
sort($list);
$select = new XmlSelect($name);
$select->setDefault($default);
foreach ($list as $wiki) {
$select->addOption($wiki);
}
return $select->getHTML();
}
示例9: moduleSelector
/**
* Helper function get module selector.
*
* @param string $selectedId Which value should be selected by default
* @return string HTML5-compatible select-element.
*/
protected function moduleSelector($selectedId)
{
// Give grep a chance to find the usages:
// translate-magic-words, translate-magic-special, translate-magic-namespace
$selector = new XmlSelect('module', 'module', $selectedId);
foreach ($this->aModules as $code) {
$selector->addOption($this->msg('translate-magic-' . $code)->text(), $code);
}
return $selector->getHTML();
}
示例10: switchForm
/**
* Output a form to allow searching for a user
*/
function switchForm()
{
global $wgScript;
$knownwiki = $this->getRequest()->getVal('wpKnownWiki');
$knownwiki = $knownwiki ? $knownwiki : wfWikiId();
// Generate wiki selector
$selector = new XmlSelect('wpKnownWiki', 'wpKnownWiki', $knownwiki);
foreach (CentralAuthUser::getWikiList() as $wiki) {
$selector->addOption($wiki);
}
$this->getOutput()->addModuleStyles('mediawiki.special');
$this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1')) . Html::hidden('title', $this->getTitle()) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('userrights-lookup-user')) . Xml::inputLabel(wfMsg('userrights-user-editname'), 'user', 'username', 30, $this->mTarget) . ' <br />' . Xml::label(wfMsg('centralauth-globalgrouppermissions-knownwiki'), 'wpKnownWiki') . ' ' . $selector->getHTML() . '<br />' . Xml::submitButton(wfMsg('editusergroup')) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
}
示例11: constructCreateForm
function constructCreateForm()
{
global $wgOut, $wgScript;
global $wgUserProperties, $wgActivityModes;
$wgOut->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalURL(), 'method' => 'post')));
$wgOut->addHTML(Xml::element('h2', null, wfMsg('nss-create-account-header')) . "\n");
$wgOut->addHTML("<table border=\"1\" id=\"newuser\">\n");
$props = array_merge(array('username', 'email'), $wgUserProperties);
foreach ($props as $i) {
$msg = 'am-' . $i;
$wgOut->addHTML("\t<tr><th>" . (wfEmptyMsg($msg, wfMsg($msg)) ? $i : wfMsgHtml($msg)) . "</th><td>" . Xml::input("am-" . str_replace(' ', '_', $i), 40) . "</td></tr>\n");
}
global $wgActivityModes;
$select = new XmlSelect("am-active");
$select->setDefault('active');
$select->setAttribute('width', '100%');
foreach ($wgActivityModes as $key) {
$select->addOption($key);
}
$wgOut->addHTML("\t<tr><th>" . wfMsgHtml('am-active') . "</th><td>" . $select->getHTML() . "</td></tr>\n");
$wgOut->addHTML("</table>\n");
$wgOut->addHTML("<div id=\"newaccount-submit\">\n" . Html::Hidden('action', 'create') . Xml::checkLabel(wfMsg('nss-no-mail'), 'nss-no-mail', 'nss-no-mail') . "<br />\n" . Xml::element('input', array('type' => 'submit', 'value' => wfMsg('nss-create-account'))) . "</div>\n</form>\n");
$wgOut->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalURL(), 'method' => 'post')));
$wgOut->addHTML("<div id=\"newaccount-raw\">\n" . Xml::textarea('nss-create-account-raw', '') . "\n" . Html::Hidden('action', 'create-raw') . Xml::checkLabel(wfMsg('nss-no-mail'), 'nss-no-mail', 'nss-no-mail') . "<br />\n" . Xml::element('input', array('type' => 'submit', 'value' => wfMsg('nss-create-account'))) . "</div>\n</form>\n");
}
示例12: execute
/**
* Executes the special page
*
* @param $param string the parameter passed in the url
*/
public function execute($param)
{
$out = $this->getOutput();
$title = Title::newFromText($param);
if ($title) {
$pageId = $title->getArticleID();
} else {
$out->addWikiMsg('articlefeedbackv5-invalid-page-id');
return;
}
$ratings = $this->fetchOverallRating($pageId);
$found = isset($ratings['found']) ? $ratings['found'] : null;
$rating = isset($ratings['rating']) ? $ratings['rating'] : null;
$out->setPagetitle($this->msg('articlefeedbackv5-special-pagetitle', $title)->escaped());
if (!$pageId) {
$out->addWikiMsg('articlefeedbackv5-invalid-page-id');
} else {
# TODO: Fix links.
$out->addHTML(Html::openElement('div', array('id' => 'articleFeedbackv5-header-links')) . Linker::link(Title::newFromText($param), $this->msg('articlefeedbackv5-go-to-article')->escaped()) . ' | ' . Linker::link(Title::newFromText($param), $this->msg('articlefeedbackv5-discussion-page')->escaped()) . ' | ' . Linker::link(Title::newFromText($param), $this->msg('articlefeedbackv5-whats-this')->escaped()) . Html::closeElement('div'));
}
$out->addHTML(Html::openElement('div', array('id' => 'articleFeedbackv5-showing-count-wrap')) . $this->msg('articlefeedbackv5-special-showing', Html::element('span', array('id' => 'articleFeedbackv5-feedback-count-total'), '0')) . Html::closeElement('div'));
if ($found) {
$out->addHtml(Html::openElement('div', array('id' => 'articleFeedbackv5-percent-found-wrap')) . $this->msg('articlefeedbackv5-percent-found', $found)->escaped() . Html::closeElement('div'));
}
# if ( $rating ) {
# $out->addWikiMsg( 'articlefeedbackv5-overall-rating', $rating );
# }
$out->addWikiMsg('articlefeedbackv5-special-title');
$out->addJsConfigVars('afPageId', $pageId);
$out->addModules('jquery.articleFeedbackv5.special');
$sortLabels = array();
$sortOpts = array('newest', 'oldest');
foreach ($sortOpts as $sort) {
$sortLabels[] = Html::element('a', array('href' => '#', 'id' => 'articleFeedbackv5-special-sort-' . $sort, 'class' => 'articleFeedbackv5-sort-link'), $this->msg('articlefeedbackv5-special-sort-' . $sort)->text());
}
$opts = array();
$counts = $this->getFilterCounts($pageId);
foreach ($this->filters as $filter) {
$count = isset($counts[$filter]) ? $counts[$filter] : 0;
$key = $this->msg('articlefeedbackv5-special-filter-' . $filter, $count)->escaped();
$opts[(string) $key] = $filter;
}
$filterSelect = new XmlSelect(false, 'articleFeedbackv5-filter');
$filterSelect->addOptions($opts);
$out->addHTML(Html::openElement('div', array('id' => 'articleFeedbackv5-sort-filter-controls')) . $this->msg('articlefeedbackv5-special-sort-label-before')->escaped() . implode($this->msg('pipe-separator')->escaped(), $sortLabels) . $this->msg('articlefeedbackv5-special-sort-label-after')->escaped() . $this->msg('articlefeedbackv5-special-filter-label-before')->escaped() . $filterSelect->getHTML() . $this->msg('articlefeedbackv5-special-filter-label-after')->escaped() . Html::element('a', array('href' => '#', 'id' => 'articleFeedbackv5-special-add-feedback'), $this->msg('articlefeedbackv5-special-add-feedback')->text()) . Html::closeElement('div'));
$out->addHTML(Html::element('div', array('id' => 'articleFeedbackv5-show-feedback')) . Html::element('a', array('href' => '#', 'id' => 'articleFeedbackv5-show-more'), $this->msg('articlefeedbackv5-special-more')->text()));
}
示例13: languageSelector
/**
* JavsScript selector for language codes.
* @return JsSelectToInput
*/
protected static function languageSelector()
{
if (is_callable(array('LanguageNames', 'getNames'))) {
$lang = RequestContext::getMain()->getLanguage();
$languages = LanguageNames::getNames($lang->getCode(), LanguageNames::FALLBACK_NORMAL);
} else {
$languages = Language::fetchLanguageNames();
}
ksort($languages);
$selector = new XmlSelect('mw-language-selector', 'mw-language-selector');
foreach ($languages as $code => $name) {
$selector->addOption("{$code} - {$name}", $code);
}
$jsSelect = new JsSelectToInput($selector);
$jsSelect->setSourceId('mw-language-selector');
return $jsSelect;
}
示例14: onRcForm
static function onRcForm( &$items, $opts ) {
global $wmincProjects, $wmincProjectSite, $wmincLangCodeLength;
list( $projectvalue, $codevalue ) = self::getValues();
$opts->consumeValue( 'rc-testwiki-project' );
$opts->consumeValue( 'rc-testwiki-code' );
$label = Xml::label( wfMsg( 'wminc-testwiki' ), 'rc-testwiki' );
$select = new XmlSelect( 'rc-testwiki-project', 'rc-testwiki-project', $projectvalue );
$select->addOption( wfMsg( 'wminc-testwiki-none' ), 'none' );
foreach( $wmincProjects as $prefix => $name ) {
$select->addOption( $name, $prefix );
}
$select->addOption( $wmincProjectSite['name'], $wmincProjectSite['short'] );
$langcode = Xml::input( 'rc-testwiki-code', (int)$wmincLangCodeLength, $codevalue,
array( 'id' => 'rc-testwiki-code', 'maxlength' => (int)$wmincLangCodeLength ) );
$items['testwiki'] = array( $label, $select->getHTML() . ' ' . $langcode );
return true;
}
示例15: displayNavigation
private function displayNavigation()
{
global $wgOut;
$groupSelector = new XmlSelect('group', 'group-select');
// pull groups
$groups = MessageGroups::singleton()->getGroups();
foreach ($groups as $group) {
if (!$group->isMeta()) {
continue;
}
$groupSelector->addOption($group->getLabel(), $group->getId());
}
$fields = array();
$fields['transstats-choose-group'] = $groupSelector->getHTML();
$fields['transstats-breakdown'] = Xml::check('breakdown', false);
$out = Xml::openElement('form');
$out .= Xml::buildForm($fields);
$out .= Xml::submitButton(wfMsg('transstats-submit'));
$out .= Xml::closeElement('form');
$wgOut->addHTML($out);
}