Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -172,7 +172,7 @@ |
173 | 173 | $wgHooks['SkinTemplateNavigation::SpecialPage'][] = 'EPHooks::onSpecialPageTabs'; |
174 | 174 | $wgHooks['ArticleFromTitle'][] = 'EPHooks::onArticleFromTitle'; |
175 | 175 | $wgHooks['CanonicalNamespaces'][] = 'EPHooks::onCanonicalNamespaces'; |
176 | | -$wgHooks['TitleIsKnown'][] = 'EPHooks::onTitleIsKnown'; |
| 176 | +$wgHooks['TitleIsAlwaysKnown'][] = 'EPHooks::onTitleIsAlwaysKnown'; |
177 | 177 | |
178 | 178 | // Logging |
179 | 179 | $wgLogTypes[] = 'institution'; |
Index: trunk/extensions/EducationProgram/actions/EditCourseAction.php |
— | — | @@ -102,7 +102,12 @@ |
103 | 103 | |
104 | 104 | return array( $name, $term ); |
105 | 105 | } |
106 | | - |
| 106 | + |
| 107 | + /** |
| 108 | + * (non-PHPdoc) |
| 109 | + * @see EPEditAction::getItemClass() |
| 110 | + * @return string |
| 111 | + */ |
107 | 112 | protected function getItemClass() { |
108 | 113 | return 'EPCourse'; |
109 | 114 | } |
Index: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php |
— | — | @@ -27,14 +27,62 @@ |
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 |
| 38 | + $this->displaySummaryTable(); |
39 | 39 | } |
40 | 40 | |
| 41 | + /** |
| 42 | + * @since 0.1 |
| 43 | + */ |
| 44 | + protected function displaySummaryTable() { |
| 45 | + $out = $this->getOutput(); |
| 46 | + |
| 47 | + $out->addHTML( Html::openElement( 'table', array( 'class' => 'wikitable ep-summary' ) ) ); |
| 48 | + |
| 49 | + $out->addHTML( '<tr>' . Html::element( 'th', array( 'colspan' => 2 ), wfMsg( 'ep-summary-table-header' ) ) . '</tr>' ); |
| 50 | + |
| 51 | + $summaryData = $this->getSummaryInfo(); |
| 52 | + |
| 53 | + foreach ( $summaryData as $stat => $value ) { |
| 54 | + $out->addHTML( '<tr>' ); |
| 55 | + |
| 56 | + $out->addHtml( Html::rawElement( |
| 57 | + 'th', |
| 58 | + array( 'class' => 'ep-summary-name' ), |
| 59 | + wfMsgExt( strtolower( get_called_class() ) . '-summary-' . $stat, 'parseinline' ) |
| 60 | + ) ); |
| 61 | + |
| 62 | + $out->addHTML( Html::rawElement( |
| 63 | + 'td', |
| 64 | + array( 'class' => 'ep-summary-value' ), |
| 65 | + $value |
| 66 | + ) ); |
| 67 | + |
| 68 | + $out->addHTML( '</tr>' ); |
| 69 | + } |
| 70 | + |
| 71 | + $out->addHTML( Html::closeElement( 'table' ) ); |
| 72 | + } |
| 73 | + |
| 74 | + protected function getSummaryInfo() { |
| 75 | + $data = array(); |
| 76 | + |
| 77 | + $lang = $this->getLanguage(); |
| 78 | + |
| 79 | + $data['org-count'] = $lang->formatNum( EPOrg::count() ); |
| 80 | + $data['course-count'] = $lang->formatNum( EPCourse::count() ); |
| 81 | + $data['student-count'] = $lang->formatNum( EPStudent::count() ); |
| 82 | + $data['instructor-count'] = $lang->formatNum( EPInstructor::count() ); |
| 83 | + $data['oa-count'] = $lang->formatNum( EPOA::count() ); |
| 84 | + $data['ca-count'] = $lang->formatNum( EPCA::count() ); |
| 85 | + |
| 86 | + return $data; |
| 87 | + } |
| 88 | + |
41 | 89 | } |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -175,6 +175,15 @@ |
176 | 176 | 'ep-course-status-current' => 'Current', |
177 | 177 | 'ep-course-status-planned' => 'Planned', |
178 | 178 | |
| 179 | + // Special:EducationProgram |
| 180 | + 'ep-summary-table-header' => 'Education Program summary', |
| 181 | + 'specialeducationprogram-summary-org-count' => 'Amount of [[Special:Institutions|institutions]]', |
| 182 | + 'specialeducationprogram-summary-course-count' => 'Amount of [[Special:Courses|courses]]', |
| 183 | + 'specialeducationprogram-summary-student-count' => 'Amount of [[Special:Students|students]]', |
| 184 | + 'specialeducationprogram-summary-instructor-count' => 'Amount of instructors', |
| 185 | + 'specialeducationprogram-summary-ca-count' => 'Amount of [[Special:CampusAmbassadors|Campus Ambassadors]]', |
| 186 | + 'specialeducationprogram-summary-oa-count' => 'Amount of [[Special:OnlineAmbassadors|Online Ambassadors]]', |
| 187 | + |
179 | 188 | // Special:Institutions |
180 | 189 | 'ep-institutions-nosuchinstitution' => 'There is no institution with name "$1". Existing institutions are listed below.', |
181 | 190 | 'ep-institutions-noresults' => 'There are no institutions to list.', |
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php |
— | — | @@ -295,7 +295,7 @@ |
296 | 296 | |
297 | 297 | /** |
298 | 298 | * Override the isKnown check for course and institution pages, so they don't all show up as redlinks. |
299 | | - * @see https://www.mediawiki.org/wiki/Manual:Hooks/TitleIsKnown |
| 299 | + * @see https://www.mediawiki.org/wiki/Manual:Hooks/TitleIsAlwaysKnown |
300 | 300 | * |
301 | 301 | * @since 0.1 |
302 | 302 | * |
— | — | @@ -304,7 +304,7 @@ |
305 | 305 | * |
306 | 306 | * @return true |
307 | 307 | */ |
308 | | - public static function onTitleIsKnown( Title $title, &$isKnown ) { |
| 308 | + public static function onTitleIsAlwaysKnown( Title $title, &$isKnown ) { |
309 | 309 | if ( in_array( $title->getNamespace(), array( EP_NS_COURSE, EP_NS_INSTITUTION ) ) ) { |
310 | 310 | $classes = array( |
311 | 311 | EP_NS_COURSE => 'EPCourse', |