71,6 → 71,8 |
* - 'attributes': (html attributes) Tag attributes or |
* HTML attributes (id="foo" pairs), will be inserted in the |
* <select> tag |
* - 'checkMaxLimit': if true, Pager checks if $end is bigger |
* than $totalItems, and doesn't show the extra select options |
* @return string xhtml select box |
* @access public |
*/ |
79,6 → 81,7 |
// FIXME: needs POST support |
$optionText = '%d'; |
$attributes = ''; |
$checkMaxLimit = false; |
if (is_string($extraParams)) { |
//old behavior, BC maintained |
$optionText = $extraParams; |
89,6 → 92,9 |
if (array_key_exists('attributes', $extraParams)) { |
$attributes = $extraParams['attributes']; |
} |
if (array_key_exists('checkMaxLimit', $extraParams)) { |
$checkMaxLimit = $extraParams['checkMaxLimit']; |
} |
} |
|
if (!strstr($optionText, '%d')) { |
105,6 → 111,10 |
} else { |
$selected = $this->pager->_perPage; |
} |
|
if ($checkMaxLimit && $this->pager->_totalItems > 0 && $this->pager->_totalItems < $end) { |
$end = $this->pager->_totalItems; |
} |
|
$tmp = '<select name="'.$this->pager->_sessionVar.'"'; |
if (!empty($attributes)) { |
111,7 → 121,9 |
$tmp .= ' '.$attributes; |
} |
$tmp .= '>'; |
$last = $start; |
for ($i=$start; $i<=$end; $i+=$step) { |
$last = $i; |
$tmp .= '<option value="'.$i.'"'; |
if ($i == $selected) { |
$tmp .= ' selected="selected"'; |
118,7 → 130,7 |
} |
$tmp .= '>'.sprintf($optionText, $i).'</option>'; |
} |
if ($showAllData && $end < $this->pager->_totalItems) { |
if ($showAllData && $last != $this->pager->_totalItems) { |
$tmp .= '<option value="'.$this->pager->_totalItems.'"'; |
if ($this->pager->_totalItems == $selected) { |
$tmp .= ' selected="selected"'; |