本文整理汇总了PHP中Xml::monthSelector方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::monthSelector方法的具体用法?PHP Xml::monthSelector怎么用?PHP Xml::monthSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::monthSelector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dateMenu
/**
* @param $year Integer
* @param $month Integer
* @return string Formatted HTML
*/
public static function dateMenu($year, $month)
{
# Offset overrides year/month selection
if ($month && $month !== -1) {
$encMonth = intval($month);
} else {
$encMonth = '';
}
if ($year) {
$encYear = intval($year);
} else {
if ($encMonth) {
$thisMonth = intval(gmdate('n'));
$thisYear = intval(gmdate('Y'));
if (intval($encMonth) > $thisMonth) {
$thisYear--;
}
$encYear = $thisYear;
} else {
$encYear = '';
}
}
return Xml::label(wfMsg('year'), 'year') . ' ' . Xml::input('year', 4, $encYear, array('id' => 'year', 'maxlength' => 4)) . ' ' . Xml::label(wfMsg('month'), 'month') . ' ' . Xml::monthSelector($encMonth, -1);
}
示例2: getQueryFormFields
/**
* Returns query form fields.
* @param $opts Form options.
* @return Array of form fields.
*/
protected static function getQueryFormFields( FormOptions $opts ) {
global $wgWikilogEnableTags;
$fields = array();
$fields['wikilog'] = Xml::inputLabelSep(
wfMsg( 'wikilog-form-wikilog' ), 'wikilog', 'wl-wikilog', 40,
str_replace( '_', ' ', $opts->consumeValue( 'wikilog' ) )
);
$fields['category'] = Xml::inputLabelSep(
wfMsg( 'wikilog-form-category' ), 'category', 'wl-category', 40,
str_replace( '_', ' ', $opts->consumeValue( 'category' ) )
);
$fields['author'] = Xml::inputLabelSep(
wfMsg( 'wikilog-form-author' ), 'author', 'wl-author', 40,
str_replace( '_', ' ', $opts->consumeValue( 'author' ) )
);
if ( $wgWikilogEnableTags ) {
$fields['tag'] = Xml::inputLabelSep(
wfMsg( 'wikilog-form-tag' ), 'tag', 'wl-tag', 40,
str_replace( '_', ' ', $opts->consumeValue( 'tag' ) )
);
}
$fields['date'] = array(
Xml::label( wfMsg( 'wikilog-form-date' ), 'wl-month' ),
Xml::monthSelector( $opts->consumeValue( 'month' ), '', 'wl-month' ) .
" " . Xml::input( 'year', 4, $opts->consumeValue( 'year' ), array( 'maxlength' => 4 ) )
);
$opts->consumeValue( 'day' ); // ignore day, not really useful
$statusSelect = new XmlSelect( 'show', 'wl-status', $opts->consumeValue( 'show' ) );
$statusSelect->addOption( wfMsg( 'wikilog-show-all' ), 'all' );
$statusSelect->addOption( wfMsg( 'wikilog-show-published' ), 'published' );
$statusSelect->addOption( wfMsg( 'wikilog-show-drafts' ), 'drafts' );
$fields['status'] = array(
Xml::label( wfMsg( 'wikilog-form-status' ), 'wl-status' ),
$statusSelect->getHTML()
);
$fields['submit'] = Xml::submitbutton( wfMsg( 'allpagessubmit' ) );
return $fields;
}
示例3: contributionsForm
/**
* Generates the namespace selector form with hidden attributes.
* @param $options Array: the options to be included.
*/
function contributionsForm($options)
{
global $wgScript, $wgTitle, $wgRequest;
$options['title'] = $wgTitle->getPrefixedText();
if (!isset($options['target'])) {
$options['target'] = '';
} else {
//XXCHANGED
$options['target'] = str_replace('-', ' ', $options['target']);
}
if (!isset($options['namespace'])) {
$options['namespace'] = '';
}
if (!isset($options['contribs'])) {
$options['contribs'] = 'user';
}
if (!isset($options['year'])) {
$options['year'] = '';
}
if (!isset($options['month'])) {
$options['month'] = '';
}
if ($options['contribs'] == 'newbie') {
$options['target'] = '';
}
$f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
foreach ($options as $name => $value) {
if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) {
continue;
}
$f .= "\t" . Xml::hidden($name, $value) . "\n";
}
$f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parseinline')), 'contribs', 'newbie', 'newbie', $options['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parseinline')), 'contribs', 'user', 'user', $options['contribs'] == 'user' ? true : false) . ' ' . Xml::input('target', 20, $options['target']) . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($options['namespace'], '') . '</span>' . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::label(wfMsg('year'), 'year') . ' ' . Xml::input('year', 4, $options['year'], array('id' => 'year', 'maxlength' => 4)) . ' </span>' . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('month'), 'month') . ' ' . Xml::monthSelector($options['month'], -1) . ' ' . ' </span><br />' . Xml::submitButton(wfMsg('sp-contributions-submit'), array("class" => "button primary", "style" => "float:right; margin-top:5px; margin-right:0;")) . Xml::closeElement('p');
$explain = wfMsgExt('sp-contributions-explain', 'parseinline');
if (!wfEmptyMsg('sp-contributions-explain', $explain)) {
$f .= "<p>{$explain}</p>";
}
$f .= '</fieldset>' . Xml::closeElement('form');
return $f;
}
示例4: getForm
/**
* Generates the namespace selector form with hidden attributes.
* @param $this->opts Array: the options to be included.
*/
protected function getForm()
{
global $wgScript, $wgTitle;
$this->opts['title'] = $wgTitle->getPrefixedText();
if (!isset($this->opts['target'])) {
$this->opts['target'] = '';
} else {
$this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
}
if (!isset($this->opts['namespace'])) {
$this->opts['namespace'] = '';
}
if (!isset($this->opts['contribs'])) {
$this->opts['contribs'] = 'user';
}
if (!isset($this->opts['year'])) {
$this->opts['year'] = '';
}
if (!isset($this->opts['month'])) {
$this->opts['month'] = '';
}
if ($this->opts['contribs'] == 'newbie') {
$this->opts['target'] = '';
}
$f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
foreach ($this->opts as $name => $value) {
if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) {
continue;
}
$f .= "\t" . Xml::hidden($name, $value) . "\n";
}
$f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parseinline')), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parseinline')), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user' ? true : false) . ' ' . Xml::input('target', 20, $this->opts['target']) . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($this->opts['namespace'], '') . '</span>' . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::label(wfMsg('year'), 'year') . ' ' . Xml::input('year', 4, $this->opts['year'], array('id' => 'year', 'maxlength' => 4)) . '</span>' . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('month'), 'month') . ' ' . Xml::monthSelector($this->opts['month'], -1) . ' ' . '</span>' . Xml::submitButton(wfMsg('sp-contributions-submit')) . Xml::closeElement('p');
$explain = wfMsgExt('sp-contributions-explain', 'parseinline');
if (!wfEmptyMsg('sp-contributions-explain', $explain)) {
$f .= "<p>{$explain}</p>";
}
$f .= '</fieldset>' . Xml::closeElement('form');
return $f;
}