51ff3226 |
1 | <?php |
2 | |
38927c4d |
3 | function smarty_function_get_movement_params($params,&$smarty) { |
51ff3226 |
4 | |
38927c4d |
5 | if (isset($_POST['listing_amount']) && |
6 | (is_numeric($_POST['listing_amount']))) { |
7 | $listing_amount=$_POST['listing_amount']; |
8 | } elseif (!empty($_SESSION['listing_amount'])) { |
9 | $listing_amount=$_SESSION['listing_amount']; |
10 | } else $listing_amount=DEFAULT_LISTING_AMOUNT; |
51ff3226 |
11 | |
38927c4d |
12 | $smarty->assign('listing_amount',$listing_amount); |
51ff3226 |
13 | |
38927c4d |
14 | if (isset($_POST['get_children_offset']) && |
15 | (is_numeric($_POST['get_children_offset']))) { |
16 | $offset=$_POST['get_children_offset']; |
51ff3226 |
17 | |
38927c4d |
18 | //movement forward and backward |
19 | if ($_POST['get_children_move']=='<') { |
20 | $offset=$offset-$listing_amount; |
21 | if ($offset<0) $offset=0; |
22 | } |
51ff3226 |
23 | |
38927c4d |
24 | elseif ($_POST['get_children_move']=='>') { |
25 | $offset=$offset+$listing_amount; |
26 | } |
51ff3226 |
27 | |
38927c4d |
28 | elseif ($_POST['get_children_move']=='>>') { |
29 | $offset=$children_count-$listing_amount; |
30 | if ($offset<0) $offset=0; |
31 | } |
51ff3226 |
32 | |
38927c4d |
33 | elseif ($_POST['get_children_move']=='<<') { |
34 | $offset=0; |
51ff3226 |
35 | } |
36 | |
51ff3226 |
37 | |
38 | } |
38927c4d |
39 | |
40 | else $offset=0; |
41 | $smarty->assign('offset',$offset); |
42 | |
43 | } |
c0aaf671 |
44 | ?> |