本文整理汇总了PHP中XmlSelect::getHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlSelect::getHTML方法的具体用法?PHP XmlSelect::getHTML怎么用?PHP XmlSelect::getHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlSelect
的用法示例。
在下文中一共展示了XmlSelect::getHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInputHTML
function getInputHTML($value)
{
$datalist = new XmlSelect(false, $this->mName . '-datalist');
$datalist->setTagName('datalist');
$datalist->addOptions($this->getOptions());
return parent::getInputHTML($value) . $datalist->getHTML();
}
示例2: 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());
}
}
示例3: 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();
}
示例4: 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();
}
示例5: 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());
}
示例6: 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();
}
示例7: 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();
}
示例8: 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");
}
示例9: getInputHTML
function getInputHTML($value)
{
$select = new XmlSelect($this->mName, $this->mID, strval($value));
if (!empty($this->mParams['disabled'])) {
$select->setAttribute('disabled', 'disabled');
}
if (isset($this->mParams['tabindex'])) {
$select->setAttribute('tabindex', $this->mParams['tabindex']);
}
if ($this->mClass !== '') {
$select->setAttribute('class', $this->mClass);
}
$select->addOptions($this->getOptions());
return $select->getHTML();
}
示例10: 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;
}
示例11: 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()));
}
示例12: getInputHTML
function getInputHTML($value)
{
$select = new XmlSelect($this->mName, $this->mID, strval($value));
if (!empty($this->mParams['disabled'])) {
$select->setAttribute('disabled', 'disabled');
}
$allowedParams = ['tabindex', 'size'];
$customParams = $this->getAttributes($allowedParams);
foreach ($customParams as $name => $value) {
$select->setAttribute($name, $value);
}
if ($this->mClass !== '') {
$select->setAttribute('class', $this->mClass);
}
$select->addOptions($this->getOptions());
return $select->getHTML();
}
示例13: 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;
}
示例14: 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);
}
示例15: 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;
}