本文整理汇总了PHP中HTMLForm::setMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::setMethod方法的具体用法?PHP HTMLForm::setMethod怎么用?PHP HTMLForm::setMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::setMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Main execution point
*
* @param string $par title fragment
*/
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$lang = $this->getLanguage();
$out->setPageTitle($this->msg('ipblocklist'));
$out->addModuleStyles('mediawiki.special');
$request = $this->getRequest();
$par = $request->getVal('ip', $par);
$this->target = trim($request->getVal('wpTarget', $par));
$this->options = $request->getArray('wpOptions', array());
$action = $request->getText('action');
if ($action == 'unblock' || $action == 'submit' && $request->wasPosted()) {
# B/C @since 1.18: Unblock interface is now at Special:Unblock
$title = SpecialPage::getTitleFor('Unblock', $this->target);
$out->redirect($title->getFullUrl());
return;
}
# Just show the block list
$fields = array('Target' => array('type' => 'text', 'label-message' => 'ipadressorusername', 'tabindex' => '1', 'size' => '45', 'default' => $this->target), 'Options' => array('type' => 'multiselect', 'options' => array($this->msg('blocklist-userblocks')->text() => 'userblocks', $this->msg('blocklist-tempblocks')->text() => 'tempblocks', $this->msg('blocklist-addressblocks')->text() => 'addressblocks', $this->msg('blocklist-rangeblocks')->text() => 'rangeblocks'), 'flatlist' => true), 'Limit' => array('class' => 'HTMLBlockedUsersItemSelect', 'label-message' => 'table_pager_limit_label', 'options' => array($lang->formatNum(20) => 20, $lang->formatNum(50) => 50, $lang->formatNum(100) => 100, $lang->formatNum(250) => 250, $lang->formatNum(500) => 500), 'name' => 'limit', 'default' => 50));
$form = new HTMLForm($fields, $this->getContext());
$form->setMethod('get');
$form->setWrapperLegendMsg('ipblocklist-legend');
$form->setSubmitTextMsg('ipblocklist-submit');
$form->prepareForm();
$form->displayForm('');
$this->showList();
}
示例2: execute
function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
$request = $this->getRequest();
$propname = $request->getVal('propname', $par);
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select('page_props', 'pp_propname', '', __METHOD__, array('DISTINCT', 'ORDER BY' => 'pp_propname'));
$propnames = array();
foreach ($res as $row) {
$propnames[$row->pp_propname] = $row->pp_propname;
}
$form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
$form->setMethod('get');
$form->setSubmitCallback(array($this, 'onSubmit'));
$form->setWrapperLegendMsg('pageswithprop-legend');
$form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
$form->setSubmitTextMsg('pageswithprop-submit');
$form->prepareForm();
$form->displayForm(false);
if ($propname !== '' && $propname !== null) {
$form->trySubmit();
}
}
示例3: alterForm
protected function alterForm(HTMLForm $form)
{
if (!$this->title) {
$form->setMethod('GET');
}
$this->addHelpLink('Help:ChangeContentModel');
// T120576
$form->setSubmitTextMsg('changecontentmodel-submit');
}
示例4: execute
/**
* Show a form for filtering namespace and username
*
* @param $par String
* @return String
*/
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$form = new HTMLForm(array('Page1' => array('type' => 'text', 'name' => 'page1', 'label-message' => 'compare-page1', 'size' => '40', 'section' => 'page1', 'validation-callback' => array($this, 'checkExistingTitle')), 'Revision1' => array('type' => 'int', 'name' => 'rev1', 'label-message' => 'compare-rev1', 'size' => '8', 'section' => 'page1', 'validation-callback' => array($this, 'checkExistingRevision')), 'Page2' => array('type' => 'text', 'name' => 'page2', 'label-message' => 'compare-page2', 'size' => '40', 'section' => 'page2', 'validation-callback' => array($this, 'checkExistingTitle')), 'Revision2' => array('type' => 'int', 'name' => 'rev2', 'label-message' => 'compare-rev2', 'size' => '8', 'section' => 'page2', 'validation-callback' => array($this, 'checkExistingRevision')), 'Action' => array('type' => 'hidden', 'name' => 'action'), 'Diffonly' => array('type' => 'hidden', 'name' => 'diffonly'), 'Unhide' => array('type' => 'hidden', 'name' => 'unhide')), $this->getContext(), 'compare');
$form->setSubmitTextMsg('compare-submit');
$form->suppressReset();
$form->setMethod('get');
$form->setSubmitCallback(array(__CLASS__, 'showDiff'));
$form->loadData();
$form->displayForm('');
$form->trySubmit();
}
示例5: execute
/**
* Show a form for filtering namespace and username
*
* @param $par String
* @return String
*/
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$form = new HTMLForm(array('Page1' => array('type' => 'text', 'name' => 'page1', 'label-message' => 'compare-page1', 'size' => '40', 'section' => 'page1'), 'Revision1' => array('type' => 'int', 'name' => 'rev1', 'label-message' => 'compare-rev1', 'size' => '8', 'section' => 'page1'), 'Page2' => array('type' => 'text', 'name' => 'page2', 'label-message' => 'compare-page2', 'size' => '40', 'section' => 'page2'), 'Revision2' => array('type' => 'int', 'name' => 'rev2', 'label-message' => 'compare-rev2', 'size' => '8', 'section' => 'page2'), 'Action' => array('type' => 'hidden', 'name' => 'action'), 'Diffonly' => array('type' => 'hidden', 'name' => 'diffonly')), 'compare');
$form->setSubmitText(wfMsg('compare-submit'));
$form->suppressReset();
$form->setMethod('get');
$form->setTitle($this->getTitle());
$form->loadData();
$form->displayForm('');
self::showDiff($form->mFieldData);
}
示例6: execute
public function execute( $par ) {
$out = $this->getOutput();
$request = $this->getRequest();
$this->setHeaders();
$this->outputHeader();
$out->setPageTitle( $this->msg( 'ss-assessment-log' ) );
$fields = array(
'Project' => array(
'type' => 'text',
'label-message' => 'ss-project',
'tabindex' => '1'
)
);
$project = $request->getText( 'wpProject' );
$filters = array_filter( array(
'l_project' => $project
) );
$form = new HTMLForm( $fields, $this->getContext() );
$form->setMethod( 'get' );
$form->prepareForm();
$form->displayForm( '' );
$pager = new AssessmentLogPager( $this, $filters );
if( $pager->getNumRows() ) {
$out->addHTML(
$pager->getNavigationBar() .
'<table>' .
Html::rawElement( 'tr', array(),
Html::element( 'td', array(), wfMessage( 'ss-action' ) ) .
Html::element( 'td', array(), wfMessage( 'ss-old' ) ) .
Html::element( 'td', array(), wfMessage( 'ss-new' ) ) .
Html::element( 'td', array(), wfMessage( 'ss-article' ) ) .
Html::element( 'td', array(), wfMessage( 'ss-project' ) ) .
Html::element( 'td', array(), wfMessage( 'ss-timestamp' ) )
) .
$pager->getBody() .
'</table>' .
$pager->getNavigationBar()
);
} else {
$out->addWikiMsg( 'ss-assessment-log-empty' );
}
}
示例7: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
$request = $this->getRequest();
$propname = $request->getVal('propname', $par);
$propnames = $this->getExistingPropNames();
$form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
$form->setMethod('get');
$form->setSubmitCallback(array($this, 'onSubmit'));
$form->setWrapperLegendMsg('pageswithprop-legend');
$form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
$form->setSubmitTextMsg('pageswithprop-submit');
$form->prepareForm();
$form->displayForm(false);
if ($propname !== '' && $propname !== null) {
$form->trySubmit();
}
}
示例8: alterForm
protected function alterForm(HTMLForm $form)
{
if (!$this->title) {
$form->setMethod('GET');
}
}
示例9: getForm
function getForm()
{
$fields = array();
$fields['limit'] = array('type' => 'select', 'name' => 'limit', 'label-message' => 'table_pager_limit_label', 'options' => $this->getLimitSelectList(), 'default' => $this->mLimit);
if (!$this->getConfig()->get('MiserMode')) {
$fields['ilsearch'] = array('type' => 'text', 'name' => 'ilsearch', 'id' => 'mw-ilsearch', 'label-message' => 'listfiles_search_for', 'default' => $this->mSearch, 'size' => '40', 'maxlength' => '255');
}
$this->getOutput()->addModules('mediawiki.userSuggest');
$fields['user'] = array('type' => 'text', 'name' => 'user', 'id' => 'mw-listfiles-user', 'label-message' => 'username', 'default' => $this->mUserName, 'size' => '40', 'maxlength' => '255', 'cssclass' => 'mw-autocomplete-user');
$fields['ilshowall'] = array('type' => 'check', 'name' => 'ilshowall', 'id' => 'mw-listfiles-show-all', 'label-message' => 'listfiles-show-all', 'default' => $this->mShowAll);
$query = $this->getRequest()->getQueryValues();
unset($query['title']);
unset($query['limit']);
unset($query['ilsearch']);
unset($query['ilshowall']);
unset($query['user']);
$form = new HTMLForm($fields, $this->getContext());
$form->setMethod('get');
$form->setTitle($this->getTitle());
$form->setId('mw-listfiles-form');
$form->setWrapperLegendMsg('listfiles');
$form->setSubmitTextMsg('table_pager_limit_submit');
$form->addHiddenFields($query);
$form->prepareForm();
$form->displayForm('');
}
示例10: showForm
/**
* TODO
*/
protected function showForm() {
$form = new HTMLForm( $this->getFormFields(), $this->getContext() );
$form->setWrapperLegend( wfMsg( 'vipsscaler-form-legend' ) );
$form->setSubmitText( wfMsg( 'vipsscaler-form-submit' ) );
$form->setSubmitCallback( array( __CLASS__, 'processForm' ) );
$form->setMethod( 'get' );
// Looks like HTMLForm does not actually show the form if submission
// was correct. So we have to show it again.
// See HTMLForm::show()
$result = $form->show();
if( $result === true || $result instanceof Status && $result->isGood() ) {
$form->displayForm( $result );
$this->showThumbnails();
}
}
示例11: form
protected function form()
{
$out = $this->getOutput();
$out->addModules('mediawiki.userSuggest');
// Consume values
$this->opts->consumeValue('offset');
// don't carry offset, DWIW
$namespace = $this->opts->consumeValue('namespace');
$username = $this->opts->consumeValue('username');
$tagFilterVal = $this->opts->consumeValue('tagfilter');
$nsinvert = $this->opts->consumeValue('invert');
// Check username input validity
$ut = Title::makeTitleSafe(NS_USER, $username);
$userText = $ut ? $ut->getText() : '';
// Store query values in hidden fields so that form submission doesn't lose them
$hidden = array();
foreach ($this->opts->getUnconsumedValues() as $key => $value) {
$hidden[] = Html::hidden($key, $value);
}
$hidden = implode("\n", $hidden);
$form = array('namespace' => array('type' => 'namespaceselect', 'name' => 'namespace', 'label-message' => 'namespace', 'default' => $namespace), 'nsinvert' => array('type' => 'check', 'name' => 'invert', 'label-message' => 'invert', 'default' => $nsinvert, 'tooltip' => 'invert'), 'tagFilter' => array('type' => 'tagfilter', 'name' => 'tagfilter', 'label-raw' => $this->msg('tag-filter')->parse(), 'default' => $tagFilterVal), 'username' => array('type' => 'text', 'name' => 'username', 'label-message' => 'newpages-username', 'default' => $userText, 'id' => 'mw-np-username', 'size' => 30, 'cssclass' => 'mw-autocomplete-user'));
$htmlForm = new HTMLForm($form, $this->getContext());
$htmlForm->setSubmitText($this->msg('allpagessubmit')->text());
$htmlForm->setSubmitProgressive();
// The form should be visible on each request (inclusive requests with submitted forms), so
// return always false here.
$htmlForm->setSubmitCallback(function () {
return false;
});
$htmlForm->setMethod('get');
$out->addHtml(Xml::fieldset($this->msg('newpages')->text()));
$htmlForm->show();
$out->addHtml(Html::rawElement('div', null, $this->filterLinks()) . Xml::closeElement('fieldset'));
}
示例12: execute
public function execute( $par ) {
$out = $this->getOutput();
$lang = $this->getLanguage();
$request = $this->getRequest();
if( $request->wasPosted() ) {
$out->disable();
$action = $request->getVal( 'action' );
$selection_name = $request->getText( 'selection' );
if( $action == 'addtoselection' ) {
$success = Selection::addEntries( $selection_name, $entries );
$sel_page = new SpecialSelection();
$url = $sel_page->getTitle()->getLinkUrl( array( 'name' => $selection_name ) );
$return = array(
'status' => $success,
'selection_url' => $url
);
}
echo json_encode($return);
return;
}
$fields = array(
'Project-Name' => array(
'type' => 'text',
'label-message' => 'ss-project',
'tabindex' => '1'
),
'Importance' => array(
'type' => 'text',
'label-message' => 'ss-importance',
'tabindex' => '2'
),
'Quality' => array(
'type' => 'text',
'label-message' => 'ss-quality',
'tabindex' => '3'
)
);
$project = $request->getText( 'wpProject' );
$importance = $request->getText( 'wpImportance' );
$quality = $request->getText( 'wpQuality' );
$filters = array_filter( array(
'r_project' => $project,
'r_importance' => $importance,
'r_quality' => $quality
) );
$this->setHeaders();
$this->outputHeader();
$out->setPageTitle( $this->msg( 'ss-filter-ratings' ) );
$form = new HTMLForm( $fields, $this->getContext() );
$form->setMethod( 'get' );
$form->prepareForm();
$form->displayForm( '' );
$pager = new RatingsPager( $this, $filters );
if ( $pager->getNumRows() ) {
$out->addHTML(
$pager->getNavigationBar() .
$pager->getBody()
);
} else {
$out->addWikiMsg( 'ss-ratings-empty' );
}
return;
}
示例13: alterForm
function alterForm(HTMLForm $form)
{
$form->setMethod('GET');
$form->setAction($this->getPageTitle()->getLocalURL());
$form->setSubmitText($this->msg('centralauth-rename-viewprogress')->text());
}
示例14: HTMLForm
require './HTMLTextArea.php';
require './HTMLRadio.php';
require './HTMLAnchor.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$form = new HTMLForm('form_1');
$divNome = new HTMLDIV('d_nome');
$form->setMethod('POST');
$form->setAction($_SERVER['SCRIPT_NAME']);
$label = new HTMLLabel('Nome', 'i_nome');
$inputNome = new HTMLInput('text', 'i_nome');
$inputNome->addAttribute('value', "Evandro Pereira de Lacerda");
$inputNome->addAttribute('size', 60);
$text = new HTMLTextNode('Nome');
$label->addChild($inputNome);
$divNome->addChild($label);
//***************************************************
$divNascimento = new HTMLDIV('d_nasc');
$labelNascimento = new HTMLLabel("Data de Nascimento", 'i_nasc');
$nascimento = new HTMLInput('date', 'i_nasc');
$nascimento->addAttribute('size', 25);
$nascimento->addClass('input_n');
$nascimento->addClass('input_md');
示例15: getForm
function getForm()
{
$fields = array('like' => array('type' => 'text', 'label-message' => 'newimages-label', 'name' => 'like'), 'showbots' => array('type' => 'check', 'label-message' => 'newimages-showbots', 'name' => 'showbots'), 'limit' => array('type' => 'hidden', 'default' => $this->mLimit, 'name' => 'limit'), 'offset' => array('type' => 'hidden', 'default' => $this->getRequest()->getText('offset'), 'name' => 'offset'));
if ($this->getConfig()->get('MiserMode')) {
unset($fields['like']);
}
$context = new DerivativeContext($this->getContext());
$context->setTitle($this->getTitle());
// Remove subpage
$form = new HTMLForm($fields, $context);
$form->setSubmitTextMsg('ilsubmit');
$form->setMethod('get');
$form->setWrapperLegendMsg('newimages-legend');
return $form;
}