• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/View/Helper/PaginationControl.php

00001 <?php
00028 class Zend_View_Helper_PaginationControl
00029 {
00035     public $view = null;
00036 
00042     protected static $_defaultViewPartial = null;
00043 
00050     public function setView(Zend_View_Interface $view)
00051     {
00052         $this->view = $view;
00053         return $this;
00054     }
00055 
00061     public static function setDefaultViewPartial($partial)
00062     {
00063         self::$_defaultViewPartial = $partial;
00064     }
00065 
00071     public static function getDefaultViewPartial()
00072     {
00073         return self::$_defaultViewPartial;
00074     }
00075 
00088     public function paginationControl(Zend_Paginator $paginator = null, $scrollingStyle = null, $partial = null, $params = null)
00089     {
00090         if ($paginator === null) {
00091             if (isset($this->view->paginator) and $this->view->paginator !== null and $this->view->paginator instanceof Zend_Paginator) {
00092                 $paginator = $this->view->paginator;
00093             } else {
00097                 require_once 'Zend/View/Exception.php';
00098 
00099                 throw new Zend_View_Exception('No paginator instance provided or incorrect type');
00100             }
00101         }
00102 
00103         if ($partial === null) {
00104             if (self::$_defaultViewPartial === null) {
00108                 require_once 'Zend/View/Exception.php';
00109 
00110                 throw new Zend_View_Exception('No view partial provided and no default set');
00111             }
00112 
00113             $partial = self::$_defaultViewPartial;
00114         }
00115 
00116         $pages = get_object_vars($paginator->getPages($scrollingStyle));
00117 
00118         if ($params !== null) {
00119             $pages = array_merge($pages, (array) $params);
00120         }
00121 
00122         if (is_array($partial)) {
00123             if (count($partial) != 2) {
00127                 require_once 'Zend/View/Exception.php';
00128 
00129                 throw new Zend_View_Exception('A view partial supplied as an array must contain two values: the filename and its module');
00130             }
00131 
00132             if ($partial[1] !== null) {
00133                 return $this->view->partial($partial[0], $partial[1], $pages);
00134             }
00135 
00136             $partial = $partial[0];
00137         }
00138 
00139         return $this->view->partial($partial, $pages);
00140     }
00141 }

Generated on Thu Apr 19 2012 17:01:18 for openbiz by  doxygen 1.7.2