Index: trunk/extensions/EducationProgram/specials/SpecialMyCourses.php |
— | — | @@ -54,8 +54,8 @@ |
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
| 58 | + * Display the courses this student is linked to. |
58 | 59 | * |
59 | | - * |
60 | 60 | * @since 0.1 |
61 | 61 | * |
62 | 62 | * @param EPStudent $student |
— | — | @@ -95,8 +95,8 @@ |
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
| 99 | + * Display the provided courses in a table. |
99 | 100 | * |
100 | | - * |
101 | 101 | * @since 0.1 |
102 | 102 | * |
103 | 103 | * @param array $courses |
— | — | @@ -121,9 +121,16 @@ |
122 | 122 | foreach ( $courses as /* EPCourse */ $course ) { |
123 | 123 | $fields = array(); |
124 | 124 | |
125 | | - $fields[] = $course->getField( 'name' ); |
126 | | - $fields[] = $course->getOrg()->getField( 'name' ); |
| 125 | + $fields[] = Linker::link( |
| 126 | + $this->getTitle( $course->getField( 'name' ) ), |
| 127 | + '<b>' . htmlspecialchars( $course->getField( 'name' ) ) . '</b>' |
| 128 | + ); |
127 | 129 | |
| 130 | + $fields[] = Linker::link( |
| 131 | + SpecialPage::getTitleFor( 'Institution', $course->getOrg()->getField( 'name' ) ), |
| 132 | + htmlspecialchars( $course->getOrg()->getField( 'name' ) ) |
| 133 | + ); |
| 134 | + |
128 | 135 | foreach ( $fields as &$field ) { |
129 | 136 | $field = Html::rawElement( 'td', array(), $field ); |
130 | 137 | } |
— | — | @@ -136,19 +143,32 @@ |
137 | 144 | } |
138 | 145 | |
139 | 146 | /** |
| 147 | + * Display info for a single course. |
140 | 148 | * |
141 | | - * |
142 | 149 | * @since 0.1 |
143 | 150 | * |
144 | 151 | * @param EPStudent $student |
145 | 152 | * @param string $courseName |
146 | 153 | */ |
147 | 154 | protected function displayCourse( EPStudent $student, $courseName ) { |
| 155 | + $out = $this->getOutput(); |
| 156 | + |
148 | 157 | $course = EPCourse::selectRow( null, array( 'name' => $courseName ) ); |
149 | 158 | |
150 | | - if ( $student->hasTerm( array( ) ) ) { |
151 | | - // TODO |
| 159 | + if ( $course !== false && $student->hasTerm( array( 'course_id' => $course->getId() ) ) ) { |
| 160 | + $out->addWikiMsg( 'ep-mycourses-show-all' ); |
| 161 | + |
| 162 | + $out->setPageTitle( wfMsgExt( |
| 163 | + 'ep-mycourses-course-title', |
| 164 | + 'parsemag', |
| 165 | + $courseName, |
| 166 | + $course->getOrg( 'name' )->getField( 'name' ) |
| 167 | + ) ); |
152 | 168 | } |
| 169 | + else { |
| 170 | + $this->showError( wfMessage( 'ep-mycourses-no-such-course', $courseName ) ); |
| 171 | + $this->displayCourses( $student ); |
| 172 | + } |
153 | 173 | } |
154 | 174 | |
155 | 175 | } |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -221,6 +221,9 @@ |
222 | 222 | 'ep-mycourses-passed' => 'Passed courses', |
223 | 223 | 'ep-mycourses-header-name' => 'Name', |
224 | 224 | 'ep-mycourses-header-institution' => 'Institution', |
| 225 | + 'ep-mycourses-show-all' => 'This page shows one of the courses you are enrolled in. You can also view all [[Special:MyCourses|your courses]].', |
| 226 | + 'ep-mycourses-no-such-course' => 'You are not enrolled in any course with name "$1". The courses you are enrolled in are listed below.', |
| 227 | + 'ep-mycourses-course-title' => 'My courses: $1 at $2', |
225 | 228 | |
226 | 229 | // Navigation links |
227 | 230 | 'ep-nav-orgs' => 'Institution list', |