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