本文整理汇总了PHP中XmlSelect::addOption方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlSelect::addOption方法的具体用法?PHP XmlSelect::addOption怎么用?PHP XmlSelect::addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlSelect
的用法示例。
在下文中一共展示了XmlSelect::addOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: translationFilterForm
/**
* Hooks SpecialRecentChangesPanel. See the hook documentation for
* documentation of the function parameters.
*
* Adds a HTMl selector into $items
* @param $items
* @param $opts
* @return bool true
*/
public static function translationFilterForm( &$items, $opts ) {
$opts->consumeValue( 'translations' );
$default = $opts->getValue( 'translations' );
$label = Xml::label( wfMsg( 'translate-rc-translation-filter' ), 'mw-translation-filter' );
$select = new XmlSelect( 'translations', 'mw-translation-filter', $default );
$select->addOption( wfMsg( 'translate-rc-translation-filter-no' ), 'noaction' );
$select->addOption( wfMsg( 'translate-rc-translation-filter-only' ), 'only' );
$select->addOption( wfMsg( 'translate-rc-translation-filter-filter' ), 'filter' );
$select->addOption( wfMsg( 'translate-rc-translation-filter-site' ), 'site' );
$items['translations'] = array( $label, $select->getHTML() );
return true;
}
示例3: 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());
}
}
示例4: 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' );
}
示例5: 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);
}
示例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: 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;
}
示例8: testSetDefaultAfterAddingOptions
/**
* Adding default later on should set the correct selection or
* raise an exception.
* To handle this, we need to render the options in getHtml()
* @covers XmlSelect::setDefault
*/
public function testSetDefaultAfterAddingOptions()
{
$this->select->addOption('foo1');
$this->select->addOption('bar1');
$this->select->addOption('foo2');
$this->select->setDefault('bar1');
# setting default after adding options
$this->assertEquals('<select><option value="foo1">foo1</option>' . "\n" . '<option value="bar1" selected="">bar1</option>' . "\n" . '<option value="foo2">foo2</option></select>', $this->select->getHTML());
}
示例9: 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();
}
示例10: 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();
}
示例11: 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");
}
示例12: 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;
}
示例13: 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);
}
示例14: namespaceMessageForm
/**
* Message input fieldset
*
* @param $title Title (default: null)
* @return \string HTML for fieldset.
*/
function namespaceMessageForm(Title $title = null)
{
global $wgScript;
$namespaces = new XmlSelect('namespace', 'namespace');
$namespaces->setDefault($title->getNamespace());
foreach ($this->getSortedNamespaces() as $text => $index) {
$namespaces->addOption($text, $index);
}
$out = Xml::openElement('div', array('class' => 'namespaceoptions'));
$out .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
$out .= Html::hidden('title', $this->getTitle()->getPrefixedText());
$out .= Xml::openElement('fieldset');
$out .= Xml::element('legend', null, wfMsg('translate-translations-fieldset-title'));
$out .= Xml::openElement('table', array('id' => 'nsselect', 'class' => 'allpages'));
$out .= "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('translate-translations-messagename'), 'message') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('message', 30, $title->getText(), array('id' => 'message')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('translate-translations-project'), 'namespace') . "</td>\n\t\t\t\t<td class='mw-input'>" . $namespaces->getHTML() . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "</td>\n\t\t\t\t</tr>";
$out .= Xml::closeElement('table');
$out .= Xml::closeElement('fieldset');
$out .= Xml::closeElement('form');
$out .= Xml::closeElement('div');
return $out;
}
示例15: execute
//.........这里部分代码省略.........
?>
<label class="mw-ui-checkbox-label">
<input name="wpCreateaccountMail" type="checkbox" value="1" id="wpCreateaccountMail" tabindex="2"
<?php
if ($this->data['createemailset']) {
echo 'checked="checked"';
}
?>
>
<?php
$this->msg('createaccountmail');
?>
</label>
<?php
}
?>
</div>
<div class="mw-row-password">
<label for='wpPassword2'><?php
$this->msg('userlogin-yourpassword');
?>
</label>
<?php
echo Html::input('wpPassword', null, 'password', array('class' => 'mw-input loginPassword', 'id' => 'wpPassword2', 'tabindex' => '3', 'size' => '20', 'required', 'placeholder' => $this->getMsg('createacct-yourpassword-ph')->text()) + User::passwordChangeInputAttribs());
?>
</div>
<?php
if ($this->data['usedomain']) {
$select = new XmlSelect('wpDomain', false, $this->data['domain']);
$select->setAttribute('tabindex', 4);
foreach ($this->data['domainnames'] as $dom) {
$select->addOption($dom);
}
?>
<div id="mw-user-domain-section">
<label for="wpDomain"><?php
$this->msg('yourdomainname');
?>
</label>
<div class="mw-input">
<?php
echo $select->getHTML();
?>
</div>
</div>
<?php
}
?>
<div class="mw-row-password">
<label for='wpRetype'><?php
$this->msg('createacct-yourpasswordagain');
?>
</label>
<?php
echo Html::input('wpRetype', null, 'password', array('class' => 'mw-input loginPassword', 'id' => 'wpRetype', 'tabindex' => '5', 'size' => '20', 'required', 'placeholder' => $this->getMsg('createacct-yourpasswordagain-ph')->text()) + User::passwordChangeInputAttribs());
?>
</div>
<div>
<?php
if ($this->data['useemail']) {
?>
<label for='wpEmail'>