Index: trunk/extensions/EducationProgram/specials/SpecialMyCourses.php |
— | — | @@ -154,8 +154,9 @@ |
155 | 155 | $out = $this->getOutput(); |
156 | 156 | |
157 | 157 | $course = EPCourse::selectRow( null, array( 'name' => $courseName ) ); |
| 158 | + $terms = $student->getTerms( null, array( 'course_id' => $course->getId() ) ); |
158 | 159 | |
159 | | - if ( $course !== false && $student->hasTerm( array( 'course_id' => $course->getId() ) ) ) { |
| 160 | + if ( $course !== false && count( $terms ) > 0 ) { |
160 | 161 | $out->addWikiMsg( 'ep-mycourses-show-all' ); |
161 | 162 | |
162 | 163 | $out->setPageTitle( wfMsgExt( |
— | — | @@ -164,6 +165,8 @@ |
165 | 166 | $courseName, |
166 | 167 | $course->getOrg( 'name' )->getField( 'name' ) |
167 | 168 | ) ); |
| 169 | + |
| 170 | + $this->displayCourseSummary( $course, $terms ); |
168 | 171 | } |
169 | 172 | else { |
170 | 173 | $this->showError( wfMessage( 'ep-mycourses-no-such-course', $courseName ) ); |
— | — | @@ -171,4 +174,25 @@ |
172 | 175 | } |
173 | 176 | } |
174 | 177 | |
| 178 | + /** |
| 179 | + * Display the summary for a course. |
| 180 | + * |
| 181 | + * @since 0.1 |
| 182 | + * |
| 183 | + * @param EPCourse $course |
| 184 | + * @param array $terms |
| 185 | + */ |
| 186 | + protected function displayCourseSummary( EPCourse $course, array /* of EPTerm */ $terms ) { |
| 187 | + $info = array(); |
| 188 | + |
| 189 | + $info['name'] = $course->getField( 'name' ); |
| 190 | + $info['org'] = EPOrg::selectFieldsRow( 'name', array( 'id' => $course->getField( 'org_id' ) ) ); |
| 191 | + |
| 192 | + foreach ( $info as &$inf ) { |
| 193 | + $inf = htmlspecialchars( $inf ); |
| 194 | + } |
| 195 | + |
| 196 | + $this->displaySummary( $course, false, $info ); |
| 197 | + } |
| 198 | + |
175 | 199 | } |
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php |
— | — | @@ -176,8 +176,9 @@ |
177 | 177 | * |
178 | 178 | * @param EPDBObject $item |
179 | 179 | * @param boolean $collapsed |
| 180 | + * @param array $summaryData |
180 | 181 | */ |
181 | | - protected function displaySummary( EPDBObject $item, $collapsed = true ) { |
| 182 | + protected function displaySummary( EPDBObject $item, $collapsed = true, array $summaryData = null ) { |
182 | 183 | $out = $this->getOutput(); |
183 | 184 | |
184 | 185 | $class = 'wikitable ep-summary mw-collapsible'; |
— | — | @@ -189,8 +190,10 @@ |
190 | 191 | $out->addHTML( Html::openElement( 'table', array( 'class' => $class ) ) ); |
191 | 192 | |
192 | 193 | $out->addHTML( '<tr>' . Html::element( 'th', array( 'colspan' => 2 ), wfMsg( 'ep-item-summary' ) ) . '</tr>' ); |
193 | | - |
194 | | - foreach ( $this->getSummaryData( $item ) as $stat => $value ) { |
| 194 | + |
| 195 | + $summaryData = is_null( $summaryData ) ? $this->getSummaryData( $item ) : $summaryData; |
| 196 | + |
| 197 | + foreach ( $summaryData as $stat => $value ) { |
195 | 198 | $out->addHTML( '<tr>' ); |
196 | 199 | |
197 | 200 | $out->addHTML( Html::element( |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -224,6 +224,8 @@ |
225 | 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 | 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 | 227 | 'ep-mycourses-course-title' => 'My courses: $1 at $2', |
| 228 | + 'specialmycourses-summary-name' => 'Course name', |
| 229 | + 'specialmycourses-summary-org' => 'Institution name', |
228 | 230 | |
229 | 231 | // Navigation links |
230 | 232 | 'ep-nav-orgs' => 'Institution list', |