Permalink
Browse files

DataRepearter paginator improvement

  • Loading branch information...
1 parent ea57d3b commit fecdd0455972cc3443212eda3949088c6592d9c8 Lena committed Jan 30, 2012
Showing with 38 additions and 14 deletions.
  1. +8 −13 assets/asset_edit.tpl.php
  2. +30 −1 includes/qcodo/qform/QPaginator.class.php
View
@@ -41,19 +41,14 @@
<?php if (!$this->intTransactionTypeId && QApplication::QueryString('intAssetId')) { ?>
<br class="item_divider" />
<?php
- $this->lblAssetHistory->Render();
- $historyCount = AssetTransaction::CountAssetTransaction($this->ctlAssetEdit->objAsset->AssetId);
- if ($historyCount>0){
- ?>
- <div class="dtr_results">
- <?php $this->dtrAssetHistory->Paginator->Render(); ?>
- </div>
- <?php $this->dtrAssetHistory->Render();
- }
- else { ?>
- <div class="dtr_results"><b>Results:</b> No items found.</div>
- <?php
- } ?>
+ //$this->dtrAssetHistory->renderWithResults = true;
+ $this->lblAssetHistory->Render();
+ $this->dtrAssetHistory->Paginator->renderWithResults = true;
+ $this->dtrAssetHistory->Paginator->Render();
+ ?>
+
+ <?php $this->dtrAssetHistory->Render(); ?>
+
<br class="item_divider" />
<?php $this->lblChildAssets->Render(); ?>
<?php $this->pnlAddChildAsset->Render(); ?>
View
@@ -1,5 +1,6 @@
<?php
class QPaginator extends QPaginatorBase {
+ public $renderWithResults = false;
// APPEARANCE
protected $intIndexCount = 10;
@@ -18,9 +19,11 @@ public function __construct($objParentObject, $strControlId = null) {
$this->strLabelForNext = QApplication::Translate('Next');
}
+ public function RenderWithResults(){
+
+ }
public function GetControlHtml() {
$this->objPaginatedControl->DataBind();
-
$strStyle = $this->GetStyleAttributes();
if ($strStyle)
$strStyle = sprintf(' style="%s"', $strStyle);
@@ -160,6 +163,32 @@ public function GetControlHtml() {
$strToReturn .= '</span>';
+ if($this->renderWithResults) {
+ $results ='';
+ if($this->intTotalItemCount>0){
+ $startItem = ($this->intPageNumber-1)*$this->intItemsPerPage+1;
+ $this->intTotalItemCount < $this->intPageNumber*$this->intItemsPerPage ?
+ $endItem = $this->intTotalItemCount:
+ $endItem = $this->intPageNumber*$this->intItemsPerPage;
+ $results = sprintf(' Viewing %s-%s of %s',
+ $startItem,
+ $endItem,
+ $this->intTotalItemCount
+ );
+ }
+ else {
+ $results = ' No items found.';
+ }
+ $strToReturn = sprintf('<div class="dtr_results">
+ <div style="float:left;"><b>Results:</b>%s</div>
+ <div style="float:right;">%s</div>
+ <div style="clear: both;"></div>
+ </div>
+
+ ',
+ $results,$strToReturn);
+ }
+
return $strToReturn;
}

0 comments on commit fecdd04

Please sign in to comment.