[Phpcms-plugins-cvs] events4phpCMS class.events4phpcms.php,1.1,1.2
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2005-02-23 23:57:37
|
Update of /cvsroot/phpcms-plugins/events4phpCMS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13522 Modified Files: class.events4phpcms.php Log Message: added sorting of events with a timeline Index: class.events4phpcms.php =================================================================== RCS file: /cvsroot/phpcms-plugins/events4phpCMS/class.events4phpcms.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- class.events4phpcms.php 15 Feb 2005 12:13:24 -0000 1.1 +++ class.events4phpcms.php 23 Feb 2005 23:57:16 -0000 1.2 @@ -27,6 +27,9 @@ /* * $Log$ +* Revision 1.2 2005/02/23 23:57:16 mjahn +* added sorting of events with a timeline +* * Revision 1.1 2005/02/15 12:13:24 mjahn * initial import * @@ -67,10 +70,13 @@ } $ids = array_keys ($this->events); + sort ($ids); + for ($i = $start; $i < $start + $this->maxEntriesPerPage && $i < count ($this->events); $i++) { $id = $ids [$i]; $this->_showEvent ($id, $this->events [$id]); } + $this->_showNavigation ($start, $i, count ($this->events)); } /** @@ -211,5 +217,33 @@ } echo '</dl>'; } + + function _showNavigation ($start, $end, $max) { + echo '<h2> </h2>'; + echo '<ul class="horizontal center trenner">'; + if ($start > 0) { + // show prev-link in navigation + if ($start > $this->maxEntriesPerPage) { + $prev = $start - $this->maxEntriesPerPage; + } else { + $prev = 0; + } + echo '<li><a href="?start='.$prev.'">Vorherige Seite</a></li>'; + } else { + echo '<li>Vorherige Seite</li>'; + } + + echo '<li>Zeige Events '.$start.' bis '.$end.' von '.$max.'</li>'; + + if ($end < $max) { + // show next-link in navigation + $next = $end + 1; + echo '<li><a href="?start='.$next.'">Folgende Seite</a></li>'; + } else { + echo '<li>Folgende Seite</li>'; + } + + echo '</ul>'; + } } ?> \ No newline at end of file |