https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114288
Revision: 114288
Author: jeroendedauw
Date: 2012-03-20 17:54:17 +0000 (Tue, 20 Mar 2012)
Log Message:
-----------
Follow up to r114026; fix plural stuff and add in var for the duration
Modified Paths:
--------------
trunk/extensions/EducationProgram/EducationProgram.i18n.php
trunk/extensions/EducationProgram/includes/EPUtils.php
trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php
Modified: trunk/extensions/EducationProgram/EducationProgram.i18n.php
===================================================================
--- trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-03-20
17:44:04 UTC (rev 114287)
+++ trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-03-20
17:54:17 UTC (rev 114288)
@@ -776,10 +776,10 @@
'epca-visible' => 'Publicly list me as Campus Ambassador',
// Special:StudentActivity
- 'ep-studentactivity-noresults' => 'There are no students that where
active in the last 24 hours :(
+ 'ep-studentactivity-noresults' => 'There are no students that where
active in the last $1 :(
You can find a full list of students on [[Special:Students|the student
list]].',
- '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.',
+ 'ep-studentactivity-count' => '{{PLURAL:$1|One student was|$1 students
were}} active in the last $2.',
// Cached special page, back compat for MW < 1.20
'cachedspecial-viewing-cached-ttl' => 'You are viewing a cached version
of this page, which can be up to $1 old.',
Modified: trunk/extensions/EducationProgram/includes/EPUtils.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPUtils.php 2012-03-20
17:44:04 UTC (rev 114287)
+++ trunk/extensions/EducationProgram/includes/EPUtils.php 2012-03-20
17:54:17 UTC (rev 114288)
@@ -270,4 +270,9 @@
return $article->fetchContent();
}
+ public static function formatDuration( $seconds, $units = array(
'days', 'hours', 'minutes', 'seconds' ) ) {
+ // TODO: compat
+ return $GLOBALS['wgLang']->formatDuration( $seconds, $units );
+ }
+
}
Modified: trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php
===================================================================
--- trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php
2012-03-20 17:44:04 UTC (rev 114287)
+++ trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php
2012-03-20 17:54:17 UTC (rev 114288)
@@ -50,14 +50,16 @@
*
* @return string
*/
- protected function displayCachedContent() {
+ public function displayCachedContent() {
+ $duration = EPSettings::get( 'recentActivityLimit' );
+
$conds = array( 'last_active > ' . wfGetDB( DB_SLAVE
)->addQuotes(
- wfTimestamp( TS_MW, time() - ( EPSettings::get(
'recentActivityLimit' ) ) )
+ wfTimestamp( TS_MW, time() - $duration )
) );
- return $this->displayStudentMeter( $conds ) .
+ return $this->displayStudentMeter( $conds, $duration ) .
'<br />' .
- $this->displayPager( $conds );
+ $this->displayPager( $conds, $duration );
}
/**
@@ -69,7 +71,7 @@
*
* @return string
*/
- public function displayPager( array $conds ) {
+ public function displayPager( array $conds, $duration ) {
$pager = new EPStudentActivityPager( $this->getContext(),
$conds );
if ( $pager->getNumRows() ) {
@@ -83,7 +85,7 @@
else {
$html = $pager->getFilterControl( true )
. '<br />'
- . wfMsgExt( 'ep-studentactivity-noresults',
'parseinline' );
+ . wfMsgExt( 'ep-studentactivity-noresults',
'parseinline', EPUtils::formatDuration( $duration, array( 'hours' ) ) );
}
return '<div class="studentactivity">' . $html . '</div>';
@@ -95,10 +97,11 @@
* @since 0.1
*
* @param array $conds
+ * @param integer $duration
*
* @return string
*/
- public function displayStudentMeter( array $conds ) {
+ public function displayStudentMeter( array $conds, $duration ) {
$studentCount = EPStudents::singleton()->count( $conds );
if ( $studentCount < 10 ) {
@@ -108,7 +111,7 @@
$image = min( round( $studentCount / 10 ) * 10, 60 );
}
- $message = $this->msg( 'ep-studentactivity-count',
$studentCount )->escaped();
+ $message = $this->msg( 'ep-studentactivity-count',
$studentCount, EPUtils::formatDuration( $duration, array( 'hours' ) )
)->escaped();
return Html::element( 'img', array(
'src' => EPSettings::get( 'imageDir' ) .
'student-o-meter_morethan-' . $image . '.png',
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs