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