Ticket #37: QPaginatorBase.diff
| File QPaginatorBase.diff, 2.8 kB (added by fa7ll7en, 5 months ago) |
|---|
-
QPaginatorBase.class.php
11 11 * @property integer $ItemsPerPage is how many items you want to display per page when Pagination is enabled 12 12 * @property integer $PageNumber is the current page number you are viewing 13 13 * @property integer $TotalItemCount is the total number of items in the ENTIRE recordset -- only used when Pagination is enabled 14 * @property string $QueryVar is the name for the query variable for paginator links so that Pagination is accessible without JS -- feel free to change 14 15 * @property boolean $UseAjax 15 16 * @property-read integer $PageCount 16 17 * @property mixed $WaitIcon … … 25 26 protected $intItemsPerPage = 15; 26 27 protected $intPageNumber = 1; 27 28 protected $intTotalItemCount = 0; 29 protected $strQueryVar = 'paginator'; 28 30 protected $blnUseAjax = false; 29 31 protected $objPaginatedControl; 30 32 protected $objWaitIcon = 'default'; … … 44 46 } 45 47 46 48 $this->Setup(); 49 $this->SetPageNumber(); 47 50 } 48 51 49 protected function Setup() 50 { 52 protected function Setup() { 51 53 // Setup Pagination Events 52 54 if ($this->blnUseAjax) 53 55 $this->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'Page_Click', $this->objWaitIcon)); … … 65 67 $this->objPaginatedControl->PageNumber = QType::Cast($strParameter, QType::Integer); 66 68 } 67 69 70 public function SetPageNumber() { 71 if (!QApplication::$RequestMode && QApplication::QueryString($this->strQueryVar) != null) { 72 $strParameter = QApplication::QueryString($this->strQueryVar); 73 $this->PageNumber = QType::Cast($strParameter, QType::Integer); 74 } 75 } 76 77 // build the query string 78 public function SetPaginatorHref(){ 79 $_GET[$this->strQueryVar] = $this->strActionParameter; //$strActionParameter; 80 return QApplication::GenerateQueryString(); 81 } 82 68 83 public function SetPaginatedControl(QPaginatedControl $objPaginatedControl) { 69 84 $this->objPaginatedControl = $objPaginatedControl; 70 85 … … 83 98 case "ItemsPerPage": return $this->intItemsPerPage; 84 99 case "PageNumber": return $this->intPageNumber; 85 100 case "TotalItemCount": return $this->intTotalItemCount; 101 case 'QueryVar':return $this->strQueryVar; 86 102 case "UseAjax": return $this->blnUseAjax; 87 103 case "PageCount": 88 104 return floor($this->intTotalItemCount / $this->intItemsPerPage) + … … 147 163 $objExc->IncrementOffset(); 148 164 throw $objExc; 149 165 } 166 167 case 'QueryVar': 168 try { 169 return ($this->strQueryVar = QType::Cast($mixValue, QType::String)); 170 } catch (QCallerException $objExc) { 171 $objExc->IncrementOffset(); 172 throw $objExc; 173 } 150 174 151 175 case "UseAjax": 152 176 try {
