Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Request #4416 Add "informative" functions to Core.php
Submitted: 2005-05-24 10:25 UTC
From: post at mark-wiesemann dot de Assigned:
Status: Closed Package: Structures_DataGrid
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2005-05-24 10:25 UTC] post at mark-wiesemann dot de
Description: ------------ Sorry for having another feature request, but I think this is useful also for other users. I'd like to add the following four functions to Core.php: http://www.markwiesemann.de/php/SDG-Core-addition.phps With these functions and the existing getCurrentPage() one can do something like this: echo 'page ' . $dg->getCurrentPage() . ' from ' . $dg->getPageCount() . ', record ' . $dg->getCurrentRecordNumberStart() . ' to ' . $dg->getCurrentRecordNumberEnd() . ' from ' . $dg->getRecordCount(); Having 19 records and 10 records per page, the output would be: - on the first page: page 1 from 2, record 1 to 10 from 19 - on the second page: page 2 from 2, record 11 to 19 from 19 Without a row limit the output would be: page 1 from 1, record 1 to 19 from 19 If the record set is empty, the output would be: page 1 from 1, record 0 to 0 from 0 In my opinion "page 0 from 0" would be better in this case, but getCurrentPage() currently returns 1 - so there would be a BC break (?). I think I have tested all possible cases (empty record set, no row limit, row limit specified) with different DataSources (DBTable, DBQuery, Array) and got in every case the expected result as described above.

Comments

 [2005-05-27 14:44 UTC] asnagy
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.