Index: trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php |
— | — | @@ -50,14 +50,16 @@ |
51 | 51 | * |
52 | 52 | * @return string |
53 | 53 | */ |
54 | | - protected function displayCachedContent() { |
| 54 | + public function displayCachedContent() { |
| 55 | + $duration = EPSettings::get( 'recentActivityLimit' ); |
| 56 | + |
55 | 57 | $conds = array( 'last_active > ' . wfGetDB( DB_SLAVE )->addQuotes( |
56 | | - wfTimestamp( TS_MW, time() - ( EPSettings::get( 'recentActivityLimit' ) ) ) |
| 58 | + wfTimestamp( TS_MW, time() - $duration ) |
57 | 59 | ) ); |
58 | 60 | |
59 | | - return $this->displayStudentMeter( $conds ) . |
| 61 | + return $this->displayStudentMeter( $conds, $duration ) . |
60 | 62 | '<br />' . |
61 | | - $this->displayPager( $conds ); |
| 63 | + $this->displayPager( $conds, $duration ); |
62 | 64 | } |
63 | 65 | |
64 | 66 | /** |
— | — | @@ -69,7 +71,7 @@ |
70 | 72 | * |
71 | 73 | * @return string |
72 | 74 | */ |
73 | | - public function displayPager( array $conds ) { |
| 75 | + public function displayPager( array $conds, $duration ) { |
74 | 76 | $pager = new EPStudentActivityPager( $this->getContext(), $conds ); |
75 | 77 | |
76 | 78 | if ( $pager->getNumRows() ) { |
— | — | @@ -83,7 +85,7 @@ |
84 | 86 | else { |
85 | 87 | $html = $pager->getFilterControl( true ) |
86 | 88 | . '<br />' |
87 | | - . wfMsgExt( 'ep-studentactivity-noresults', 'parseinline' ); |
| 89 | + . wfMsgExt( 'ep-studentactivity-noresults', 'parseinline', EPUtils::formatDuration( $duration, array( 'hours' ) ) ); |
88 | 90 | } |
89 | 91 | |
90 | 92 | return '<div class="studentactivity">' . $html . '</div>'; |
— | — | @@ -95,10 +97,11 @@ |
96 | 98 | * @since 0.1 |
97 | 99 | * |
98 | 100 | * @param array $conds |
| 101 | + * @param integer $duration |
99 | 102 | * |
100 | 103 | * @return string |
101 | 104 | */ |
102 | | - public function displayStudentMeter( array $conds ) { |
| 105 | + public function displayStudentMeter( array $conds, $duration ) { |
103 | 106 | $studentCount = EPStudents::singleton()->count( $conds ); |
104 | 107 | |
105 | 108 | if ( $studentCount < 10 ) { |
— | — | @@ -108,7 +111,7 @@ |
109 | 112 | $image = min( round( $studentCount / 10 ) * 10, 60 ); |
110 | 113 | } |
111 | 114 | |
112 | | - $message = $this->msg( 'ep-studentactivity-count', $studentCount )->escaped(); |
| 115 | + $message = $this->msg( 'ep-studentactivity-count', $studentCount, EPUtils::formatDuration( $duration, array( 'hours' ) ) )->escaped(); |
113 | 116 | |
114 | 117 | return Html::element( 'img', array( |
115 | 118 | 'src' => EPSettings::get( 'imageDir' ) . 'student-o-meter_morethan-' . $image . '.png', |
Index: trunk/extensions/EducationProgram/includes/EPUtils.php |
— | — | @@ -270,4 +270,9 @@ |
271 | 271 | return $article->fetchContent(); |
272 | 272 | } |
273 | 273 | |
| 274 | + public static function formatDuration( $seconds, $units = array( 'days', 'hours', 'minutes', 'seconds' ) ) { |
| 275 | + // TODO: compat |
| 276 | + return $GLOBALS['wgLang']->formatDuration( $seconds, $units ); |
| 277 | + } |
| 278 | + |
274 | 279 | } |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -776,10 +776,10 @@ |
777 | 777 | 'epca-visible' => 'Publicly list me as Campus Ambassador', |
778 | 778 | |
779 | 779 | // Special:StudentActivity |
780 | | - 'ep-studentactivity-noresults' => 'There are no students that where active in the last 24 hours :( |
| 780 | + 'ep-studentactivity-noresults' => 'There are no students that where active in the last $1 :( |
781 | 781 | |
782 | 782 | You can find a full list of students on [[Special:Students|the student list]].', |
783 | | - 'ep-studentactivity-count' => 'There {{PLURAL:$1|is|are}} currently $1 {{PLURAL:$1|student|students}} that {{PLURAL:$1|was|where}} active in the last 24 hours.', |
| 783 | + 'ep-studentactivity-count' => '{{PLURAL:$1|One student was|$1 students were}} active in the last $2.', |
784 | 784 | |
785 | 785 | // Cached special page, back compat for MW < 1.20 |
786 | 786 | 'cachedspecial-viewing-cached-ttl' => 'You are viewing a cached version of this page, which can be up to $1 old.', |