r111336 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111335‎ | r111336 | r111337 >
Date:23:33, 12 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
match hook rename and work on Special:EducationProgram
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.hooks.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EditCourseAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -172,7 +172,7 @@
173173 $wgHooks['SkinTemplateNavigation::SpecialPage'][] = 'EPHooks::onSpecialPageTabs';
174174 $wgHooks['ArticleFromTitle'][] = 'EPHooks::onArticleFromTitle';
175175 $wgHooks['CanonicalNamespaces'][] = 'EPHooks::onCanonicalNamespaces';
176 -$wgHooks['TitleIsKnown'][] = 'EPHooks::onTitleIsKnown';
 176+$wgHooks['TitleIsAlwaysKnown'][] = 'EPHooks::onTitleIsAlwaysKnown';
177177
178178 // Logging
179179 $wgLogTypes[] = 'institution';
Index: trunk/extensions/EducationProgram/actions/EditCourseAction.php
@@ -102,7 +102,12 @@
103103
104104 return array( $name, $term );
105105 }
106 -
 106+
 107+ /**
 108+ * (non-PHPdoc)
 109+ * @see EPEditAction::getItemClass()
 110+ * @return string
 111+ */
107112 protected function getItemClass() {
108113 return 'EPCourse';
109114 }
Index: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
@@ -27,14 +27,62 @@
2828 *
2929 * @since 0.1
3030 *
31 - * @param string $arg
 31+ * @param string $subPage
3232 */
3333 public function execute( $subPage ) {
3434 parent::execute( $subPage );
3535
3636 $out = $this->getOutput();
3737
38 - // TODO
 38+ $this->displaySummaryTable();
3939 }
4040
 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+
4189 }
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -175,6 +175,15 @@
176176 'ep-course-status-current' => 'Current',
177177 'ep-course-status-planned' => 'Planned',
178178
 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+
179188 // Special:Institutions
180189 'ep-institutions-nosuchinstitution' => 'There is no institution with name "$1". Existing institutions are listed below.',
181190 'ep-institutions-noresults' => 'There are no institutions to list.',
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php
@@ -295,7 +295,7 @@
296296
297297 /**
298298 * 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
300300 *
301301 * @since 0.1
302302 *
@@ -304,7 +304,7 @@
305305 *
306306 * @return true
307307 */
308 - public static function onTitleIsKnown( Title $title, &$isKnown ) {
 308+ public static function onTitleIsAlwaysKnown( Title $title, &$isKnown ) {
309309 if ( in_array( $title->getNamespace(), array( EP_NS_COURSE, EP_NS_INSTITUTION ) ) ) {
310310 $classes = array(
311311 EP_NS_COURSE => 'EPCourse',

Status & tagging log