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


PHP Xml::radio方法代码示例

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


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

示例1: getQuestionForm

	/**
	 * Get the HTML form segment for a single question
	 * @param $question SecurePoll_Question
	 * @param $options Array of options, in the order they should be displayed
	 * @return string
	 */
	function getQuestionForm( $question, $options ) {
		$name = 'securepoll_q' . $question->getId();
		$s = '';
		foreach ( $options as $option ) {
			$optionHTML = $option->parseMessageInline( 'text' );
			$optionId = $option->getId();
			$radioId = "{$name}_opt{$optionId}";
			$s .= 
				'<div class="securepoll-option-choose">' .
				Xml::radio( $name, $optionId, false, array( 'id' => $radioId ) ) .
				'&#160;' .
				Xml::tags( 'label', array( 'for' => $radioId ), $optionHTML ) .
				"</div>\n";
		}
		return $s;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:22,代码来源:ChooseBallot.php

示例2: formatOptions

 function formatOptions($options, $value)
 {
     $html = '';
     $attribs = $this->getAttributes(array('disabled', 'tabindex'));
     $elementFunc = array('Html', $this->mOptionsLabelsNotFromMessage ? 'rawElement' : 'element');
     # @todo Should this produce an unordered list perhaps?
     foreach ($options as $label => $info) {
         if (is_array($info)) {
             $html .= Html::rawElement('h1', array(), $label) . "\n";
             $html .= $this->formatOptions($info, $value);
         } else {
             $id = Sanitizer::escapeId($this->mID . "-{$info}");
             $radio = Xml::radio($this->mName, $info, $info === $value, $attribs + array('id' => $id));
             $radio .= '&#160;' . call_user_func($elementFunc, 'label', array('for' => $id), $label);
             $html .= ' ' . Html::rawElement('div', array('class' => 'mw-htmlform-flatlist-item'), $radio);
         }
     }
     return $html;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:19,代码来源:HTMLRadioField.php

示例3: formatOptions

 function formatOptions($options, $value)
 {
     global $wgUseMediaWikiUIEverywhere;
     $html = '';
     $attribs = $this->getAttributes(['disabled', 'tabindex']);
     $elementFunc = ['Html', $this->mOptionsLabelsNotFromMessage ? 'rawElement' : 'element'];
     # @todo Should this produce an unordered list perhaps?
     foreach ($options as $label => $info) {
         if (is_array($info)) {
             $html .= Html::rawElement('h1', [], $label) . "\n";
             $html .= $this->formatOptions($info, $value);
         } else {
             $id = Sanitizer::escapeId($this->mID . "-{$info}");
             $classes = ['mw-htmlform-flatlist-item'];
             if ($wgUseMediaWikiUIEverywhere || $this->mParent instanceof VFormHTMLForm) {
                 $classes[] = 'mw-ui-radio';
             }
             $radio = Xml::radio($this->mName, $info, $info === $value, $attribs + ['id' => $id]);
             $radio .= '&#160;' . call_user_func($elementFunc, 'label', ['for' => $id], $label);
             $html .= ' ' . Html::rawElement('div', ['class' => $classes], $radio);
         }
     }
     return $html;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:24,代码来源:HTMLRadioField.php

示例4: chooseNameForm

	/**
	 * Displays a form to let the user choose an account to attach with the
	 * given OpenID
	 *
	 * @param $openid String: OpenID url
	 * @param $sreg Array: options get from OpenID
	 * @param $messagekey String or null: message name to display at the top
	 */
	function chooseNameForm( $openid, $sreg, $ax, $messagekey = null ) {
		global $wgOut, $wgOpenIDAllowExistingAccountSelection, $wgAllowRealName, $wgUser;
		global $wgOpenIDProposeUsernameFromSREG, $wgOpenIDAllowAutomaticUsername, $wgOpenIDAllowNewAccountname;

		if ( $messagekey ) {
			$wgOut->addWikiMsg( $messagekey );
		}
		$wgOut->addWikiMsg( 'openidchooseinstructions' );

		$wgOut->addHTML(
			Xml::openElement( 'form',
				array( 'action' => $this->getTitle( 'ChooseName' )->getLocalUrl(), 'method' => 'POST' ) ) . "\n" .
			Xml::fieldset( wfMsg( 'openidchooselegend' ), false, array( 'id' => 'mw-openid-choosename' ) ) . "\n" .
			Xml::openElement( 'table' )
		);
		$def = false;

		if ( $wgOpenIDAllowExistingAccountSelection ) {
			# Let them attach it to an existing user

			# Grab the UserName in the cookie if it exists

			global $wgCookiePrefix;
			$name = '';
			if ( isset( $_COOKIE["{$wgCookiePrefix}UserName"] ) ) {
				$name = trim( $_COOKIE["{$wgCookiePrefix}UserName"] );
			}

			# show OpenID Attributes
			$oidAttributesToAccept = array( 'fullname', 'nickname', 'email', 'language' );
			$oidAttributes = array();

			foreach ( $oidAttributesToAccept as $oidAttr ) {
				if ( $oidAttr == 'fullname' && !$wgAllowRealName ) {
					continue;
				}

				if ( array_key_exists( $oidAttr, $sreg ) ) {
					$checkName = 'wpUpdateUserInfo' . $oidAttr;
					$oidAttributes[] = Xml::tags( 'li', array(),
						Xml::check( $checkName, false, array( 'id' => $checkName ) ) .
						Xml::tags( 'label', array( 'for' => $checkName ),
							wfMsgHtml( "openid$oidAttr" ) . wfMsgExt( 'colon-separator', array( 'escapenoentities' ) ) .
								Xml::tags( 'i', array(), $sreg[$oidAttr] )
						)
					);
				}
			}

			$oidAttributesUpdate = '';
			if ( count( $oidAttributes ) > 0 ) {
				$oidAttributesUpdate = "<br />\n" .
					wfMsgHtml( 'openidupdateuserinfo' ) . "\n" .
					Xml::tags( 'ul', array(), implode( "\n", $oidAttributes ) );
			}

			$wgOut->addHTML(
				Xml::openElement( 'tr' ) .
				Xml::tags( 'td', array( 'class' => 'mw-label' ),
					Xml::radio( 'wpNameChoice', 'existing', !$def, array( 'id' => 'wpNameChoiceExisting' ) )
				) . "\n" .
				Xml::tags( 'td', array( 'class' => 'mw-input' ),
					Xml::label( wfMsg( 'openidchooseexisting' ), 'wpNameChoiceExisting' ) . "<br />\n" .
					wfMsgHtml( 'openidchooseusername' ) . "\n" .
					Xml::input( 'wpExistingName', 16, $name, array( 'id' => 'wpExistingName' ) ) . "\n" .
					wfMsgHtml( 'openidchoosepassword' ) . "\n" .
					Xml::password( 'wpExistingPassword' ) . "\n" .
					$oidAttributesUpdate . "\n"
				) . "\n" .
				Xml::closeElement( 'tr' ) . "\n"
			);
			$def = true;
		} // $wgOpenIDAllowExistingAccountSelection

		# These are only available if all visitors are allowed to create accounts
		if ( $wgUser->isAllowed( 'createaccount' ) && !$wgUser->isBlockedFromCreateAccount() ) {

		if ( $wgOpenIDProposeUsernameFromSREG ) {

			# These options won't exist if we can't get them.
			if ( array_key_exists( 'nickname', $sreg ) && $this->userNameOK( $sreg['nickname'] ) ) {
				$wgOut->addHTML(
					Xml::openElement( 'tr' ) .
					Xml::tags( 'td', array( 'class' => 'mw-label' ),
						Xml::radio( 'wpNameChoice', 'nick', !$def, array( 'id' => 'wpNameChoiceNick' ) )
					) .
					Xml::tags( 'td', array( 'class' => 'mw-input' ),
						Xml::label( wfMsg( 'openidchoosenick', $sreg['nickname'] ), 'wpNameChoiceNick' )
					) .
					Xml::closeElement( 'tr' ) . "\n"
				);
			}
//.........这里部分代码省略.........
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:SpecialOpenIDLogin.body.php

示例5: getLogSwitcher

 /**
  * Build a radio button that switches the log type when you click it
  */
 private function getLogSwitcher($type, $id, $message, $fullUrl)
 {
     $htmlOut = '';
     $htmlOut .= Xml::radio('log_type', $id, $this->logType == $type ? true : false, array('onclick' => "switchLogs( '" . $fullUrl . "', '" . $type . "' )"));
     $htmlOut .= Xml::label(wfMsg($message), $id);
     return $htmlOut;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:10,代码来源:SpecialCentralNoticeLogs.php

示例6: formatRevisionRow

 function formatRevisionRow($row)
 {
     $rev = new Revision($row);
     $stxt = '';
     $last = $this->msg('last')->escaped();
     $ts = wfTimestamp(TS_MW, $row->rev_timestamp);
     $checkBox = Xml::radio('mergepoint', $ts, $this->mTimestamp === $ts);
     $user = $this->getUser();
     $pageLink = Linker::linkKnown($rev->getTitle(), htmlspecialchars($this->getLanguage()->userTimeAndDate($ts, $user)), [], ['oldid' => $rev->getId()]);
     if ($rev->isDeleted(Revision::DELETED_TEXT)) {
         $pageLink = '<span class="history-deleted">' . $pageLink . '</span>';
     }
     # Last link
     if (!$rev->userCan(Revision::DELETED_TEXT, $user)) {
         $last = $this->msg('last')->escaped();
     } elseif (isset($this->prevId[$row->rev_id])) {
         $last = Linker::linkKnown($rev->getTitle(), $this->msg('last')->escaped(), [], ['diff' => $row->rev_id, 'oldid' => $this->prevId[$row->rev_id]]);
     }
     $userLink = Linker::revUserTools($rev);
     $size = $row->rev_len;
     if (!is_null($size)) {
         $stxt = Linker::formatRevisionSize($size);
     }
     $comment = Linker::revComment($rev);
     return Html::rawElement('li', [], $this->msg('mergehistory-revisionrow')->rawParams($checkBox, $last, $pageLink, $userLink, $stxt, $comment)->escaped());
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:26,代码来源:SpecialMergeHistory.php

示例7: buildCheckBoxes

 /**
  * @return string HTML
  */
 protected function buildCheckBoxes()
 {
     $html = '<table>';
     // If there is just one item, use checkboxes
     $list = $this->getList();
     if ($list->length() == 1) {
         $list->reset();
         $bitfield = $list->current()->getBits();
         // existing field
         if ($this->submitClicked) {
             $bitfield = RevisionDeleter::extractBitfield($this->extractBitParams(), $bitfield);
         }
         foreach ($this->checks as $item) {
             // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
             // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
             list($message, $name, $field) = $item;
             $innerHTML = Xml::checkLabel($this->msg($message)->text(), $name, $name, $bitfield & $field);
             if ($field == Revision::DELETED_RESTRICTED) {
                 $innerHTML = "<b>{$innerHTML}</b>";
             }
             $line = Xml::tags('td', array('class' => 'mw-input'), $innerHTML);
             $html .= "<tr>{$line}</tr>\n";
         }
     } else {
         // Otherwise, use tri-state radios
         $html .= '<tr>';
         $html .= '<th class="mw-revdel-checkbox">' . $this->msg('revdelete-radio-same')->escaped() . '</th>';
         $html .= '<th class="mw-revdel-checkbox">' . $this->msg('revdelete-radio-unset')->escaped() . '</th>';
         $html .= '<th class="mw-revdel-checkbox">' . $this->msg('revdelete-radio-set')->escaped() . '</th>';
         $html .= "<th></th></tr>\n";
         foreach ($this->checks as $item) {
             // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
             // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
             list($message, $name, $field) = $item;
             // If there are several items, use third state by default...
             if ($this->submitClicked) {
                 $selected = $this->getRequest()->getInt($name, 0);
             } else {
                 $selected = -1;
                 // use existing field
             }
             $line = '<td class="mw-revdel-checkbox">' . Xml::radio($name, -1, $selected == -1) . '</td>';
             $line .= '<td class="mw-revdel-checkbox">' . Xml::radio($name, 0, $selected == 0) . '</td>';
             $line .= '<td class="mw-revdel-checkbox">' . Xml::radio($name, 1, $selected == 1) . '</td>';
             $label = $this->msg($message)->escaped();
             if ($field == Revision::DELETED_RESTRICTED) {
                 $label = "<b>{$label}</b>";
             }
             $line .= "<td>{$label}</td>";
             $html .= "<tr>{$line}</tr>\n";
         }
     }
     $html .= '</table>';
     return $html;
 }
开发者ID:natebrunette,项目名称:sphericalcow,代码行数:58,代码来源:SpecialRevisiondelete.php

示例8: showAccountConfirmForm


//.........这里部分代码省略.........
             $formName = "wpArea-" . htmlspecialchars(str_replace(' ', '_', $name));
             if ($conf['project'] != '') {
                 $pg = Linker::linkKnown(Title::newFromText($conf['project']), $this->msg('requestaccount-info')->escaped());
             } else {
                 $pg = '';
             }
             $form .= "<td>" . Xml::checkLabel($name, $formName, $formName, $this->reqAreas[$name] > 0) . " {$pg}</td>\n";
         }
         $form .= "</tr></table></div>";
         $form .= '</fieldset>';
     }
     if ($this->hasItem('Biography') || $this->hasItem('RealName')) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('confirmaccount-leg-person')->escaped() . '</legend>';
         if ($this->hasItem('RealName')) {
             $form .= '<table cellpadding=\'4\'>';
             $form .= "<tr><td>" . $this->msg('confirmaccount-real')->escaped() . "</td>";
             $form .= "<td>" . htmlspecialchars($accountReq->getRealName()) . "</td></tr>\n";
             $form .= '</table>';
         }
         if ($this->hasItem('Biography')) {
             $form .= "<p>" . $this->msg('confirmaccount-bio')->escaped() . "\n";
             $form .= "<textarea tabindex='1' name='wpNewBio' id='wpNewBio' rows='12' cols='80' style='width:100%; background-color:#f9f9f9;'>" . htmlspecialchars($this->reqBio) . "</textarea></p>\n";
         }
         $form .= '</fieldset>';
     }
     if ($this->hasItem('CV') || $this->hasItem('Notes') || $this->hasItem('Links')) {
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('confirmaccount-leg-other')->escaped() . '</legend>';
         if ($this->hasItem('CV')) {
             $form .= '<p>' . $this->msg('confirmaccount-attach')->escaped() . ' ';
             if ($accountReq->getFileName() !== null) {
                 $form .= Linker::makeKnownLinkObj($titleObj, htmlspecialchars($accountReq->getFileName()), 'file=' . $accountReq->getFileStorageKey());
             } else {
                 $form .= $this->msg('confirmaccount-none-p')->escaped();
             }
         }
         if ($this->hasItem('Notes')) {
             $form .= "</p><p>" . $this->msg('confirmaccount-notes')->escaped() . "\n";
             $form .= "<textarea tabindex='1' readonly='readonly' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" . htmlspecialchars($accountReq->getNotes()) . "</textarea></p>\n";
         }
         if ($this->hasItem('Links')) {
             $form .= "<p>" . $this->msg('confirmaccount-urls')->escaped() . "</p>\n";
             $form .= self::parseLinks($accountReq->getUrls());
         }
         $form .= '</fieldset>';
     }
     if ($reqUser->isAllowed('requestips')) {
         $blokip = SpecialPage::getTitleFor('Block');
         $link = Linker::makeKnownLinkObj($blokip, $this->msg('confirmaccount-blockip')->escaped(), 'ip=' . $accountReq->getIP() . '&wpCreateAccount=1');
         $form .= '<fieldset>';
         $form .= '<legend>' . $this->msg('confirmaccount-leg-ip')->escaped() . '</legend>';
         $wordSeparator = $this->msg('word-separator')->plain();
         $form .= "<p>";
         // @todo FIXME: Bad i18n. Should probably be something like
         // "confirmaccount-ip $1 ($2)" to get rid of this mess.
         $form .= $this->msg('confirmaccount-ip')->escaped();
         $form .= $wordSeparator;
         $form .= htmlspecialchars($accountReq->getIP());
         $form .= $wordSeparator;
         $form .= $this->msg('parentheses')->rawParams($link)->escaped();
         $form .= "</p>\n";
         if ($accountReq->getXFF()) {
             $form .= "<p>" . $this->msg('confirmaccount-xff')->escaped() . $wordSeparator . htmlspecialchars($accountReq->getXFF()) . "</p>\n";
         }
         if ($accountReq->getAgent()) {
             $form .= "<p>" . $this->msg('confirmaccount-agent')->escaped() . $wordSeparator . htmlspecialchars($accountReq->getAgent()) . "</p>\n";
         }
         $form .= '</fieldset>';
     }
     $form .= '<fieldset>';
     $form .= '<legend>' . $this->msg('confirmaccount-legend')->escaped() . '</legend>';
     $form .= "<strong>" . $this->msg('confirmaccount-confirm')->parse() . "</strong>\n";
     $form .= "<table cellpadding='5'><tr>";
     $form .= "<td>" . Xml::radio('wpSubmitType', 'accept', $this->submitType == 'accept', array('id' => 'submitCreate', 'onclick' => 'document.getElementById("wpComment").style.display="block"'));
     $form .= ' ' . Xml::label($this->msg('confirmaccount-create')->text(), 'submitCreate') . "</td>\n";
     $form .= "<td>" . Xml::radio('wpSubmitType', 'reject', $this->submitType == 'reject', array('id' => 'submitDeny', 'onclick' => 'document.getElementById("wpComment").style.display="block"'));
     $form .= ' ' . Xml::label($this->msg('confirmaccount-deny')->text(), 'submitDeny') . "</td>\n";
     $form .= "<td>" . Xml::radio('wpSubmitType', 'hold', $this->submitType == 'hold', array('id' => 'submitHold', 'onclick' => 'document.getElementById("wpComment").style.display="block"'));
     $form .= ' ' . Xml::label($this->msg('confirmaccount-hold')->text(), 'submitHold') . "</td>\n";
     $form .= "<td>" . Xml::radio('wpSubmitType', 'spam', $this->submitType == 'spam', array('id' => 'submitSpam', 'onclick' => 'document.getElementById("wpComment").style.display="none"'));
     $form .= ' ' . Xml::label($this->msg('confirmaccount-spam')->text(), 'submitSpam') . "</td>\n";
     $form .= "</tr></table>";
     $form .= "<div id='wpComment'><p>" . $this->msg('confirmaccount-reason')->escaped() . "</p>\n";
     $form .= "<p><textarea name='wpReason' id='wpReason' rows='3' cols='80' style='width:80%; display=block;'>" . htmlspecialchars($this->reason) . "</textarea></p></div>\n";
     $form .= "<p>" . Xml::submitButton($this->msg('confirmaccount-submit')->text()) . "</p>\n";
     $form .= '</fieldset>';
     $form .= Html::Hidden('title', $titleObj->getPrefixedDBKey()) . "\n";
     $form .= Html::Hidden('action', 'reject');
     $form .= Html::Hidden('acrid', $accountReq->getId());
     $form .= Html::Hidden('wpShowRejects', $this->showRejects);
     $form .= Html::Hidden('wpEditToken', $reqUser->getEditToken($accountReq->getId())) . "\n";
     $form .= Xml::closeElement('form');
     $out->addHTML($form);
     global $wgMemc;
     # Set a key to who is looking at this request.
     # Have it expire in 10 minutes...
     $key = wfMemcKey('acctrequest', 'view', $accountReq->getId());
     $wgMemc->set($key, $reqUser->getID(), 60 * 10);
 }
开发者ID:paladox,项目名称:mediawiki-extensions-ConfirmAccount,代码行数:101,代码来源:ConfirmAccount_body.php

示例9: getRadioSet

 /**
  * Get a set of labelled radio buttons.
  *
  * @param $params Array
  *    Parameters are:
  *      var:            The variable to be configured (required)
  *      label:          The message name for the label (required)
  *      itemLabelPrefix: The message name prefix for the item labels (required)
  *      values:         List of allowed values (required)
  *      itemAttribs     Array of attribute arrays, outer key is the value name (optional)
  *      commonAttribs   Attribute array applied to all items
  *      controlName:    The name for the input element (optional)
  *      value:          The current value of the variable (optional)
  *      help:		The html for the help text (optional)
  *
  * @return string
  */
 public function getRadioSet($params)
 {
     if (!isset($params['controlName'])) {
         $params['controlName'] = 'config_' . $params['var'];
     }
     if (!isset($params['value'])) {
         $params['value'] = $this->getVar($params['var']);
     }
     if (!isset($params['label'])) {
         $label = '';
     } else {
         $label = $params['label'];
     }
     if (!isset($params['help'])) {
         $params['help'] = "";
     }
     $s = "<ul>\n";
     foreach ($params['values'] as $value) {
         $itemAttribs = array();
         if (isset($params['commonAttribs'])) {
             $itemAttribs = $params['commonAttribs'];
         }
         if (isset($params['itemAttribs'][$value])) {
             $itemAttribs = $params['itemAttribs'][$value] + $itemAttribs;
         }
         $checked = $value == $params['value'];
         $id = $params['controlName'] . '_' . $value;
         $itemAttribs['id'] = $id;
         $itemAttribs['tabindex'] = $this->nextTabIndex();
         $s .= '<li>' . Xml::radio($params['controlName'], $value, $checked, $itemAttribs) . '&#160;' . Xml::tags('label', array('for' => $id), $this->parse(wfMessage($params['itemLabelPrefix'] . strtolower($value))->plain())) . "</li>\n";
     }
     $s .= "</ul>\n";
     return $this->label($label, $params['controlName'], $s, $params['help']);
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:51,代码来源:WebInstaller.php

示例10: getHTML

 public static function getHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args)
 {
     global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
     // Standardize $cur_value
     if (is_null($cur_value)) {
         $cur_value = '';
     }
     if (($possible_values = $other_args['possible_values']) == null) {
         // If it's a Boolean property, display 'Yes' and 'No'
         // as the values.
         if (array_key_exists('property_type', $other_args) && $other_args['property_type'] == '_boo') {
             $possible_values = array(SFUtils::getWordForYesOrNo(true), SFUtils::getWordForYesOrNo(false));
         } else {
             $possible_values = array();
         }
     }
     // Add a "None" value at the beginning, unless this is a
     // mandatory field and there's a current value in place (either
     // through a default value or because we're editing an existing
     // page).
     if (!$is_mandatory || $cur_value === '') {
         array_unshift($possible_values, '');
     }
     // Set $cur_value to be one of the allowed options, if it isn't
     // already - that makes it easier to automatically have one of
     // the radiobuttons be checked at the beginning.
     if (!in_array($cur_value, $possible_values)) {
         if (in_array('', $possible_values)) {
             $cur_value = '';
         } elseif (count($possible_values) == 0) {
             $cur_value = '';
         } else {
             $cur_value = $possible_values[0];
         }
     }
     $text = "\n";
     $itemClass = 'radioButtonItem';
     if (array_key_exists('class', $other_args)) {
         $itemClass .= ' ' . $other_args['class'];
     }
     $itemAttrs = array('class' => $itemClass);
     foreach ($possible_values as $possible_value) {
         $sfgTabIndex++;
         $sfgFieldNum++;
         $input_id = "input_{$sfgFieldNum}";
         $radiobutton_attrs = array('id' => $input_id, 'tabindex' => $sfgTabIndex);
         $isChecked = false;
         if ($cur_value == $possible_value) {
             $isChecked = true;
             //$radiobutton_attrs['checked'] = true;
         }
         if ($is_disabled) {
             $radiobutton_attrs['disabled'] = true;
         }
         if ($possible_value === '') {
             // blank/"None" value
             $label = wfMessage('sf_formedit_none')->text();
         } elseif (array_key_exists('value_labels', $other_args) && is_array($other_args['value_labels']) && array_key_exists($possible_value, $other_args['value_labels'])) {
             $label = htmlspecialchars($other_args['value_labels'][$possible_value]);
         } else {
             $label = $possible_value;
         }
         $text .= "\t" . Html::rawElement('label', $itemAttrs, Xml::radio($input_name, $possible_value, $isChecked, $radiobutton_attrs) . " {$label}") . "\n";
     }
     $spanClass = 'radioButtonSpan';
     if (array_key_exists('class', $other_args)) {
         $spanClass .= ' ' . $other_args['class'];
     }
     if ($is_mandatory) {
         $spanClass .= ' mandatoryFieldSpan';
     }
     $spanID = "span_{$sfgFieldNum}";
     // Do the 'show on select' handling.
     if (array_key_exists('show on select', $other_args)) {
         $spanClass .= ' sfShowIfChecked';
         foreach ($other_args['show on select'] as $div_id => $options) {
             if (array_key_exists($spanID, $sfgShowOnSelect)) {
                 $sfgShowOnSelect[$spanID][] = array($options, $div_id);
             } else {
                 $sfgShowOnSelect[$spanID] = array(array($options, $div_id));
             }
         }
     }
     $spanAttrs = array('id' => $spanID, 'class' => $spanClass);
     $text = Html::rawElement('span', $spanAttrs, $text);
     return $text;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:87,代码来源:SF_RadioButtonInput.php

示例11: eRadio

 /**
  * Constructs a table row with label and radio input in two columns.
  * @param string $name Option name.
  * @param FormOptions $opts
  * @param string[] $alts List of alternatives.
  * @return string Html.
  */
 protected function eRadio($name, FormOptions $opts, array $alts)
 {
     // Give grep a chance to find the usages:
     // translate-statsf-scale, translate-statsf-count
     $label = 'translate-statsf-' . $name;
     $label = $this->msg($label)->escaped();
     $s = '<tr><td>' . $label . '</td><td>';
     $options = array();
     foreach ($alts as $alt) {
         $id = "{$name}-{$alt}";
         $radio = Xml::radio($name, $alt, $alt === $opts[$name], array('id' => $id)) . ' ';
         $options[] = $radio . ' ' . $this->eLabel($id);
     }
     $s .= implode(' ', $options);
     $s .= '</td></tr>' . "\n";
     return $s;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:24,代码来源:SpecialTranslationStats.php

示例12: generateBillingFields

 protected function generateBillingFields()
 {
     global $wgScriptPath;
     $scriptPath = "{$wgScriptPath}/extensions/DonationInterface/gateway_forms/includes";
     $form = '';
     /*
     $form .= '<tr>';
     $form .= '<td style="text-align:center;" colspan="2"><big><b>' . wfMsg( 'donate_interface-paypal-button' ) . '</b></big><br/><a href="#" onclick="document.payment.PaypalRedirect.value=1;document.payment.submit();"><img src="' . $scriptPath . '/paypal.png"/></a></td>';
     $form .= '</tr>';
     */
     // amount
     $otherChecked = false;
     $amount = -1;
     if ($this->getEscapedValue('amount') != 250 && $this->getEscapedValue('amount') != 150 && $this->getEscapedValue('amount') != 100 && $this->getEscapedValue('amount') != 75 && $this->getEscapedValue('amount') != 50 && $this->getEscapedValue('amount') != 35 && $this->getEscapedValue('amount') != 20 && $this->getEscapedValue('amountOther') > 0) {
         $otherChecked = true;
         $amount = $this->getEscapedValue('amountOther');
     }
     $form .= '<tr>';
     $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['amount'] . '</span></td>';
     $form .= '</tr>';
     $form .= '<tr>';
     $form .= '<td class="label"><div style="padding-top:4px;">' . Xml::label(wfMsg('donate_interface-donor-amount'), 'amount') . '</div></td>';
     $form .= '<td>' . '<table cellspacing="3" cellpadding="0" border="0" style="margin-bottom:0.2em;"><tr>' . '<td>' . Xml::radio('amount', 20, $this->getEscapedValue('amount') == 20, array('onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )')) . '$20 ' . '</td>' . '<td>' . Xml::radio('amount', 35, $this->getEscapedValue('amount') == 35, array('onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )')) . '$35 ' . '</td>' . '<td>' . Xml::radio('amount', 50, $this->getEscapedValue('amount') == 50, array('onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )')) . '$50 ' . '</td>' . '<td>' . Xml::radio('amount', 75, $this->getEscapedValue('amount') == 75, array('onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )')) . '$75 ' . '</td>' . '</tr><tr>' . '<td>' . Xml::radio('amount', 100, $this->getEscapedValue('amount') == 100, array('onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )')) . '$100 ' . '</td>' . '<td>' . Xml::radio('amount', 150, $this->getEscapedValue('amount') == 150, array('onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )')) . '$150 ' . '</td>' . '<td>' . Xml::radio('amount', 250, $this->getEscapedValue('amount') == 250, array('onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )')) . '$250 ' . '</td>' . '<td>' . Xml::radio('amount', $amount, $otherChecked, array('id' => 'otherRadio')) . Xml::input('amountOther', '7', $this->getEscapedValue('amountOther'), array('type' => 'text', 'onfocus' => 'clearField(this, "Other");document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'onblur' => 'document.getElementById("otherRadio").value = this.value;', 'id' => 'amountOther')) . Html::hidden('currency_code', 'USD') . '</td>' . '</tr></table>' . '</td>';
     $form .= '</tr>';
     // Payment type
     $form .= '<tr>';
     $form .= '<td class="label""><div style="padding-top:9px;">' . wfMsg('donate_interface-payment-type') . '</div></td>';
     $form .= '<td>' . '<p style="border: 1px solid rgb(187, 187, 187); float: left; -moz-border-radius: 5px 5px 5px 5px; margin: 0 8px 0 0; padding: 5px 5px 5px 3px; white-space: nowrap;">' . Xml::radio('card_type', 'cc1', $this->getEscapedValue('card_type') == 'cc1', array('id' => 'cc1radio', 'onclick' => 'switchToCreditCard()')) . '<label for="cc1radio">' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-visa.png")) . '</label>' . '&#160;<label for="cc1radio">' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png")) . '</label>' . '&#160;<label for="cc1radio">' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-amex.png")) . '</label>' . '&#160;<label for="cc1radio">' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-discover.png")) . '</label>' . '</p>' . '<p style="border: 1px solid transparent; float: left; -moz-border-radius: 5px 5px 5px 5px; margin: 0; padding: 5px 5px 5px 3px; white-space: nowrap;">' . Xml::radio('card_type', 'pp', $this->getEscapedValue('card_type') == 'pp', array('id' => 'ppradio', 'onclick' => 'switchToPayPal()')) . '<label for="ppradio">' . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-paypal.png")) . '</label>' . '</p>' . '</td>';
     $form .= '</tr>';
     $form .= '</table>';
     if ($this->getEscapedValue('card_type') == 'cc1' || $this->getEscapedValue('card_type') == 'cc2' || $this->getEscapedValue('card_type') == 'cc3' || $this->getEscapedValue('card_type') == 'cc4') {
         $form .= Xml::openElement('table', array('id' => 'payflow-table-cc'));
     } else {
         $form .= Xml::openElement('table', array('id' => 'payflow-table-cc', 'style' => 'display: none;'));
     }
     $form .= '<tr>';
     $form .= '<td colspan="2"><h3 class="cc_header">' . wfMsg('donate_interface-cc-form-header-personal') . Xml::element('img', array('src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-left:8px;')) . '</h3></td>';
     $form .= '</tr>';
     // card number
     $form .= $this->getCardNumberField();
     // expiry
     $form .= '<tr>';
     $form .= '<td class="label">' . Xml::label(wfMsg('donate_interface-donor-expiration'), 'expiration') . '</td>';
     $form .= '<td>' . $this->generateExpiryMonthDropdown() . ' / ' . $this->generateExpiryYearDropdown() . '</td>';
     $form .= '</tr>';
     // cvv
     $form .= $this->getCvvField();
     // name
     $form .= '<tr>';
     $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['fname'] . '</span></td>';
     $form .= '</tr>';
     $form .= '<tr>';
     $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['lname'] . '</span></td>';
     $form .= '</tr>';
     $form .= '<tr>';
     $form .= '<td class="label">' . Xml::label(wfMsg('donate_interface-name-on-card'), 'fname') . '</td>';
     $form .= '<td>' . Xml::input('fname', '30', $this->getEscapedValue('fname'), array('type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg('donate_interface-donor-fname') . '\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname')) . Xml::input('lname', '30', $this->getEscapedValue('lname'), array('type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg('donate_interface-donor-lname') . '\' )', 'maxlength' => '25', 'id' => 'lname')) . '</td>';
     $form .= "</tr>";
     // street
     $form .= '<tr>';
     $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['street'] . '</span></td>';
     $form .= '</tr>';
     $form .= '<tr>';
     $form .= '<td class="label">' . Xml::label(wfMsg('donate_interface-billing-address'), 'street') . '</td>';
     $form .= '<td>' . Xml::input('street', '30', $this->getEscapedValue('street'), array('type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg('donate_interface-donor-street') . '\' )', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth')) . '</td>';
     $form .= '</tr>';
     // city
     $form .= '<tr>';
     $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['city'] . '</span></td>';
     $form .= '</tr>';
     $form .= '<tr>';
     $form .= '<td class="label"> </td>';
     $form .= '<td>' . Xml::input('city', '18', $this->getEscapedValue('city'), array('type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg('donate_interface-donor-city') . '\' )', 'maxlength' => '40', 'id' => 'city')) . ' ' . $this->generateStateDropdown() . ' ' . Xml::input('zip', '5', $this->getEscapedValue('zip'), array('type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg('donate_interface-zip-code') . '\' )', 'maxlength' => '10', 'id' => 'zip')) . Html::hidden('country', 'US') . '</td>';
     $form .= '</tr>';
     // country
     /*
     		$form .= '<tr>';
     		$form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['country'] . '</span></td>';
     		$form .= '</tr>';
     		$form .= '<tr>';
     		$form .= '<td class="label"> </td>';
     		$form .= '<td>' . $this->generateCountryDropdown() . '</td>';
     $form .= '</tr>';
     */
     // email
     $form .= '<tr>';
     $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['emailAdd'] . '</span></td>';
     $form .= '</tr>';
     $form .= '<tr>';
     $form .= '<td class="label">' . Xml::label(wfMsg('donate_interface-email-receipt'), 'emailAdd') . '</td>';
     $form .= '<td>' . Xml::input('emailAdd', '30', $this->getEscapedValue('email'), array('type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg('donate_interface-donor-email') . '\' )', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth')) . Html::hidden('email-opt', 1) . '</td>';
     $form .= '</tr>';
     return $form;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:94,代码来源:TwoColumnLetter7.php

示例13: vote

 public function vote($vid)
 {
     global $wgOut, $wgUser;
     $wgOut->setPagetitle(wfMsg('poll-title-vote'));
     if (!$wgUser->isAllowed('poll-vote')) {
         $wgOut->addWikiMsg('poll-vote-right-error');
         $wgOut->addHtml('<a href="' . $this->getTitle()->getFullURL('action=list') . '">' . wfMsg('poll-back') . '</a>');
     } else {
         $dbr = wfGetDB(DB_SLAVE);
         $query = $dbr->select('poll', 'question, alternative_1, alternative_2, alternative_3, alternative_4, alternative_5, alternative_6, creater, multi', array('id' => $vid));
         while ($row = $dbr->fetchObject($query)) {
             $question = htmlentities($row->question, ENT_QUOTES, 'UTF-8');
             $alternative_1 = htmlentities($row->alternative_1, ENT_QUOTES, 'UTF-8');
             $alternative_2 = htmlentities($row->alternative_2, ENT_QUOTES, 'UTF-8');
             $alternative_3 = htmlentities($row->alternative_3, ENT_QUOTES, 'UTF-8');
             $alternative_4 = htmlentities($row->alternative_4, ENT_QUOTES, 'UTF-8');
             $alternative_5 = htmlentities($row->alternative_5, ENT_QUOTES, 'UTF-8');
             $alternative_6 = htmlentities($row->alternative_6, ENT_QUOTES, 'UTF-8');
             $creater = htmlentities($row->creater, ENT_QUOTES, 'UTF-8');
             $multi = $row->multi;
         }
         if (!isset($question) or $question == "") {
             $wgOut->addWikiMsg('poll-invalid-id');
             $wgOut->addHtml('<a href="' . $this->getTitle()->getFullURL('action=list') . '">' . wfMsg('poll-back') . '</a>');
             return;
         }
         $wgOut->addHtml(Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getFullURL('action=submit&id=' . $vid))));
         $wgOut->addHtml(Xml::openElement('table'));
         $wgOut->addHtml('<tr><th>' . $question . '</th></tr>');
         if ($multi != 1) {
             $wgOut->addHtml('<tr><td>' . Xml::radio('vote', '1') . ' ' . $alternative_1 . '</td></tr>');
             $wgOut->addHtml('<tr><td>' . Xml::radio('vote', '2') . ' ' . $alternative_2 . '</td></tr>');
             if ($alternative_3 != "") {
                 $wgOut->addHtml('<tr><td>' . Xml::radio('vote', '3') . ' ' . $alternative_3 . '</td></tr>');
             }
             if ($alternative_4 != "") {
                 $wgOut->addHtml('<tr><td>' . Xml::radio('vote', '4') . ' ' . $alternative_4 . '</td></tr>');
             }
             if ($alternative_5 != "") {
                 $wgOut->addHtml('<tr><td>' . Xml::radio('vote', '5') . ' ' . $alternative_5 . '</td></tr>');
             }
             if ($alternative_6 != "") {
                 $wgOut->addHtml('<tr><td>' . Xml::radio('vote', '6') . ' ' . $alternative_6 . '</td></tr>');
             }
             $wgOut->addHtml('<tr><td>' . wfMsg('poll-vote-other') . ' ' . Xml::input('vote_other') . '</td></tr>');
         }
         if ($multi == 1) {
             $wgOut->addHtml('<tr><td>' . Xml::check('vote_1') . ' ' . $alternative_1 . '</td></tr>');
             $wgOut->addHtml('<tr><td>' . Xml::check('vote_2') . ' ' . $alternative_2 . '</td></tr>');
             if ($alternative_3 != "") {
                 $wgOut->addHtml('<tr><td>' . Xml::check('vote_3') . ' ' . $alternative_3 . '</td></tr>');
             }
             if ($alternative_4 != "") {
                 $wgOut->addHtml('<tr><td>' . Xml::check('vote_4') . ' ' . $alternative_4 . '</td></tr>');
             }
             if ($alternative_5 != "") {
                 $wgOut->addHtml('<tr><td>' . Xml::check('vote_5') . ' ' . $alternative_5 . '</td></tr>');
             }
             if ($alternative_6 != "") {
                 $wgOut->addHtml('<tr><td>' . Xml::check('vote_6') . ' ' . $alternative_6 . '</td></tr>');
             }
             $wgOut->addHtml('<tr><td>' . wfMsg('poll-vote-other') . ' ' . Xml::input('vote_other') . '</td></tr>');
         }
         $wgOut->addHtml('<tr><td>' . Xml::submitButton(wfMsg('poll-submit')) . '' . Html::Hidden('type', 'vote') . '' . Html::Hidden('multi', $multi) . ' <a href="' . $this->getTitle()->getFullURL('action=score&id=' . $vid) . '">' . wfMsg('poll-title-score') . '</a></td></tr>');
         $wgOut->addHtml('<tr><td>');
         $wgOut->addWikiText('<small>' . wfMsg('poll-score-created', $creater) . '</small>');
         $wgOut->addHtml('</td></tr>');
         $wgOut->addHtml(Xml::closeElement('table'));
         if ($wgUser->isAllowed('poll-admin') || $creater == $wgUser->getName()) {
             $wgOut->addHtml(wfMsg('poll-administration') . ' <a href="' . $this->getTitle()->getFullURL('action=change&id=' . $vid) . '">' . wfMsg('poll-change') . '</a> · <a href="' . $this->getTitle()->getFullURL('action=delete&id=' . $vid) . '">' . wfMsg('poll-delete') . '</a>');
         }
         $wgOut->addHtml(Xml::closeElement('form'));
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:74,代码来源:Poll_body.php

示例14: wfMsgExt

<form method="get" action="<?php 
echo $action;
?>
">
<div style="padding:3px"><?php 
echo wfMsgExt('tagsreportpagesfound', 'parsemag', !is_array($tagList) ? 0 : array_sum($tagList));
?>
</div>
<?php 
if (!empty($tagList)) {
    foreach ($tagList as $tag => $cnt) {
        ?>
<div style="margin:4px 10px">
<label>
	<span style="vertical-align: middle;"><?php 
        echo Xml::radio('target', $tag, $tag == $mTag);
        ?>
</span>
	<span style="vertical-align: middle; font-family: monospace;" class="tagname"><?php 
        echo $tag;
        ?>
</span>
	<span style="vertical-align: middle;" class="tagcount"><?php 
        echo wfMsg('tagsreportpages', $cnt);
        ?>
</span>
</label>
</div>
<?php 
    }
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:main-form.tmpl.php

示例15: doForm

 function doForm($user, $reason, $checktype, $ip, $xff, $name)
 {
     global $wgOut, $wgTitle;
     $action = $wgTitle->escapeLocalUrl();
     # Fill in requested type if it makes sense
     $encipusers = 0;
     $encipedits = 0;
     $encuserips = 0;
     if ($checktype == 'subipusers' && ($ip || $xff)) {
         $encipusers = 1;
     } else {
         if ($checktype == 'subipedits' && ($ip || $xff)) {
             $encipedits = 1;
         } else {
             if ($checktype == 'subuserips' && $name) {
                 $encuserips = 1;
             } else {
                 if ($ip || $xff) {
                     $encipedits = 1;
                 } else {
                     $encuserips = 1;
                 }
             }
         }
     }
     # Compile our nice form
     # User box length should fit things like "2001:0db8:85a3:08d3:1319:8a2e:0370:7344/100/xff"
     $wgOut->addWikiText(wfMsg('checkuser-summary') . "\n\n[[" . $this->getLogSubpageTitle()->getPrefixedText() . '|' . wfMsg('checkuser-showlog') . ']]');
     $form = "<form name='checkuser' action='{$action}' method='post'>";
     $form .= "<fieldset><legend>" . wfMsgHtml("checkuser-query") . "</legend>";
     $form .= "<table border='0' cellpadding='2'><tr>";
     $form .= "<td>" . wfMsgHtml("checkuser-target") . ":</td>";
     $form .= "<td>" . Xml::input('user', 46, $user, array('id' => 'checktarget')) . "</td>";
     $form .= "</tr><tr>";
     $form .= "<td></td><td class='checkuserradios'><table border='0' cellpadding='3'><tr>";
     $form .= "<td>" . Xml::radio('checktype', 'subuserips', $encuserips, array('id' => 'subuserips'));
     $form .= " " . Xml::label(wfMsgHtml("checkuser-ips"), 'subuserips') . "</td>";
     $form .= "<td>" . Xml::radio('checktype', 'subipedits', $encipedits, array('id' => 'subipedits'));
     $form .= " " . Xml::label(wfMsgHtml("checkuser-edits"), 'subipedits') . "</td>";
     $form .= "<td>" . Xml::radio('checktype', 'subipusers', $encipusers, array('id' => 'subipusers'));
     $form .= " " . Xml::label(wfMsgHtml("checkuser-users"), 'subipusers') . "</td>";
     $form .= "</tr></table></td>";
     $form .= "</tr><tr>";
     $form .= "<td>" . wfMsgHtml("checkuser-reason") . ":</td>";
     $form .= "<td>" . Xml::input('reason', 46, $reason, array('maxlength' => '150', 'id' => 'checkreason'));
     $form .= "&nbsp; &nbsp;" . Xml::submitButton(wfMsgHtml('checkuser-check')) . "</td>";
     $form .= "</tr></table></fieldset></form>";
     # Output form
     $wgOut->addHTML($form);
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:50,代码来源:CheckUser_body.php


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