예제 #1
1
 public function pagerDirective($construction)
 {
     if ($this->_pagerBlock instanceof Mage_Page_Block_Html_Pager) {
         if (null === $this->_pagerBlock->getCollection()) {
             $params = $this->_getIncludeParameters($construction[2]);
             foreach ($params as $key => $value) {
                 switch ($key) {
                     case 'limits':
                         $limits = array_filter(explode("|", $value), 'is_numeric');
                         $limits = array_combine($limits, $limits);
                         $this->_pagerBlock->setAvailableLimit($limits);
                         break;
                     case 'frame_length':
                         $value = (int) $value;
                         if (0 > $value) {
                             $value = null;
                         }
                     case 'limit_var_name':
                     case 'page_var_name':
                         if (isset($value)) {
                             $method = 'set' . uc_words($key, '');
                             if (is_callable(array($this->_pagerBlock, $method))) {
                                 $this->_pagerBlock->{$method}($value);
                             }
                         }
                         break;
                 }
             }
             $this->_pagerBlock->setCollection($this->getCollection());
         }
         return $this->_pagerBlock->toHtml();
     }
     return '';
 }