From: Alexandre Emsenhuber Date: Thu, 18 Apr 2013 12:59:04 +0000 (+0200) Subject: Move list generation out of TablePager::getLimitSelect() X-Git-Tag: 1.31.0-rc.0~19854^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=8413b4ba33284d3e68c95294e088621462a2a65d;p=lhc%2Fweb%2Fwiklou.git Move list generation out of TablePager::getLimitSelect() Added TablePager::getLimitSelectList() to get the list of values to show for the drop-down so that it can be used to generate a custom " element of limits. + * This can be passed directly to XmlSelect::addOptions(). + * + * @since 1.22 + * @return array + */ + public function getLimitSelectList() { # Add the current limit from the query string # to avoid that the limit is lost after clicking Go next time if ( !in_array( $this->mLimit, $this->mLimitsShown ) ) { $this->mLimitsShown[] = $this->mLimit; sort( $this->mLimitsShown ); } - $s = Html::openElement( 'select', array( 'name' => 'limit' ) ) . "\n"; + $ret = array(); foreach ( $this->mLimitsShown as $key => $value ) { # The pair is either $index => $limit, in which case the $value # will be numeric, or $limit => $text, in which case the $value @@ -1174,10 +1187,9 @@ abstract class TablePager extends IndexPager { $limit = $key; $text = $value; } - $s .= Xml::option( $text, $limit, $limit == $this->mLimit ) . "\n"; + $ret[$text] = $limit; } - $s .= Html::closeElement( 'select' ); - return $s; + return $ret; } /**