Index: trunk/phase3/includes/Xml.php |
— | — | @@ -131,28 +131,18 @@ |
132 | 132 | * @param $allmonths String: value of a special item denoting all month. Null to not include (default) |
133 | 133 | * @return String: Html string containing the month selector |
134 | 134 | */ |
135 | | - public static function monthSelector($selected = '', $allmonths = null) { |
| 135 | + public static function monthSelector( $selected = '', $allmonths = null ) { |
| 136 | + global $wgLang; |
| 137 | + $options = array(); |
136 | 138 | if( is_null( $selected ) ) |
137 | 139 | $selected = ''; |
138 | | - $s = "\n<select id='month' name='month' class='monthselector'>\n"; |
139 | | - $arr = Language::$mMonthMsgs; |
140 | | - |
141 | | - if( !is_null($allmonths) ) { |
142 | | - $arr = array($allmonths => 'monthsall') + $arr; |
143 | | - } |
144 | | - foreach ($arr as $index => $name) { |
145 | | - $message = wfMsgHtml($name); |
146 | | - $index++; // Let January be 1 |
147 | | - |
148 | | - if ($index === $selected) { |
149 | | - $s .= "\t" . self::element("option", |
150 | | - array("value" => $index, "selected" => "selected"), $message) . "\n"; |
151 | | - } else { |
152 | | - $s .= "\t" . self::element("option", array("value" => $index), $message) . "\n"; |
153 | | - } |
154 | | - } |
155 | | - $s .= "</select>\n"; |
156 | | - return $s; |
| 140 | + if( !is_null( $allmonths ) ) |
| 141 | + $options[] = self::option( wfMsg( 'monthsall' ), $allmonths, $selected === $allmonths ); |
| 142 | + for( $i = 1; $i < 13; $i++ ) |
| 143 | + $options[] = self::option( $wgLang->getMonthName( $i ), $i, $selected === $i ); |
| 144 | + return self::openElement( 'select', array( 'id' => 'month', 'name' => 'month' ) ) |
| 145 | + . implode( "\n", $options ) |
| 146 | + . self::closeElement( 'select' ); |
157 | 147 | } |
158 | 148 | |
159 | 149 | /** |