From: Rob Church Date: Mon, 25 Jun 2007 11:09:51 +0000 (+0000) Subject: Clean up the mess that is Xml::monthSelector()... X-Git-Tag: 1.31.0-rc.0~52409 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=510add5a5c48f536f1376e7038c0b18e2fbedd9a;p=lhc%2Fweb%2Fwiklou.git Clean up the mess that is Xml::monthSelector()... * Use accessors instead of direct access to static members * Use existing XML functions to make life easier and guarantee clean XHTML * Drop the useless class (use the ID in CSS) --- diff --git a/includes/Xml.php b/includes/Xml.php index c31a077fba..c5c60cb020 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -131,28 +131,18 @@ class Xml { * @param $allmonths String: value of a special item denoting all month. Null to not include (default) * @return String: Html string containing the month selector */ - public static function monthSelector($selected = '', $allmonths = null) { + public static function monthSelector( $selected = '', $allmonths = null ) { + global $wgLang; + $options = array(); if( is_null( $selected ) ) $selected = ''; - $s = "\n\n"; - return $s; + if( !is_null( $allmonths ) ) + $options[] = self::option( wfMsg( 'monthsall' ), $allmonths, $selected === $allmonths ); + for( $i = 1; $i < 13; $i++ ) + $options[] = self::option( $wgLang->getMonthName( $i ), $i, $selected === $i ); + return self::openElement( 'select', array( 'id' => 'month', 'name' => 'month' ) ) + . implode( "\n", $options ) + . self::closeElement( 'select' ); } /**