Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php |
— | — | @@ -88,13 +88,15 @@ |
89 | 89 | protected function getSummaryData( EPDBObject $course ) { |
90 | 90 | $stats = array(); |
91 | 91 | |
92 | | - $stats['name'] = $course->getField( 'name' ); |
93 | | - $stats['org'] = EPOrg::selectFieldsRow( 'name', array( 'id' => $course->getField( 'org_id' ) ) ); |
| 92 | + $stats['name'] = htmlspecialchars( $course->getField( 'name' ) ); |
94 | 93 | |
95 | | - foreach ( $stats as &$stat ) { |
96 | | - $stat = htmlspecialchars( $stat ); |
97 | | - } |
| 94 | + $org = EPOrg::selectFieldsRow( 'name', array( 'id' => $course->getField( 'org_id' ) ) ); |
98 | 95 | |
| 96 | + $stats['org'] = Linker::linkKnown( |
| 97 | + SpecialPage::getTitleFor( 'Institution', $org ), |
| 98 | + htmlspecialchars( $org ) |
| 99 | + ); |
| 100 | + |
99 | 101 | return $stats; |
100 | 102 | } |
101 | 103 | |
Index: trunk/extensions/EducationProgram/specials/SpecialTerm.php |
— | — | @@ -88,16 +88,24 @@ |
89 | 89 | protected function getSummaryData( EPDBObject $term ) { |
90 | 90 | $stats = array(); |
91 | 91 | |
92 | | - $stats['org'] = EPOrg::selectFieldsRow( 'name', array( 'id' => $term->getField( 'org_id' ) ) ); |
93 | | - $stats['course'] = EPCourse::selectFieldsRow( 'name', array( 'id' => $term->getField( 'course_id' ) ) ); |
94 | | - $stats['year'] = $term->getField( 'year' ); // TODO: how to properly i18n this? |
95 | | - $stats['start'] = $this->getLanguage()->timeanddate( $term->getField( 'start' ), true ); |
96 | | - $stats['end'] = $this->getLanguage()->timeanddate( $term->getField( 'end' ), true ); |
| 92 | + $org = EPOrg::selectFieldsRow( 'name', array( 'id' => $term->getField( 'org_id' ) ) ); |
97 | 93 | |
98 | | - foreach ( $stats as &$stat ) { |
99 | | - $stat = htmlspecialchars( $stat ); |
100 | | - } |
| 94 | + $stats['org'] = Linker::linkKnown( |
| 95 | + SpecialPage::getTitleFor( 'Institution', $org ), |
| 96 | + htmlspecialchars( $org ) |
| 97 | + ); |
101 | 98 | |
| 99 | + $course = EPCourse::selectFieldsRow( 'name', array( 'id' => $term->getField( 'course_id' ) ) ); |
| 100 | + |
| 101 | + $stats['course'] = Linker::linkKnown( |
| 102 | + SpecialPage::getTitleFor( 'Course', $course ), |
| 103 | + htmlspecialchars( $course ) |
| 104 | + ); |
| 105 | + |
| 106 | + $stats['year'] = htmlspecialchars( $term->getField( 'year' ) ); // TODO: how to properly i18n this? |
| 107 | + $stats['start'] = htmlspecialchars( $this->getLanguage()->timeanddate( $term->getField( 'start' ), true ) ); |
| 108 | + $stats['end'] = htmlspecialchars( $this->getLanguage()->timeanddate( $term->getField( 'end' ), true ) ); |
| 109 | + |
102 | 110 | if ( $term->useCanManage( $this->getUser() ) ) { |
103 | 111 | $stats['token'] = Linker::linkKnown( |
104 | 112 | SpecialPage::getTitleFor( 'Enroll', $term->getId() . '/' . $term->getField( 'token' ) ), |
Index: trunk/extensions/EducationProgram/specials/SpecialStudents.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * |
| 5 | + * Page listing all students in a pager with filter control. |
6 | 6 | * |
7 | 7 | * @since 0.1 |
8 | 8 | * |
— | — | @@ -27,14 +27,20 @@ |
28 | 28 | * |
29 | 29 | * @since 0.1 |
30 | 30 | * |
31 | | - * @param string $arg |
| 31 | + * @param string $subPage |
32 | 32 | */ |
33 | 33 | public function execute( $subPage ) { |
34 | 34 | parent::execute( $subPage ); |
35 | 35 | |
36 | 36 | $out = $this->getOutput(); |
37 | 37 | |
38 | | - // TODO: AUTH |
| 38 | + if ( $this->subPage === '' ) { |
| 39 | + $this->displayNavigation(); |
| 40 | + EPStudent::displayPager( $this->getContext() ); |
| 41 | + } |
| 42 | + else { |
| 43 | + $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Student', $this->subPage )->getLocalURL() ); |
| 44 | + } |
39 | 45 | } |
40 | 46 | |
41 | 47 | } |
Index: trunk/extensions/EducationProgram/specials/SpecialInstitutions.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * Page listing all insitutions in a pager with filter control. |
6 | | - * Also has a form for adding new items for those with matching priviliges. |
| 5 | + * Page listing all institutions in a pager with filter control. |
| 6 | + * Also has a form for adding new items for those with matching privileges. |
7 | 7 | * |
8 | 8 | * @since 0.1 |
9 | 9 | * |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | * |
30 | 30 | * @since 0.1 |
31 | 31 | * |
32 | | - * @param string|null $arg |
| 32 | + * @param string|null $subPage |
33 | 33 | */ |
34 | 34 | public function execute( $subPage ) { |
35 | 35 | parent::execute( $subPage ); |
Index: trunk/extensions/EducationProgram/includes/EPStudent.php |
— | — | @@ -208,5 +208,31 @@ |
209 | 209 | public function hasTerm( array $conditions = array() ) { |
210 | 210 | return count( $this->getTerms( 'id', $conditions ) ) > 0; |
211 | 211 | } |
| 212 | + |
| 213 | + /** |
| 214 | + * Display a pager with students. |
| 215 | + * |
| 216 | + * @since 0.1 |
| 217 | + * |
| 218 | + * @param IContextSource $context |
| 219 | + * @param array $conditions |
| 220 | + */ |
| 221 | + public static function displayPager( IContextSource $context, array $conditions = array() ) { |
| 222 | + $pager = new EPStudentPager( $context, $conditions ); |
| 223 | + |
| 224 | + if ( $pager->getNumRows() ) { |
| 225 | + $context->getOutput()->addHTML( |
| 226 | + $pager->getFilterControl() . |
| 227 | + $pager->getNavigationBar() . |
| 228 | + $pager->getBody() . |
| 229 | + $pager->getNavigationBar() . |
| 230 | + $pager->getMultipleItemControl() |
| 231 | + ); |
| 232 | + } |
| 233 | + else { |
| 234 | + $context->getOutput()->addHTML( $pager->getFilterControl( true ) ); |
| 235 | + $context->getOutput()->addWikiMsg( 'ep-students-noresults' ); |
| 236 | + } |
| 237 | + } |
212 | 238 | |
213 | 239 | } |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -101,6 +101,9 @@ |
102 | 102 | 'ep-terms-nocourses' => 'There are no courses yet. You need to [[Special:Courses|add a course]] before you can create any terms.', |
103 | 103 | 'ep-terms-addcoursefirst' => 'The institutions you are a mentor for do not have any courses associated with them. You need to [[Special:Courses|add a course]] before you can create any terms.', |
104 | 104 | |
| 105 | + // Special:Students |
| 106 | + 'ep-students-noresults' => 'There are no students to list.', |
| 107 | + |
105 | 108 | // Pager |
106 | 109 | 'ep-pager-showonly' => 'Show only items with', |
107 | 110 | 'ep-pager-clear' => 'Clear filters', |