Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php |
— | — | @@ -296,7 +296,7 @@ |
297 | 297 | * Render a set of records returned by getRecords() as an HTML table |
298 | 298 | */ |
299 | 299 | function renderRecords( $records, $cols = false, $sortable = true ) { |
300 | | - global $wgUser, $wgLang; |
| 300 | + global $wgUser; |
301 | 301 | if ( count( $records ) < 1 ) return wfMsg( 'recordadmin-nomatch' ); |
302 | 302 | |
303 | 303 | $special = Title::makeTitle( NS_SPECIAL, 'RecordAdmin' ); |
— | — | @@ -323,8 +323,8 @@ |
324 | 324 | |
325 | 325 | $stripe = ''; |
326 | 326 | foreach ( $records as $r ) { |
327 | | - $tsc = $wgLang->date( $r['created'], true, true ) . ', ' . $wgLang->time( $r['created'], true, true ); |
328 | | - $tsm = $wgLang->date( $r['modified'], true, true ) . ', ' . $wgLang->time( $r['modified'], true, true ); |
| 327 | + $tsc = $this->formatDate( $r['created'] ); |
| 328 | + $tsm = $this->formatDate( $r['modified'] ); |
329 | 329 | $t = $r[0]; |
330 | 330 | $u = $t->getLocalURL(); |
331 | 331 | $col = $r['title']; |
— | — | @@ -352,6 +352,15 @@ |
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
| 356 | + * Take a MediaWiki timestamp and return a formatted date appropriate for sortable table |
| 357 | + */ |
| 358 | + function formatDate( $ts ) { |
| 359 | + global $wgLang; |
| 360 | + $ts = preg_replace( "|^(....)(..)(..)(..)(..)(..)|", "$1-$2-$3 $4:$5:$6", $wgLang->userAdjust( $ts ) ); |
| 361 | + return date( 'd M Y, H:i', strtotime( $ts ) ); |
| 362 | + } |
| 363 | + |
| 364 | + /** |
356 | 365 | * Read in and prepare the form (for use as a search filter) for passed record type |
357 | 366 | * - we're using the record's own form as a filter for searching for records |
358 | 367 | * - extract only the content from between the form tags and remove any submit inputs |