r108728 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108727‎ | r108728 | r108729 >
Date:16:52, 12 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added summary fields to special:institution and special:course
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitution.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialInstitution.php
@@ -96,10 +96,35 @@
9797 $countries = CountryNames::getNames( $this->getLanguage()->getCode() );
9898 $stats['country'] = $countries[$org->getField( 'country' )];
9999
 100+ $stats['status'] = wfMsgHtml( $org->getField( 'active' ) ? 'ep-institution-active' : 'ep-institution-inactive' );
 101+
 102+ $stats['courses'] = $this->getLanguage()->formatNum( $org->getField( 'courses' ) );
 103+ $stats['terms'] = $this->getLanguage()->formatNum( $org->getField( 'terms' ) );
 104+ $stats['ambassadors'] = $this->getLanguage()->formatNum( $org->getField( 'mentors' ) );
 105+ $stats['students'] = $this->getLanguage()->formatNum( $org->getField( 'students' ) );
 106+
100107 foreach ( $stats as &$stat ) {
101108 $stat = htmlspecialchars( $stat );
102109 }
103110
 111+ if ( $org->getField( 'courses' ) > 0 ) {
 112+ $stats['courses'] = Linker::linkKnown(
 113+ SpecialPage::getTitleFor( 'Courses' ),
 114+ $stats['courses'],
 115+ array(),
 116+ array( 'org_id' => $org->getId() )
 117+ );
 118+ }
 119+
 120+ if ( $org->getField( 'terms' ) > 0 ) {
 121+ $stats['terms'] = Linker::linkKnown(
 122+ SpecialPage::getTitleFor( 'Terms' ),
 123+ $stats['terms'],
 124+ array(),
 125+ array( 'org_id' => $org->getId() )
 126+ );
 127+ }
 128+
104129 return $stats;
105130 }
106131
Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php
@@ -103,6 +103,24 @@
104104 htmlspecialchars( $org )
105105 );
106106
 107+ $lang = $this->getLanguage();
 108+
 109+ $stats['students'] = htmlspecialchars( $lang->formatNum( $course->getField( 'students' ) ) );
 110+
 111+ $stats['status'] = wfMsgHtml( $course->getField( 'active' ) ? 'ep-course-active' : 'ep-course-inactive' );
 112+
 113+ $termCount = EPTerm::count( array( 'course_id' => $course->getId() ) );
 114+ $stats['terms'] = htmlspecialchars( $lang->formatNum( $termCount ) );
 115+
 116+ if ( $termCount > 0 ) {
 117+ $stats['terms'] = Linker::linkKnown(
 118+ SpecialPage::getTitleFor( 'Terms' ),
 119+ $stats['terms'],
 120+ array(),
 121+ array( 'course_id' => $course->getId() )
 122+ );
 123+ }
 124+
107125 return $stats;
108126 }
109127
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -224,8 +224,15 @@
225225 'specialinstitution-summary-name' => 'Name',
226226 'specialinstitution-summary-city' => 'City',
227227 'specialinstitution-summary-country' => 'Country',
 228+ 'specialinstitution-summary-status' => 'Status',
 229+ 'specialinstitution-summary-courses' => 'Course count',
 230+ 'specialinstitution-summary-terms' => 'Term count',
 231+ 'specialinstitution-summary-students' => 'Student count',
 232+ 'specialinstitution-summary-ambassadors' => 'Ambassador count',
228233 'ep-institution-nav-edit' => 'Edit this institution',
229234 'ep-institution-add-course' => 'Add a course',
 235+ 'ep-institution-inactive' => 'Inactive',
 236+ 'ep-institution-active' => 'Active',
230237
231238 // Special:Course
232239 'ep-course-title' => 'Course: $1',
@@ -234,9 +241,14 @@
235242 'ep-course-create' => 'There is no course with name "$1" yet, but you can create it.',
236243 'specialcourse-summary-name' => 'Name',
237244 'specialcourse-summary-org' => 'Institution',
 245+ 'specialcourse-summary-students' => 'Student count',
 246+ 'specialcourse-summary-status' => 'Status',
238247 'ep-course-description' => 'Description',
239248 'ep-course-nav-edit' => 'Edit this course',
240249 'ep-course-add-term' => 'Add a term',
 250+ 'ep-course-inactive' => 'Inactive',
 251+ 'ep-course-active' => 'Active',
 252+ 'specialcourse-summary-terms' => 'Term count',
241253
242254 // Special:Term
243255 'ep-term-title' => 'Term: $1',

Status & tagging log