https://www.mediawiki.org/wiki/Special:Code/MediaWiki/111908
Revision: 111908
Author: jeroendedauw
Date: 2012-02-20 02:34:49 +0000 (Mon, 20 Feb 2012)
Log Message:
-----------
fixed pager filter option session issue
Modified Paths:
--------------
trunk/extensions/EducationProgram/includes/EPPager.php
trunk/extensions/EducationProgram/maintenance/importWEPData.php
Modified: trunk/extensions/EducationProgram/includes/EPPager.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPPager.php 2012-02-20
02:14:42 UTC (rev 111907)
+++ trunk/extensions/EducationProgram/includes/EPPager.php 2012-02-20
02:34:49 UTC (rev 111908)
@@ -309,6 +309,19 @@
}
$this->addFilterValues( $filterOptions );
+
+ foreach ( $filterOptions as $key => $optionData ) {
+ if ( array_key_exists( 'datatype', $optionData ) ) {
+ switch ( $optionData['datatype'] ) {
+ case 'int':
+ $filterOptions[$key]['value'] =
(int)$optionData['value'];
+ break;
+ case 'float':
+ $filterOptions[$key]['value'] =
(float)$optionData['value'];
+ break;
+ }
+ }
+ }
if ( $hideWhenNoResults && $this->getNumRows() < 1 ) {
$noFiltersSet = array_reduce( $filterOptions, function(
$current, array $data ) {
@@ -364,30 +377,18 @@
* @since 0.1
*
* @param array $filterOptions
- * @param boolean $cast Should values with non-string type be casted
(ie to have a select with int values have the correct val selected).
*
* @return boolean If anything was changed from the default
*/
- protected function addFilterValues( array &$filterOptions, $cast = true
) {
+ protected function addFilterValues( array &$filterOptions ) {
$req = $this->getRequest();
$changed = false;
foreach ( $filterOptions as $optionName => &$optionData ) {
if ( $req->getCheck( $this->filterPrefix . $optionName
) ) {
$optionData['value'] = $req->getVal(
$this->filterPrefix . $optionName );
-
- if ( $cast && array_key_exists( 'datatype',
$optionData ) ) {
- switch ( $optionData['datatype'] ) {
- case 'int':
- $optionData['value'] =
(int)$optionData['value'];
- break;
- case 'float':
- $optionData['value'] =
(float)$optionData['value'];
- break;
- }
- }
-
- if ( array_key_exists( $optionName, $_POST ) &&
$optionData['value'] !== '' ) {
+
+ if ( array_key_exists( $optionName, $_POST ) ) {
$req->setSessionData(
$this->getNameForSession( $optionName ), $optionData['value'] );
}
Modified: trunk/extensions/EducationProgram/maintenance/importWEPData.php
===================================================================
--- trunk/extensions/EducationProgram/maintenance/importWEPData.php
2012-02-20 02:14:42 UTC (rev 111907)
+++ trunk/extensions/EducationProgram/maintenance/importWEPData.php
2012-02-20 02:34:49 UTC (rev 111908)
@@ -72,9 +72,9 @@
$courseIds = $this->insertCourses( $courses, $orgs );
echo "Inserted courses\n";
- echo "Inserting students ...\n";
- $this->insertStudents( $students, $courseIds );
- echo "Inserted students\n";
+// echo "Inserting students ...\n";
+// $this->insertStudents( $students, $courseIds );
+// echo "Inserted students\n";
echo "Import completed!\n\n";
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs