当前位置: 首页>>代码示例>>PHP>>正文


PHP HTMLForm::prepareForm方法代码示例

本文整理汇总了PHP中HTMLForm::prepareForm方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::prepareForm方法的具体用法?PHP HTMLForm::prepareForm怎么用?PHP HTMLForm::prepareForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLForm的用法示例。


在下文中一共展示了HTMLForm::prepareForm方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:25,代码来源:SpecialPagesWithProp.php

示例2: 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();
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:34,代码来源:SpecialBlockList.php

示例3: testGetHTML_empty

 public function testGetHTML_empty()
 {
     $form = new HTMLForm([]);
     $form->setTitle(Title::newFromText('Foo'));
     $form->prepareForm();
     $html = $form->getHTML(false);
     $this->assertRegExp('/<form\\b/', $html);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:8,代码来源:HTMLFormTest.php

示例4: 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' );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:49,代码来源:SpecialAssessmentLog.php

示例5: 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();
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:20,代码来源:SpecialPagesWithProp.php

示例6: showUploads

 /**
  * Default action when we don't have a subpage -- just show links to the uploads we have,
  * Also show a button to clear stashed files
  * @param Status : $status - the result of processRequest
  */
 private function showUploads($status = null)
 {
     global $wgOut;
     if ($status === null) {
         $status = Status::newGood();
     }
     // sets the title, etc.
     $this->setHeaders();
     $this->outputHeader();
     // create the form, which will also be used to execute a callback to process incoming form data
     // this design is extremely dubious, but supposedly HTMLForm is our standard now?
     $form = new HTMLForm(array('Clear' => array('type' => 'hidden', 'default' => true, 'name' => 'clear')), 'clearStashedUploads');
     $form->setSubmitCallback(array(__CLASS__, 'tryClearStashedUploads'));
     $form->setTitle($this->getTitle());
     $form->setSubmitText(wfMsg('uploadstash-clear'));
     $form->prepareForm();
     $formResult = $form->tryAuthorizedSubmit();
     // show the files + form, if there are any, or just say there are none
     $refreshHtml = Html::element('a', array('href' => $this->getTitle()->getLocalURL()), wfMsg('uploadstash-refresh'));
     $files = $this->stash->listFiles();
     if (count($files)) {
         sort($files);
         $fileListItemsHtml = '';
         foreach ($files as $file) {
             // TODO: Use Linker::link or even construct the list in plain wikitext
             $fileListItemsHtml .= Html::rawElement('li', array(), Html::element('a', array('href' => $this->getTitle("file/{$file}")->getLocalURL()), $file));
         }
         $wgOut->addHtml(Html::rawElement('ul', array(), $fileListItemsHtml));
         $form->displayForm($formResult);
         $wgOut->addHtml(Html::rawElement('p', array(), $refreshHtml));
     } else {
         $wgOut->addHtml(Html::rawElement('p', array(), Html::element('span', array(), wfMsg('uploadstash-nofiles')) . ' ' . $refreshHtml));
     }
     return true;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:40,代码来源:SpecialUploadStash.php

示例7: 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('');
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:26,代码来源:SpecialListfiles.php

示例8: 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;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:77,代码来源:SpecialFilterRatings.php


注:本文中的HTMLForm::prepareForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。