code/template/helper/paginator.php
public function limit($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'limit'     => 0,
            'attribs' => array('class' => 'k-form-control'),
            'values'  => array(5, 10, 15, 20, 25, 30, 50, 100)
        ));

        $html     = '';
        $selected = 0;
        $options  = array();
        $values   = ObjectConfig::unbox($config->values);

        if ($config->limit && !in_array($config->limit, $values)) {
            $values[] = $config->limit;
            sort($values);
        }

        foreach($values as $value)
        {
            if($value == $config->limit) {
                $selected = $value;
            }

            $options[] = $this->option(array('label' => $value, 'value' => $value));
        }

        if ($config->limit == $config->total) {
            $options[] = $this->option(array('label' => $this->getObject('translator')->translate('All'), 'value' => 0));
        }

        $html .= $this->optionlist(array('options' => $options, 'name' => 'limit', 'attribs' => $config->attribs, 'selected' => $selected));
        return $html;
    }
public function limit($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'limit'     => 0,
            'attribs' => array('class' => 'k-form-control'),
            'values'  => array(5, 10, 15, 20, 25, 30, 50, 100)
        ));

        $html     = '';
        $selected = 0;
        $options  = array();
        $values   = ObjectConfig::unbox($config->values);

        if ($config->limit && !in_array($config->limit, $values)) {
            $values[] = $config->limit;
            sort($values);
        }

        foreach($values as $value)
        {
            if($value == $config->limit) {
                $selected = $value;
            }

            $options[] = $this->option(array('label' => $value, 'value' => $value));
        }

        if ($config->limit == $config->total) {
            $options[] = $this->option(array('label' => $this->getObject('translator')->translate('All'), 'value' => 0));
        }

        $html .= $this->optionlist(array('options' => $options, 'name' => 'limit', 'attribs' => $config->attribs, 'selected' => $selected));
        return $html;
    }
public function limit ( $ config = array ( ) ) { $ config = new ObjectConfigJson ( $ config ) ; $ config -> append ( array ( 'limit' => 0 , 'attribs' => array ( 'class' => 'k-form-control' ) , 'values' => array ( 5 , 10 , 15 , 20 , 25 , 30 , 50 , 100 ) ) ) ; $ html = '' ; $ selected = 0 ; $ options = array ( ) ; $ values = ObjectConfig :: unbox ( $ config -> values ) ; if ( $ config -> limit && ! in_array ( $ config -> limit , $ values ) ) { $ values [ ] = $ config -> limit ; sort ( $ values ) ; } foreach ( $ values as $ value ) { if ( $ value == $ config -> limit ) { $ selected = $ value ; } $ options [ ] = $ this -> option ( array ( 'label' => $ value , 'value' => $ value ) ) ; } if ( $ config -> limit == $ config -> total ) { $ options [ ] = $ this -> option ( array ( 'label' => $ this -> getObject ( 'translator' ) -> translate ( 'All' ) , 'value' => 0 ) ) ; } $ html .= $ this -> optionlist ( array ( 'options' => $ options , 'name' => 'limit' , 'attribs' => $ config -> attribs , 'selected' => $ selected ) ) ; return $ html ; }
Render a select box with limit values

@param   array|ObjectConfig     $config An optional array with configuration options
@return  string  Html select box
Render a select box with limit values