r114565 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114564‎ | r114565 | r114566 >
Date:18:17, 28 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
minor fix and docs++
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.settings.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.settings.php
@@ -62,7 +62,7 @@
6363 'CZ' => 'Flag of the Czech Republic.svg',
6464 ),
6565 'fallbackFlag' => 'Nuvola unknown flag.svg',
66 - 'courseDescPage' => 'Course description',
 66+ 'courseDescPage' => 'MediaWiki:Course description',
6767 'courseOrgDescPage' => '$2/$1', // $1 = org name, $2 = courseDescPage setting
6868 );
6969 }
Index: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
@@ -194,7 +194,16 @@
195195 return $html;
196196 }
197197
198 - protected function getByTermTable( $terms ) {
 198+ /**
 199+ * Returns the HTML for the term table.
 200+ *
 201+ * @since 0.1
 202+ *
 203+ * @param array $terms
 204+ *
 205+ * @return string
 206+ */
 207+ protected function getByTermTable( array $terms ) {
199208 $html = Html::openElement( 'table', array( 'class' => 'wikitable ep-termbreakdown' ) );
200209
201210 reset( $terms );
@@ -224,6 +233,15 @@
225234 return $html;
226235 }
227236
 237+ /**
 238+ * Returns the term data.
 239+ * It's an array. Element with key 'terms' contains an array with the terms.
 240+ * Element with key 'bygender' contains gender breakdown data.
 241+ *
 242+ * @since 0.1
 243+ *
 244+ * @return array
 245+ */
228246 protected function getTermData() {
229247 $termNames = EPCourses::singleton()->selectFields( 'term', array(), array( 'DISTINCT' ) );
230248 $terms = array();
@@ -274,6 +292,18 @@
275293 return array( 'terms' => $terms, 'bygender' => $byGender );
276294 }
277295
 296+ /**
 297+ * Returns gender breakdowns for the provided lists of users.
 298+ *
 299+ * @since 0.1
 300+ *
 301+ * @param array $students
 302+ * @param array $oas
 303+ * @param array $cas
 304+ * @param array $instructors
 305+ *
 306+ * @return array
 307+ */
278308 protected function getByGender( array $students, array $oas, array $cas, array $instructors ) {
279309 $genders = $this->getGenders( array_unique( array_merge( $students, $oas, $cas, $instructors ) ) );
280310
@@ -285,6 +315,16 @@
286316 );
287317 }
288318
 319+ /**
 320+ * Returns a gender breakdown for the provided users and their associated genders.
 321+ *
 322+ * @since 0.1
 323+ *
 324+ * @param array $users The users
 325+ * @param array $genders An array mapping user id to gender
 326+ *
 327+ * @return array
 328+ */
289329 protected function getGenderDistribution( array $users, array $genders ) {
290330 $distribution = array( 'unknown' => 0, 'male' => 0, 'female' => 0 );
291331
@@ -301,7 +341,16 @@
302342 return $distribution;
303343 }
304344
305 - protected function getGenders( $userIds ) {
 345+ /**
 346+ * Returns the genders for the provided user ids.
 347+ *
 348+ * @since 0.1
 349+ *
 350+ * @param array $userIds
 351+ *
 352+ * @return array
 353+ */
 354+ protected function getGenders( array $userIds ) {
306355 $dbr = wfGetDB( DB_SLAVE );
307356
308357 $users = $dbr->select(
@@ -320,12 +369,28 @@
321370 return $genders;
322371 }
323372
 373+ /**
 374+ * Returns the message text for the provided message key after the key gets prefixed.
 375+ *
 376+ * @since 0.1
 377+ *
 378+ * @return string
 379+ */
324380 protected function msgTxt() {
325381 $args = func_get_args();
326382 array_unshift( $args, $this->prefixKey( array_shift( $args ) ) );
327 - return call_user_func_array( array( $this, 'msg' ), $args );
 383+ return call_user_func_array( array( $this, 'msg' ), $args )->text();
328384 }
329385
 386+ /**
 387+ * Returns the prefixed version of the provided message key.
 388+ *
 389+ * @since 0.1
 390+ *
 391+ * @param string $key
 392+ *
 393+ * @return string
 394+ */
330395 protected function prefixKey( $key ) {
331396 return 'ep-' . strtolower( $this->mName ) . '-' . $key;
332397 }

Status & tagging log