Index: trunk/extensions/EducationProgram/specials/SpecialInstitution.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | } |
57 | 57 | } |
58 | 58 | else { |
59 | | - $this->displayInfo( $org ); |
| 59 | + $this->displaySummary( $org ); |
60 | 60 | |
61 | 61 | $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-institution-courses' ) ) ); |
62 | 62 | |
— | — | @@ -65,16 +65,22 @@ |
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | | - * Display the orgs info. |
70 | | - * |
| 69 | + * Gets the summary data. |
| 70 | + * |
71 | 71 | * @since 0.1 |
72 | | - * |
| 72 | + * |
73 | 73 | * @param EPOrg $org |
| 74 | + * |
| 75 | + * @return array |
74 | 76 | */ |
75 | | - protected function displayInfo( EPOrg $org ) { |
76 | | - $out = $this->getOutput(); |
77 | | - |
78 | | - |
| 77 | + protected function getSummaryData( EPDBObject $org ) { |
| 78 | + $stats = array(); |
| 79 | + |
| 80 | + $stats['name'] = $org->getField( 'name' ); |
| 81 | + $stats['city'] = $org->getField( 'city' ); |
| 82 | + $stats['country'] = $org->getField( 'country' ); |
| 83 | + |
| 84 | + return $stats; |
79 | 85 | } |
80 | 86 | |
81 | 87 | } |
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php |
— | — | @@ -166,5 +166,60 @@ |
167 | 167 | |
168 | 168 | return $items; |
169 | 169 | } |
| 170 | + |
| 171 | + /** |
| 172 | + * Display the summary data. |
| 173 | + * |
| 174 | + * @since 0.1 |
| 175 | + * |
| 176 | + * @param EPDBObject $item |
| 177 | + * @param boolean $collapsed |
| 178 | + */ |
| 179 | + protected function displaySummary( EPDBObject $item, $collapsed = true ) { |
| 180 | + $out = $this->getOutput(); |
| 181 | + |
| 182 | + $class = 'wikitable ep-summary mw-collapsible'; |
| 183 | + |
| 184 | + if ( $collapsed ) { |
| 185 | + $class.= ' mw-collapsed'; |
| 186 | + } |
| 187 | + |
| 188 | + $out->addHTML( Html::openElement( 'table', array( 'class' => $class ) ) ); |
| 189 | + |
| 190 | + $out->addHTML( '<tr>' . Html::element( 'th', array( 'colspan' => 2 ), wfMsg( 'ep-item-summary' ) ) . '</tr>' ); |
| 191 | + |
| 192 | + foreach ( $this->getSummaryData( $item ) as $stat => $value ) { |
| 193 | + $out->addHTML( '<tr>' ); |
170 | 194 | |
| 195 | + $out->addHTML( Html::element( |
| 196 | + 'th', |
| 197 | + array( 'class' => 'ep-summary-name' ), |
| 198 | + wfMsg( strtolower( get_called_class() ) . '-summary-' . $stat ) |
| 199 | + ) ); |
| 200 | + |
| 201 | + $out->addHTML( Html::element( |
| 202 | + 'td', |
| 203 | + array( 'class' => 'ep-summary-value' ), |
| 204 | + $value |
| 205 | + ) ); |
| 206 | + |
| 207 | + $out->addHTML( '</tr>' ); |
| 208 | + } |
| 209 | + |
| 210 | + $out->addHTML( Html::closeElement( 'table' ) ); |
| 211 | + } |
| 212 | + |
| 213 | + /** |
| 214 | + * Gets the summary data. |
| 215 | + * |
| 216 | + * @since 0.1 |
| 217 | + * |
| 218 | + * @param EPDBObject $item |
| 219 | + * |
| 220 | + * @return array |
| 221 | + */ |
| 222 | + protected function getSummaryData( EPDBObject $item ) { |
| 223 | + return array(); |
| 224 | + } |
| 225 | + |
171 | 226 | } |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -156,6 +156,9 @@ |
157 | 157 | 'ep-institution-create' => 'There is no institution with name "$1" yet, but you can create it.', |
158 | 158 | 'ep-institution-title' => 'Institution: $1', |
159 | 159 | 'ep-institution-courses' => 'Courses', |
| 160 | + 'specialinstitution-summary-name' => 'Name', |
| 161 | + 'specialinstitution-summary-city' => 'City', |
| 162 | + 'specialinstitution-summary-country' => 'Country', |
160 | 163 | |
161 | 164 | // Special:Course |
162 | 165 | 'ep-course-title' => 'Course: $1', |
— | — | @@ -174,6 +177,9 @@ |
175 | 178 | 'ep-nav-courses' => 'Courses list', |
176 | 179 | 'ep-nav-terms' => 'Terms list', |
177 | 180 | 'ep-nav-mycourses' => 'My courses', |
| 181 | + |
| 182 | + // Misc |
| 183 | + 'ep-item-summary' => 'Summary', |
178 | 184 | ); |
179 | 185 | |
180 | 186 | /** Message documentation (Message documentation) |