public static function monthSelector( $selected = '', $allmonths = null, $id = 'month' ) {
global $wgLang;
$options = array();
+ $data = new XmlSelect( 'month', $id, $selected );
if ( is_null( $selected ) ) {
$selected = '';
}
if ( !is_null( $allmonths ) ) {
- $options[] = self::option(
- wfMessage( 'monthsall' )->text(),
- $allmonths,
- $selected === $allmonths
- );
+ $options[wfMessage( 'monthsall' )->text()] = $allmonths;
}
for ( $i = 1; $i < 13; $i++ ) {
- $options[] = self::option( $wgLang->getMonthName( $i ), $i, $selected === $i );
- }
- return self::openElement( 'select', array(
- 'id' => $id,
- 'name' => 'month',
- 'class' => 'mw-month-selector'
- ) )
- . implode( "\n", $options )
- . self::closeElement( 'select' );
+ $options[$wgLang->getMonthName( $i )] = $i;
+ }
+ $data->addOptions( $options );
+ $data->setAttribute( 'class', 'mw-month-selector' );
+ return $data->getHTML();
}
/**
'<label for="year">From year (and earlier):</label> ' .
'<input id="year" maxlength="4" size="7" type="number" value="2011" name="year" /> ' .
'<label for="month">From month (and earlier):</label> ' .
- '<select id="month" name="month" class="mw-month-selector">' .
+ '<select name="month" id="month" class="mw-month-selector">' .
'<option value="-1">all</option>' . "\n" .
'<option value="1">January</option>' . "\n" .
'<option value="2" selected="">February</option>' . "\n" .
'<label for="year">From year (and earlier):</label> ' .
'<input id="year" maxlength="4" size="7" type="number" value="2011" name="year" /> ' .
'<label for="month">From month (and earlier):</label> ' .
- '<select id="month" name="month" class="mw-month-selector">' .
+ '<select name="month" id="month" class="mw-month-selector">' .
'<option value="-1">all</option>' . "\n" .
'<option value="1">January</option>' . "\n" .
'<option value="2">February</option>' . "\n" .
'<label for="year">From year (and earlier):</label> ' .
'<input id="year" maxlength="4" size="7" type="number" name="year" /> ' .
'<label for="month">From month (and earlier):</label> ' .
- '<select id="month" name="month" class="mw-month-selector">' .
+ '<select name="month" id="month" class="mw-month-selector">' .
'<option value="-1">all</option>' . "\n" .
'<option value="1">January</option>' . "\n" .
'<option value="2">February</option>' . "\n" .