Page 1 of 1

Previous/Next links on event view

Posted: Sun Sep 12, 2004 12:05 pm
by unclerichy
Below is a snippet of PHP which adds 'previous' and 'next' links to the page selector in events view.

For example:

<< 1 2 - 3 - 4 5 7 9 >>

Apply this to zm_html_view_events.php. If you have trouble due to formatting, I've made it available at http://www.hunter13.com/zm_navigation.diff

Code: Select all

*** zm_html_view_events.php	2004-09-12 13:00:43.000000000 +0100
--- /root/software/extract/zm-1.19.3/web/zm_html_view_events.php	2004-04-21 10:20:28.000000000 +0100
***************
*** 193,201 ****
  
  			if ( $page > 1 )
  			{
- ?>
- 				<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page - 1 ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>"><<</a>
- <?php
  				$new_pages = array();
  				$pages_used = array();
  				$lo_exp = max(2,log($page-1)/log($max_shortcuts));
--- 193,198 ----
***************
*** 218,224 ****
  <a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $new_page ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>"><?= $new_page ?></a>&nbsp;
  <?php
  				}
- 
  			}
  ?>
  -&nbsp;<?= $page ?>&nbsp;-
--- 215,220 ----
***************
*** 247,255 ****
  &nbsp;<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $new_page ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>"><?= $new_page ?></a>
  <?php
  				}
- ?>
- 				<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page + 1 ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>">>></a>
- <?php
  			}
  ?>
  </td>
--- 243,248 ----

Posted: Mon Sep 13, 2004 1:44 pm
by lazyleopard
Needs a -R to apply (at the moment) but it's neat. Thanks. ;)

Posted: Mon Sep 13, 2004 10:57 pm
by zoneminder
Thanks for this. I'll try and remember to add it into the next release.

Phil,