Author: weaverryan
Date: 2010-02-08 02:19:01 +0100 (Mon, 08 Feb 2010)
New Revision: 27690
Modified:
plugins/sfSympalPlugin/trunk/lib/helper/SympalPagerHelper.php
Log:
[1.4][sfSympalPlugin][1.0] Improving the pager headline language based on how
many results & pages are returned.
Modified: plugins/sfSympalPlugin/trunk/lib/helper/SympalPagerHelper.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/helper/SympalPagerHelper.php
2010-02-08 01:17:52 UTC (rev 27689)
+++ plugins/sfSympalPlugin/trunk/lib/helper/SympalPagerHelper.php
2010-02-08 01:19:01 UTC (rev 27690)
@@ -8,12 +8,30 @@
*/
function get_sympal_pager_header($pager)
{
- return '<div class="sympal_pager_header"><h3>'.
- __('Showing %first% to %last% of %count% total results.', array(
+ if ($pager->getNbResults() == 0)
+ {
+ $txt = __('No results found.');
+ }
+ elseif ($pager->getNbResults() == 1)
+ {
+ $txt = __('One result found.');
+ }
+ elseif ($pager->getLastPage() == 1)
+ {
+ $txt = __('Showing all %count% total results.', array(
+ '%count%' => $pager->getNbResults(),
+ ));
+ }
+ else
+ {
+ $txt = __('Showing %first% to %last% of %count% total results.', array(
'%first%' => $pager->getFirstIndice(),
'%last%' => $pager->getLastIndice(),
- '%count%' => $pager->getNbResults()
- )).'</h3></div>';
+ '%count%' => $pager->getNbResults(),
+ ));
+ }
+
+ return '<div class="sympal_pager_header"><h3>'.$txt.'</h3></div>';
}
/**
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.