Index: trunk/extensions/EducationProgram/EducationProgram.i18n.alias.php |
— | — | @@ -31,4 +31,5 @@ |
32 | 32 | 'EditTerm' => array( 'EditTerm' ), |
33 | 33 | 'Enroll' => array( 'Enroll' ), |
34 | 34 | 'Ambassadors' => array( 'Ambassadors' ), |
| 35 | + 'Ambassador' => array( 'Ambassador' ), |
35 | 36 | ); |
Index: trunk/extensions/EducationProgram/specials/SpecialInstitution.php |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | $stats['name'] = $org->getField( 'name' ); |
89 | 89 | $stats['city'] = $org->getField( 'city' ); |
90 | 90 | |
91 | | - $countries = CountryNames::getNames( $this->getLang()->getCode() ); |
| 91 | + $countries = CountryNames::getNames( $this->getLanguage()->getCode() ); |
92 | 92 | $stats['country'] = $countries[$org->getField( 'country' )]; |
93 | 93 | |
94 | 94 | foreach ( $stats as &$stat ) { |
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php |
— | — | @@ -183,7 +183,7 @@ |
184 | 184 | * @param boolean $collapsed |
185 | 185 | * @param array $summaryData |
186 | 186 | */ |
187 | | - protected function displaySummary( EPDBObject $item, $collapsed = true, array $summaryData = null ) { |
| 187 | + protected function displaySummary( EPDBObject $item, $collapsed = false, array $summaryData = null ) { |
188 | 188 | $out = $this->getOutput(); |
189 | 189 | |
190 | 190 | $class = 'wikitable ep-summary mw-collapsible'; |
Index: trunk/extensions/EducationProgram/specials/SpecialAmbassador.php |
— | — | @@ -0,0 +1,82 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Shows the info for a single ambassador. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file SpecialAmbassador.php |
| 10 | + * @ingroup EducationProgram |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class SpecialAmbassador extends SpecialEPPage { |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructor. |
| 19 | + * |
| 20 | + * @since 0.1 |
| 21 | + */ |
| 22 | + public function __construct() { |
| 23 | + parent::__construct( 'Ambassador' ); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * Main method. |
| 28 | + * |
| 29 | + * @since 0.1 |
| 30 | + * |
| 31 | + * @param string $subPage |
| 32 | + */ |
| 33 | + public function execute( $subPage ) { |
| 34 | + parent::execute( $subPage ); |
| 35 | + |
| 36 | + $out = $this->getOutput(); |
| 37 | + |
| 38 | + if ( trim( $subPage ) === '' ) { |
| 39 | + $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Ambassadors' )->getLocalURL() ); |
| 40 | + } |
| 41 | + else { |
| 42 | + $out->setPageTitle( wfMsgExt( 'ep-ambassador-title', 'parsemag', $this->subPage ) ); |
| 43 | + |
| 44 | + $this->displayNavigation(); |
| 45 | + |
| 46 | + $mentor = false; //EPMentor::selectRow( null, array( 'id' => $this->subPage ) ); |
| 47 | + |
| 48 | + if ( $mentor === false ) { |
| 49 | + $this->showWarning( wfMessage( 'ep-ambassador-does-not-exist', $this->subPage ) ); |
| 50 | + } |
| 51 | + else { |
| 52 | + $this->displaySummary( $mentor ); |
| 53 | + } |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Gets the summary data. |
| 59 | + * |
| 60 | + * @since 0.1 |
| 61 | + * |
| 62 | + * @param EPMentor $mentor |
| 63 | + * |
| 64 | + * @return array |
| 65 | + */ |
| 66 | + protected function getSummaryData( EPDBObject $mentor ) { |
| 67 | + $stats = array(); |
| 68 | + |
| 69 | + $orgs = array(); |
| 70 | + |
| 71 | + foreach ( $mentor->getOrgs( 'name' ) as /* EPOrg */ $org ) { |
| 72 | + $orgs[] = Linker::linkKnown( |
| 73 | + SpecialPage::getTitleFor( 'Institution', $org->getField( 'name' ) ), |
| 74 | + htmlspecialchars( $org->getField( 'name' ) ) |
| 75 | + ); |
| 76 | + } |
| 77 | + |
| 78 | + $stats['orgs'] = $this->getLanguage()->pipeList( $orgs ); |
| 79 | + |
| 80 | + return $stats; |
| 81 | + } |
| 82 | + |
| 83 | +} |
Property changes on: trunk/extensions/EducationProgram/specials/SpecialAmbassador.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 84 | + native |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -79,6 +79,7 @@ |
80 | 80 | 'special-editcourse-edit' => 'Edit course', |
81 | 81 | 'special-enroll' => 'Enroll', |
82 | 82 | 'special-ambassadors' => 'Ambassadors', |
| 83 | + 'special-ambassador' => 'Ambassador', |
83 | 84 | |
84 | 85 | // Special:Institutions |
85 | 86 | 'ep-institutions-nosuchinstitution' => 'There is no institution with name "$1". Existing institutions are listed below.', |
— | — | @@ -227,6 +228,10 @@ |
228 | 229 | 'specialterm-summary-token' => 'Enrollment token', |
229 | 230 | 'ep-term-nav-edit' => 'Edit this term', |
230 | 231 | |
| 232 | + // Special:Ambassador |
| 233 | + 'ep-ambassador-does-not-exist' => 'There is no ambassador with name "$1". See [[Special:Ambassadors|here]] for a list of ambassadors.', |
| 234 | + 'ep-ambassador-title' => 'Ambassador: $1', |
| 235 | + |
231 | 236 | // Special:Enroll |
232 | 237 | 'ep-enroll-title' => 'Enroll for $1 at $2', |
233 | 238 | 'ep-enroll-login-first' => 'Before you can enroll in this course, you need to login.', |
Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -89,6 +89,7 @@ |
90 | 90 | $wgAutoloadClasses['SpecialTerms'] = dirname( __FILE__ ) . '/specials/SpecialTerms.php'; |
91 | 91 | $wgAutoloadClasses['SpecialEnroll'] = dirname( __FILE__ ) . '/specials/SpecialEnroll.php'; |
92 | 92 | $wgAutoloadClasses['SpecialAmbassadors'] = dirname( __FILE__ ) . '/specials/SpecialAmbassadors.php'; |
| 93 | +$wgAutoloadClasses['SpecialAmbassador'] = dirname( __FILE__ ) . '/specials/SpecialAmbassador.php'; |
93 | 94 | |
94 | 95 | // Special pages |
95 | 96 | $wgSpecialPages['MyCourses'] = 'SpecialMyCourses'; |
— | — | @@ -106,6 +107,7 @@ |
107 | 108 | $wgSpecialPages['EditTerm'] = 'SpecialEditTerm'; |
108 | 109 | $wgSpecialPages['Enroll'] = 'SpecialEnroll'; |
109 | 110 | $wgSpecialPages['Ambassadors'] = 'SpecialAmbassadors'; |
| 111 | +$wgSpecialPages['Ambassador'] = 'SpecialAmbassador'; |
110 | 112 | |
111 | 113 | $wgSpecialPageGroups['MyCourses'] = 'education'; |
112 | 114 | $wgSpecialPageGroups['Institution'] = 'education'; |
— | — | @@ -121,6 +123,7 @@ |
122 | 124 | $wgSpecialPageGroups['EditInstitution'] = 'education'; |
123 | 125 | $wgSpecialPageGroups['EditTerm'] = 'education'; |
124 | 126 | $wgSpecialPageGroups['Ambassadors'] = 'education'; |
| 127 | +$wgSpecialPageGroups['Ambassador'] = 'education'; |
125 | 128 | |
126 | 129 | // DB object classes |
127 | 130 | $egEPDBObjects = array(); |