Index: trunk/extensions/EducationProgram/EducationProgram.settings.php |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | 'CZ' => 'Flag of the Czech Republic.svg', |
64 | 64 | ), |
65 | 65 | 'fallbackFlag' => 'Nuvola unknown flag.svg', |
66 | | - 'courseDescPage' => 'Course description', |
| 66 | + 'courseDescPage' => 'MediaWiki:Course description', |
67 | 67 | 'courseOrgDescPage' => '$2/$1', // $1 = org name, $2 = courseDescPage setting |
68 | 68 | ); |
69 | 69 | } |
Index: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php |
— | — | @@ -194,7 +194,16 @@ |
195 | 195 | return $html; |
196 | 196 | } |
197 | 197 | |
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 ) { |
199 | 208 | $html = Html::openElement( 'table', array( 'class' => 'wikitable ep-termbreakdown' ) ); |
200 | 209 | |
201 | 210 | reset( $terms ); |
— | — | @@ -224,6 +233,15 @@ |
225 | 234 | return $html; |
226 | 235 | } |
227 | 236 | |
| 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 | + */ |
228 | 246 | protected function getTermData() { |
229 | 247 | $termNames = EPCourses::singleton()->selectFields( 'term', array(), array( 'DISTINCT' ) ); |
230 | 248 | $terms = array(); |
— | — | @@ -274,6 +292,18 @@ |
275 | 293 | return array( 'terms' => $terms, 'bygender' => $byGender ); |
276 | 294 | } |
277 | 295 | |
| 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 | + */ |
278 | 308 | protected function getByGender( array $students, array $oas, array $cas, array $instructors ) { |
279 | 309 | $genders = $this->getGenders( array_unique( array_merge( $students, $oas, $cas, $instructors ) ) ); |
280 | 310 | |
— | — | @@ -285,6 +315,16 @@ |
286 | 316 | ); |
287 | 317 | } |
288 | 318 | |
| 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 | + */ |
289 | 329 | protected function getGenderDistribution( array $users, array $genders ) { |
290 | 330 | $distribution = array( 'unknown' => 0, 'male' => 0, 'female' => 0 ); |
291 | 331 | |
— | — | @@ -301,7 +341,16 @@ |
302 | 342 | return $distribution; |
303 | 343 | } |
304 | 344 | |
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 ) { |
306 | 355 | $dbr = wfGetDB( DB_SLAVE ); |
307 | 356 | |
308 | 357 | $users = $dbr->select( |
— | — | @@ -320,12 +369,28 @@ |
321 | 370 | return $genders; |
322 | 371 | } |
323 | 372 | |
| 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 | + */ |
324 | 380 | protected function msgTxt() { |
325 | 381 | $args = func_get_args(); |
326 | 382 | 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(); |
328 | 384 | } |
329 | 385 | |
| 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 | + */ |
330 | 395 | protected function prefixKey( $key ) { |
331 | 396 | return 'ep-' . strtolower( $this->mName ) . '-' . $key; |
332 | 397 | } |