r106703 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106702‎ | r106703 | r106704 >
Date:21:39, 19 December 2011
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
Follow up to r106702; fix casting issue
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPPager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPPager.php
@@ -136,7 +136,7 @@
137137 $conds = array();
138138
139139 $filterOptions = $this->getFilterOptions();
140 - $this->addFilterValues( $filterOptions );
 140+ $this->addFilterValues( $filterOptions, false );
141141
142142 foreach ( $filterOptions as $optionName => $optionData ) {
143143 if ( array_key_exists( 'value', $optionData ) && $optionData['value'] !== '' ) {
@@ -261,10 +261,11 @@
262262 * @since 0.1
263263 *
264264 * @param array $filterOptions
 265+ * @param boolean $cast Should values with non-string type be casted (ie to have a select with int values have the correct val selected).
265266 *
266267 * @return boolean If anything was changed from the default
267268 */
268 - protected function addFilterValues( array &$filterOptions ) {
 269+ protected function addFilterValues( array &$filterOptions, $cast = true ) {
269270 $req = $this->getRequest();
270271 $changed = false;
271272
@@ -274,7 +275,7 @@
275276 $req->setSessionData( get_called_class() . $optionName, $optionData['value'] );
276277 $changed = true;
277278
278 - if ( array_key_exists( 'datatype', $optionData ) ) {
 279+ if ( $cast && array_key_exists( 'datatype', $optionData ) ) {
279280 switch ( $optionData['datatype'] ) {
280281 case 'int':
281282 $optionData['value'] = (int)$optionData['value'];

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106702work on course pager and filterjeroendedauw21:35, 19 December 2011

Status & tagging log