本文整理汇总了PHP中XmlSelect::getHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlSelect::getHtml方法的具体用法?PHP XmlSelect::getHtml怎么用?PHP XmlSelect::getHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlSelect
的用法示例。
在下文中一共展示了XmlSelect::getHtml方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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' );
}
示例2: getHtmlAndPrepareJS
/**
* Returns the whole input element and injects needed JavaScript
* @throws MWException
* @return string Html code.
*/
public function getHtmlAndPrepareJS()
{
if ($this->sourceId === false) {
if (is_callable(array($this->select, 'getAttribute'))) {
$this->sourceId = $this->select->getAttribute['id'];
}
if (!$this->sourceId) {
throw new MWException("ID needs to be specified for the selector");
}
}
self::injectJs();
$html = $this->select->getHtml();
$html .= $this->getButton($this->msg, $this->sourceId, $this->targetId);
return $html;
}
示例3: execute
public function execute($par)
{
global $wgRequest, $wgScript;
$this->setHeaders();
$output = $this->getOutput();
if ($par != '') {
$parts = explode('/', urldecode($par));
} else {
$parts = array();
}
$type = isset($parts[0]) ? $parts[0] : $wgRequest->getText('type');
if ($type == '') {
$type = 'ancestors';
}
$pageName = isset($parts[1]) ? $parts[1] : $wgRequest->getText('page');
if ($type == 'link') {
$pageName2 = isset($parts[2]) ? $parts[2] : $wgRequest->getText('page2');
$numOfGenerations = 0;
} else {
$numOfGenerations = isset($parts[2]) ? intval($parts[2]) : $wgRequest->getInt('gen');
if ($numOfGenerations <= 0) {
$numOfGenerations = 5;
}
$pageName2 = '';
}
if (!$this->mIncluding) {
$output->addModules('ext.smg.specialfamilytree');
$typeSelect = new XmlSelect('type', 'type', $type);
$typeSelect->addOption(wfMsg('semanticgenealogy-specialfamilytree-type-ancestors'), 'ancestors');
$typeSelect->addOption(wfMsg('semanticgenealogy-specialfamilytree-type-descendant'), 'descendant');
$typeSelect->addOption(wfMsg('semanticgenealogy-specialfamilytree-type-link'), 'link');
$output->addHTML(Xml::openElement('form', array('action' => $wgScript)) . Html::hidden('title', $this->getPageTitle()->getPrefixedText()) . Xml::openElement('fieldset') . Xml::openElement('table', array('id' => 'smg-familyTree-form')) . Xml::openElement('tr', array('id' => 'smg-form-entry-page')) . Xml::openElement('th', array('class' => 'mw-label')) . Xml::label(wfMsg('semanticgenealogy-specialfamilytree-label-page'), 'page') . Xml::closeElement('th') . Xml::openElement('td', array('class' => 'mw-input')) . Xml::input('page', 30, $pageName, array('class' => 'smg-input-page')) . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::openElement('tr', array('id' => 'smg-form-entry-type')) . Xml::openElement('th', array('class' => 'mw-label')) . Xml::label(wfMsg('semanticgenealogy-specialfamilytree-label-type'), 'type') . Xml::closeElement('th') . Xml::openElement('td', array('class' => 'mw-input')) . $typeSelect->getHtml() . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::openElement('tr', array('id' => 'smg-form-entry-gen')) . Xml::openElement('th', array('class' => 'mw-label')) . Xml::label(wfMsg('semanticgenealogy-specialfamilytree-label-gen'), 'gen') . Xml::closeElement('th') . Xml::openElement('td', array('class' => 'mw-input')) . Xml::input('gen', 2, $numOfGenerations) . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::openElement('tr', array('id' => 'smg-form-entry-page2')) . Xml::openElement('th', array('class' => 'mw-label')) . Xml::label(wfMsg('semanticgenealogy-specialfamilytree-label-page2'), 'page2') . Xml::closeElement('th') . Xml::openElement('td', array('class' => 'mw-input')) . Xml::input('page2', 30, $pageName2, array('class' => 'smg-input-page')) . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::closeElement('table') . Xml::submitButton(wfMsg('semanticgenealogy-specialfamilytree-button-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
}
if ($pageName == '') {
return;
}
$pageTitle = Title::newFromText($pageName);
$page = SMWDIWikiPage::newFromTitle($pageTitle);
if ($type == '') {
$type = 'ancestors';
}
switch ($type) {
case 'ancestors':
$tree = $this->getAncestors($page, $numOfGenerations);
$this->outputAncestorsTree($tree, $numOfGenerations);
break;
case 'descendant':
$this->outputDescendantList($page, $numOfGenerations);
break;
case 'link':
if ($pageName2 == '') {
$output->addWikiText('<span class="error">' . wfMsg('semanticgenealogy-specialfamilytree-error-nosecondpagename') . '</span>');
return;
}
$pageTitle2 = Title::newFromText($pageName2);
$page2 = SMWDIWikiPage::newFromTitle($pageTitle2);
$tree = $this->getRelation($page, $page2);
if ($tree !== null) {
$this->outputRelationTree($tree);
} else {
$output->addWikiText('<span class="error">' . wfMsg('semanticgenealogy-specialfamilytree-error-nolinkfound', $pageName, $pageName2) . '</span>');
}
break;
default:
$output->addWikiText('<span class="error">' . wfMsg('semanticgenealogy-specialfamilytree-error-unknowntype', $type) . '</span>');
}
return Status::newGood();
}
示例4: getActionSelector
/**
* Drop down menu for selection of actions that can be used to filter the log
* @param array $types
* @param string $action
* @return string
* @since 1.27
*/
private function getActionSelector($types, $action)
{
if ($this->allowedActions === null || !count($this->allowedActions)) {
return '';
}
$html = '';
$html .= xml::label(wfMessage('log-action-filter-' . $types[0])->text(), 'action-filter-' . $types[0]) . "\n";
$select = new XmlSelect('subtype');
$select->addOption(wfMessage('log-action-filter-all')->text(), '');
foreach ($this->allowedActions as $value) {
$msgKey = 'log-action-filter-' . $types[0] . '-' . $value;
$select->addOption(wfMessage($msgKey)->text(), $value);
}
$select->setDefault($action);
$html .= $select->getHtml();
return $html;
}
示例5: showPermissions
protected function showPermissions( $step ) {
global $wgLang, $wgRequest;
$header = new HtmlTag( 'h2' );
$step_message = 'translate-fs-permissions-title';
$header->content( wfMsg( $step_message ) )->style( 'opacity', 0.4 );
if ( $step ) {
$this->out->addHtml( $header );
return $step;
}
if ( $wgRequest->wasPosted() &&
$this->user->matchEditToken( $wgRequest->getVal( 'token' ) ) &&
$wgRequest->getText( 'step' ) === 'permissions' )
{
// This is ridiculous
global $wgCaptchaTriggers;
$captcha = $wgCaptchaTriggers;
$wgCaptchaTriggers = null;
$language = $wgRequest->getVal( 'primary-language' );
$message = $wgRequest->getText( 'message', '...' );
$params = array(
'action' => 'threadaction',
'threadaction' => 'newthread',
'token' => $this->user->editToken(),
'talkpage' => 'Project:Translator',
'subject' => "{{LanguageHeader|$language}}",
'reason' => 'Using Special:FirstSteps',
'text' => $message,
);
$request = new FauxRequest( $params, true, $_SESSION );
$api = new ApiMain( $request, true );
$api->execute();
$result = $api->getResultData();
$wgCaptchaTriggers = $captcha;
$page = $result['threadaction']['thread']['thread-title'];
$this->user->setOption( 'translate-firststeps-request', $page );
$this->user->saveSettings();
}
$page = $this->user->getOption( 'translate-firststeps-request' );
if ( $this->user->isAllowed( 'translate' ) ) {
$header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) );
$this->out->addHtml( $header );
return $step;
} elseif ( $page ) {
$header->content( $header->content . wfMsg( 'translate-fs-pagetitle-pending' ) );
$this->out->addHtml( $header->style( 'opacity', false ) );
$this->out->addWikiMsg( 'translate-fs-permissions-pending', $page );
return $step_message;
}
$this->out->addHtml( $header->style( 'opacity', false ) );
$this->out->addWikiMsg( 'translate-fs-permissions-help' );
$output = Html::openElement( 'form', array( 'method' => 'post' ) );
$output .= Html::hidden( 'step', 'permissions' );
$output .= Html::hidden( 'token', $this->user->editToken() );
$output .= Html::hidden( 'title', $this->getTitle() );
$name = $id = 'primary-language';
$selector = new XmlSelect();
$selector->addOptions( $this->languages( $wgLang->getCode() ) );
$selector->setAttribute( 'id', $id );
$selector->setAttribute( 'name', $name );
$selector->setDefault( $wgLang->getCode() );
$text = wfMessage( 'translate-fs-permissions-planguage' )->text();
$output .= Xml::label( $text, $id ) . " " . $selector->getHtml() . '<br />';
$output .= Html::element( 'textarea', array( 'rows' => 5, 'name' => 'message' ), '' );
$output .= Xml::submitButton( wfMsg( 'translate-fs-permissions-submit' ) );
$output .= Html::closeElement( 'form' );
$this->out->addHtml( $output );
return $step_message;
}