Index: trunk/extensions/CommunityApplications/CommunityApplications.i18n.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$messages = array(); |
| 5 | + |
| 6 | +$messages['en'] = array( |
| 7 | + 'community-applications-title' => 'Community Applications', |
| 8 | + 'community-applications-application-title' => 'Application $1: $2, $3', |
| 9 | +); |
Index: trunk/extensions/CommunityApplications/CommunityApplications.php |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +if ( ! defined( 'MEDIAWIKI' ) ) { |
| 5 | + die; |
| 6 | +} |
| 7 | + |
| 8 | +// Reader for CommunityHiring data |
| 9 | +$wgSpecialPages['CommunityApplications'] = 'SpecialCommunityApplications'; |
| 10 | +$wgAutoloadClasses['SpecialCommunityApplications'] = dirname(__FILE__) . "/SpecialCommunityApplications.php"; |
| 11 | + |
| 12 | +$wgExtensionMessagesFiles['CommunityApplications'] = dirname( __FILE__ ) . "/CommunityApplications.i18n.php"; |
| 13 | + |
| 14 | +$wgCommunityHiringDatabase = false; |
Index: trunk/extensions/CommunityApplications/SpecialCommunityApplications.php |
— | — | @@ -0,0 +1,47 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class SpecialCommunityApplications extends SpecialPage { |
| 5 | + function __construct() { |
| 6 | + parent::__construct( 'CommunityApplications', 'view-community-applications' ); |
| 7 | + wfLoadExtensionMessages( 'CommunityApplications' ); |
| 8 | + } |
| 9 | + |
| 10 | + function execute($par) { |
| 11 | + global $wgUser, $wgOut; |
| 12 | + |
| 13 | + if ( !$this->userCanExecute( $wgUser ) ) { |
| 14 | + $this->displayRestrictionError(); |
| 15 | + return; |
| 16 | + } |
| 17 | + |
| 18 | + $wgOut->setPageTitle( wfMsg( 'community-applications-title' ) ); |
| 19 | + |
| 20 | + $dbr = wfGetDB( DB_SLAVE ); |
| 21 | + |
| 22 | + $res = $dbr->select( 'community_hiring_application', '*', 1, __METHOD__ ); |
| 23 | + |
| 24 | + foreach( $res as $row ) { |
| 25 | + $this->showEntry( $row ); |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + function showEntry( $row ) { |
| 30 | + global $wgOut; |
| 31 | + $wgOut->addHTML( "<hr/>" ); |
| 32 | + $wgOut->addHTML( "<table><tbody>" ); |
| 33 | + |
| 34 | + $data = get_object_vars(json_decode( $row->ch_data )); |
| 35 | + |
| 36 | + $header = wfMsg( 'community-applications-application-title', $row->ch_id, |
| 37 | + $data['family-name'], $data['given-name'] ); |
| 38 | + $wgOut->addHTML( Xml::element( 'h2', null, $header ) ); |
| 39 | + foreach( $data as $key => $value ) { |
| 40 | + $html = Xml::element( 'td', null, $key ); |
| 41 | + $html .= Xml::element( 'td', null, $value ); |
| 42 | + $html = Xml::tags( 'tr', null, $html ) . "\n"; |
| 43 | + $wgOut->addHTML( $html ); |
| 44 | + } |
| 45 | + |
| 46 | + $wgOut->addHTML( "</tbody></table>" ); |
| 47 | + } |
| 48 | +} |