Index: trunk/extensions/EducationProgram/specials/SpecialAmbassadors.php |
— | — | @@ -34,7 +34,6 @@ |
35 | 35 | |
36 | 36 | if ( $this->subPage === '' ) { |
37 | 37 | $this->displayNavigation(); |
38 | | - EPMentor::displayAddNewControl( $this->getContext() ); |
39 | 38 | EPMentor::displayPager( $this->getContext() ); |
40 | 39 | } |
41 | 40 | else { |
Index: trunk/extensions/EducationProgram/includes/EPMentor.php |
— | — | @@ -158,4 +158,30 @@ |
159 | 159 | return count( $this->getTerms( 'id', $conditions ) ) > 0; |
160 | 160 | } |
161 | 161 | |
| 162 | + /** |
| 163 | + * Display a pager with mentors. |
| 164 | + * |
| 165 | + * @since 0.1 |
| 166 | + * |
| 167 | + * @param IContextSource $context |
| 168 | + * @param array $conditions |
| 169 | + */ |
| 170 | + public static function displayPager( IContextSource $context, array $conditions = array() ) { |
| 171 | + $pager = new EPMentorPager( $context, $conditions ); |
| 172 | + |
| 173 | + if ( $pager->getNumRows() ) { |
| 174 | + $context->getOutput()->addHTML( |
| 175 | + $pager->getFilterControl() . |
| 176 | + $pager->getNavigationBar() . |
| 177 | + $pager->getBody() . |
| 178 | + $pager->getNavigationBar() . |
| 179 | + $pager->getMultipleItemControl() |
| 180 | + ); |
| 181 | + } |
| 182 | + else { |
| 183 | + $context->getOutput()->addHTML( $pager->getFilterControl( true ) ); |
| 184 | + $context->getOutput()->addWikiMsg( 'ep-mentors-noresults' ); |
| 185 | + } |
| 186 | + } |
| 187 | + |
162 | 188 | } |
Index: trunk/extensions/EducationProgram/includes/EPMentorPager.php |
— | — | @@ -0,0 +1,112 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Mentor pager, primarily for Special:Mentors. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file EPMentorPager.php |
| 10 | + * @ingroup EductaionProgram |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class EPMentorPager extends EPPager { |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructor. |
| 19 | + * |
| 20 | + * @param IContextSource $context |
| 21 | + * @param array $conds |
| 22 | + */ |
| 23 | + public function __construct( IContextSource $context, array $conds = array() ) { |
| 24 | + $this->mDefaultDirection = true; |
| 25 | + |
| 26 | + // when MW 1.19 becomes min, we want to pass an IContextSource $context here. |
| 27 | + parent::__construct( $context, $conds, 'EPMentor' ); |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * (non-PHPdoc) |
| 32 | + * @see EPPager::getFields() |
| 33 | + */ |
| 34 | + public function getFields() { |
| 35 | + return array( |
| 36 | + 'id', |
| 37 | + 'user_id', |
| 38 | + ); |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * (non-PHPdoc) |
| 43 | + * @see TablePager::getRowClass() |
| 44 | + */ |
| 45 | + function getRowClass( $row ) { |
| 46 | + return 'ep-mentor-row'; |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * (non-PHPdoc) |
| 51 | + * @see TablePager::getTableClass() |
| 52 | + */ |
| 53 | + public function getTableClass(){ |
| 54 | + return 'TablePager ep-mentors'; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * (non-PHPdoc) |
| 59 | + * @see EPPager::getFormattedValue() |
| 60 | + */ |
| 61 | + protected function getFormattedValue( $name, $value ) { |
| 62 | + switch ( $name ) { |
| 63 | + case 'id': |
| 64 | + $value = $value; |
| 65 | + break; |
| 66 | + case 'user_id': |
| 67 | + $user = User::newFromId( $value ); |
| 68 | + $name = $user->getRealName() === '' ? $user->getName() : $user->getRealName(); |
| 69 | + |
| 70 | + $value = Linker::userLink( $value, $name ) . Linker::userToolLinks( $value, $name ); |
| 71 | + break; |
| 72 | + } |
| 73 | + |
| 74 | + return $value; |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * (non-PHPdoc) |
| 79 | + * @see EPPager::getSortableFields() |
| 80 | + */ |
| 81 | + protected function getSortableFields() { |
| 82 | + return array( |
| 83 | + 'id', |
| 84 | + ); |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * (non-PHPdoc) |
| 89 | + * @see EPPager::getMultipleItemActions() |
| 90 | + */ |
| 91 | + protected function getMultipleItemActions() { |
| 92 | + return array(); |
| 93 | + } |
| 94 | + |
| 95 | + /** |
| 96 | + * (non-PHPdoc) |
| 97 | + * @see EPPager::hasActionsColumn() |
| 98 | + */ |
| 99 | + protected function hasActionsColumn() { |
| 100 | + return false; |
| 101 | + } |
| 102 | + |
| 103 | + /** |
| 104 | + * (non-PHPdoc) |
| 105 | + * @see EPPager::getFieldNames() |
| 106 | + */ |
| 107 | + public function getFieldNames() { |
| 108 | + $fields = parent::getFieldNames(); |
| 109 | + |
| 110 | + return $fields; |
| 111 | + } |
| 112 | + |
| 113 | +} |
Property changes on: trunk/extensions/EducationProgram/includes/EPMentorPager.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 114 | + native |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -55,9 +55,9 @@ |
56 | 56 | 'group-epstudent-member' => '{{GENDER:$1|education program student}}', |
57 | 57 | 'grouppage-epstudent' => '{{ns:project}}:Education_program_students', |
58 | 58 | |
59 | | - 'group-epmentor' => 'Education program mentors', |
60 | | - 'group-epmentor-member' => '{{GENDER:$1|education program mentor}}', |
61 | | - 'grouppage-epmentor' => '{{ns:project}}:Education_program_mentors', |
| 59 | + 'group-epmentor' => 'Education program ambassadors', |
| 60 | + 'group-epmentor-member' => '{{GENDER:$1|education program ambassador}}', |
| 61 | + 'grouppage-epmentor' => '{{ns:project}}:Education_program_ambassadors', |
62 | 62 | |
63 | 63 | // Special pages |
64 | 64 | 'specialpages-group-education' => 'Education', |
— | — | @@ -78,6 +78,7 @@ |
79 | 79 | 'special-editcourse-add' => 'Add course', |
80 | 80 | 'special-editcourse-edit' => 'Edit course', |
81 | 81 | 'special-enroll' => 'Enroll', |
| 82 | + 'special-ambassadors' => 'Ambassadors', |
82 | 83 | |
83 | 84 | // Special:Institutions |
84 | 85 | 'ep-institutions-nosuchinstitution' => 'There is no institution with name "$1". Existing institutions are listed below.', |
— | — | @@ -112,6 +113,9 @@ |
113 | 114 | // Special:Students |
114 | 115 | 'ep-students-noresults' => 'There are no students to list.', |
115 | 116 | |
| 117 | + // Special:Ambassadors |
| 118 | + 'ep-mentors-noresults' => 'There are no ambassadors to list.', |
| 119 | + |
116 | 120 | // Pager |
117 | 121 | 'ep-pager-showonly' => 'Show only items with', |
118 | 122 | 'ep-pager-clear' => 'Clear filters', |
Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -7,6 +7,10 @@ |
8 | 8 | * Support https://www.mediawiki.org/wiki/Extension_talk:Education_Program |
9 | 9 | * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/EducationProgram |
10 | 10 | * |
| 11 | + * The source code makes use of a number of terms different from but corresponding to those in the UI: |
| 12 | + * * Org instead of Institution |
| 13 | + * * Mentor instead of Ambassador |
| 14 | + * |
11 | 15 | * @file EducationProgram.php |
12 | 16 | * @ingroup EducationProgram |
13 | 17 | * |
— | — | @@ -59,13 +63,14 @@ |
60 | 64 | $wgAutoloadClasses['EPCoursePager'] = dirname( __FILE__ ) . '/includes/EPCoursePager.php'; |
61 | 65 | $wgAutoloadClasses['EPDBObject'] = dirname( __FILE__ ) . '/includes/EPDBObject.php'; |
62 | 66 | $wgAutoloadClasses['EPMentor'] = dirname( __FILE__ ) . '/includes/EPMentor.php'; |
| 67 | +$wgAutoloadClasses['EPMentorPager'] = dirname( __FILE__ ) . '/includes/EPMentorPager.php'; |
63 | 68 | $wgAutoloadClasses['EPOrg'] = dirname( __FILE__ ) . '/includes/EPOrg.php'; |
64 | 69 | $wgAutoloadClasses['EPOrgPager'] = dirname( __FILE__ ) . '/includes/EPOrgPager.php'; |
65 | 70 | $wgAutoloadClasses['EPPager'] = dirname( __FILE__ ) . '/includes/EPPager.php'; |
66 | 71 | $wgAutoloadClasses['EPStudent'] = dirname( __FILE__ ) . '/includes/EPStudent.php'; |
67 | 72 | $wgAutoloadClasses['EPStudentPager'] = dirname( __FILE__ ) . '/includes/EPStudentPager.php'; |
68 | 73 | $wgAutoloadClasses['EPTerm'] = dirname( __FILE__ ) . '/includes/EPTerm.php'; |
69 | | -$wgAutoloadClasses['EPTermPager'] = dirname( __FILE__ ) . '/includes/EPTermPager.php'; |
| 74 | +$wgAutoloadClasses['EPTermPager'] = dirname( __FILE__ ) . '/includes/EPTermPager.php'; |
70 | 75 | |
71 | 76 | $wgAutoloadClasses['SpecialCourse'] = dirname( __FILE__ ) . '/specials/SpecialCourse.php'; |
72 | 77 | $wgAutoloadClasses['SpecialCourses'] = dirname( __FILE__ ) . '/specials/SpecialCourses.php'; |
— | — | @@ -83,6 +88,7 @@ |
84 | 89 | $wgAutoloadClasses['SpecialTerm'] = dirname( __FILE__ ) . '/specials/SpecialTerm.php'; |
85 | 90 | $wgAutoloadClasses['SpecialTerms'] = dirname( __FILE__ ) . '/specials/SpecialTerms.php'; |
86 | 91 | $wgAutoloadClasses['SpecialEnroll'] = dirname( __FILE__ ) . '/specials/SpecialEnroll.php'; |
| 92 | +$wgAutoloadClasses['SpecialAmbassadors'] = dirname( __FILE__ ) . '/specials/SpecialAmbassadors.php'; |
87 | 93 | |
88 | 94 | // Special pages |
89 | 95 | $wgSpecialPages['MyCourses'] = 'SpecialMyCourses'; |