Index: trunk/extensions/EducationProgram/EducationProgram.i18n.alias.php |
— | — | @@ -30,4 +30,5 @@ |
31 | 31 | 'EditInstitution' => array( 'EditInstitution' ), |
32 | 32 | 'EditTerm' => array( 'EditTerm' ), |
33 | 33 | 'Enroll' => array( 'Enroll' ), |
| 34 | + 'Ambassadors' => array( 'Ambassadors' ), |
34 | 35 | ); |
Index: trunk/extensions/EducationProgram/specials/SpecialAmbassadors.php |
— | — | @@ -0,0 +1,46 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Page listing all mentors in a pager with filter control. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file SpecialAmbassadors.php |
| 10 | + * @ingroup EducationProgram |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class SpecialAmbassadors extends SpecialEPPage { |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructor. |
| 19 | + * |
| 20 | + * @since 0.1 |
| 21 | + */ |
| 22 | + public function __construct() { |
| 23 | + parent::__construct( 'Ambassadors' ); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * Main method. |
| 28 | + * |
| 29 | + * @since 0.1 |
| 30 | + * |
| 31 | + * @param string|null $subPage |
| 32 | + */ |
| 33 | + public function execute( $subPage ) { |
| 34 | + parent::execute( $subPage ); |
| 35 | + |
| 36 | + if ( $this->subPage === '' ) { |
| 37 | + $this->displayNavigation(); |
| 38 | + EPMentor::displayAddNewControl( $this->getContext() ); |
| 39 | + EPMentor::displayPager( $this->getContext() ); |
| 40 | + } |
| 41 | + else { |
| 42 | + // TODO |
| 43 | + //$this->getOutput()->redirect( SpecialPage::getTitleFor( 'Institution', $this->subPage )->getLocalURL() ); |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | +} |
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | } |
146 | 146 | |
147 | 147 | $this->getOutput()->addHTML( |
148 | | - Html::rawElement( 'p', array(), $this->getLang()->pipeList( $links ) ) |
| 148 | + Html::rawElement( 'p', array(), $this->getLanguage()->pipeList( $links ) ) |
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
— | — | @@ -161,6 +161,11 @@ |
162 | 162 | wfMsg( 'ep-nav-courses' ) => SpecialPage::getTitleFor( 'Courses' ), |
163 | 163 | wfMsg( 'ep-nav-terms' ) => SpecialPage::getTitleFor( 'Terms' ), |
164 | 164 | ); |
| 165 | + |
| 166 | + if ( $this->getUser()->isAllowed( 'epmentor' ) ) { |
| 167 | + $items[wfMsg( 'ep-nav-students' )] = SpecialPage::getTitleFor( 'Students' ); |
| 168 | + $items[wfMsg( 'ep-nav-mentors' )] = SpecialPage::getTitleFor( 'Ambassadors' ); |
| 169 | + } |
165 | 170 | |
166 | 171 | if ( $this->getUser()->isAllowed( 'epmentor' ) || EPStudent::has( array( 'user_id' => $this->getUser()->getId() ) ) ) { |
167 | 172 | $items[wfMsg( 'ep-nav-mycourses' )] = SpecialPage::getTitleFor( 'MyCourses' ); |
Index: trunk/extensions/EducationProgram/includes/EPStudentPager.php |
— | — | @@ -26,14 +26,15 @@ |
27 | 27 | parent::__construct( $context, $conds, 'EPStudent' ); |
28 | 28 | } |
29 | 29 | |
30 | | - /** |
| 30 | + /** |
31 | 31 | * (non-PHPdoc) |
32 | 32 | * @see EPPager::getFields() |
33 | 33 | */ |
34 | 34 | public function getFields() { |
35 | 35 | return array( |
36 | | - // TODO |
37 | | - ); |
| 36 | + 'id', |
| 37 | + 'user_id', |
| 38 | + ); |
38 | 39 | } |
39 | 40 | |
40 | 41 | /** |
— | — | @@ -58,9 +59,16 @@ |
59 | 60 | */ |
60 | 61 | protected function getFormattedValue( $name, $value ) { |
61 | 62 | switch ( $name ) { |
62 | | - case '': // TODO |
| 63 | + case 'id': |
63 | 64 | $value = $value; |
64 | 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 | + |
| 72 | + break; |
65 | 73 | } |
66 | 74 | |
67 | 75 | return $value; |
— | — | @@ -71,6 +79,16 @@ |
72 | 80 | * @see EPPager::getSortableFields() |
73 | 81 | */ |
74 | 82 | protected function getSortableFields() { |
| 83 | + return array( |
| 84 | + 'id', |
| 85 | + ); |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * (non-PHPdoc) |
| 90 | + * @see EPPager::getMultipleItemActions() |
| 91 | + */ |
| 92 | + protected function getMultipleItemActions() { |
75 | 93 | return array(); |
76 | 94 | } |
77 | 95 | |
Index: trunk/extensions/EducationProgram/includes/EPPager.php |
— | — | @@ -165,9 +165,7 @@ |
166 | 166 | |
167 | 167 | $cells[] = Html::rawElement( 'td', $this->getCellAttrs( $field, $value ), $formatted ); |
168 | 168 | } |
169 | | - |
170 | | - $links = $this->getControlLinks( $this->currentObject ); |
171 | | - |
| 169 | + |
172 | 170 | return Html::rawElement( 'tr', $this->getRowAttrs( $row ), implode( '', $cells ) ) . "\n"; |
173 | 171 | } |
174 | 172 | |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -24,6 +24,14 @@ |
25 | 25 | 'ep-item-summary' => 'Summary', |
26 | 26 | 'ep-toplink' => 'My courses', |
27 | 27 | |
| 28 | + // Navigation links |
| 29 | + 'ep-nav-orgs' => 'Institution list', |
| 30 | + 'ep-nav-courses' => 'Courses list', |
| 31 | + 'ep-nav-terms' => 'Terms list', |
| 32 | + 'ep-nav-mycourses' => 'My courses', |
| 33 | + 'ep-nav-students' => 'Student list', |
| 34 | + 'ep-nav-mentors' => 'Ambassador list', |
| 35 | + |
28 | 36 | // Preferences |
29 | 37 | 'prefs-education' => 'Education', |
30 | 38 | 'ep-prefs-showtoplink' => 'Show a link to [[Special:MyCourses|your courses]] at the top of every page.', |
— | — | @@ -131,6 +139,10 @@ |
132 | 140 | 'eptermpager-filter-course-id' => 'Course', |
133 | 141 | 'eptermpager-filter-year' => 'Year', |
134 | 142 | |
| 143 | + // Student pager |
| 144 | + 'epstudentpager-header-user-id' => 'User', |
| 145 | + 'epstudentpager-header-id' => 'Id', |
| 146 | + |
135 | 147 | // Special:EditInstitution |
136 | 148 | 'editinstitution-text' => 'Enter the institution details below and click submit to save your changes.', |
137 | 149 | 'educationprogram-org-edit-name' => 'Institution name', |
— | — | @@ -229,12 +241,6 @@ |
230 | 242 | 'ep-mycourses-course-title' => 'My courses: $1 at $2', |
231 | 243 | 'specialmycourses-summary-name' => 'Course name', |
232 | 244 | 'specialmycourses-summary-org' => 'Institution name', |
233 | | - |
234 | | - // Navigation links |
235 | | - 'ep-nav-orgs' => 'Institution list', |
236 | | - 'ep-nav-courses' => 'Courses list', |
237 | | - 'ep-nav-terms' => 'Terms list', |
238 | | - 'ep-nav-mycourses' => 'My courses', |
239 | 245 | ); |
240 | 246 | |
241 | 247 | /** Message documentation (Message documentation) |