r111908 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111907‎ | r111908 | r111909 >
Date:02:34, 20 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed pager filter option session issue
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/maintenance/importWEPData.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/maintenance/importWEPData.php
@@ -72,9 +72,9 @@
7373 $courseIds = $this->insertCourses( $courses, $orgs );
7474 echo "Inserted courses\n";
7575
76 - echo "Inserting students ...\n";
77 - $this->insertStudents( $students, $courseIds );
78 - echo "Inserted students\n";
 76+// echo "Inserting students ...\n";
 77+// $this->insertStudents( $students, $courseIds );
 78+// echo "Inserted students\n";
7979
8080 echo "Import completed!\n\n";
8181 }
Index: trunk/extensions/EducationProgram/includes/EPPager.php
@@ -309,6 +309,19 @@
310310 }
311311
312312 $this->addFilterValues( $filterOptions );
 313+
 314+ foreach ( $filterOptions as $key => $optionData ) {
 315+ if ( array_key_exists( 'datatype', $optionData ) ) {
 316+ switch ( $optionData['datatype'] ) {
 317+ case 'int':
 318+ $filterOptions[$key]['value'] = (int)$optionData['value'];
 319+ break;
 320+ case 'float':
 321+ $filterOptions[$key]['value'] = (float)$optionData['value'];
 322+ break;
 323+ }
 324+ }
 325+ }
313326
314327 if ( $hideWhenNoResults && $this->getNumRows() < 1 ) {
315328 $noFiltersSet = array_reduce( $filterOptions, function( $current, array $data ) {
@@ -364,30 +377,18 @@
365378 * @since 0.1
366379 *
367380 * @param array $filterOptions
368 - * @param boolean $cast Should values with non-string type be casted (ie to have a select with int values have the correct val selected).
369381 *
370382 * @return boolean If anything was changed from the default
371383 */
372 - protected function addFilterValues( array &$filterOptions, $cast = true ) {
 384+ protected function addFilterValues( array &$filterOptions ) {
373385 $req = $this->getRequest();
374386 $changed = false;
375387
376388 foreach ( $filterOptions as $optionName => &$optionData ) {
377389 if ( $req->getCheck( $this->filterPrefix . $optionName ) ) {
378390 $optionData['value'] = $req->getVal( $this->filterPrefix . $optionName );
379 -
380 - if ( $cast && array_key_exists( 'datatype', $optionData ) ) {
381 - switch ( $optionData['datatype'] ) {
382 - case 'int':
383 - $optionData['value'] = (int)$optionData['value'];
384 - break;
385 - case 'float':
386 - $optionData['value'] = (float)$optionData['value'];
387 - break;
388 - }
389 - }
390 -
391 - if ( array_key_exists( $optionName, $_POST ) && $optionData['value'] !== '' ) {
 391+
 392+ if ( array_key_exists( $optionName, $_POST ) ) {
392393 $req->setSessionData( $this->getNameForSession( $optionName ), $optionData['value'] );
393394 }
394395

Status & tagging log