function ResNavigationRet($form_name, $short = 0, $function = '', $aVar = '') { global $p_num; global $page; global $_page; global $p_per_page; global $page_first_p; global $pages_num; global $logged; global $oTemplConfig; global $gallery_view; $pages_around = 5; if (!is_array($aVar)) { $per_page_array = array(10, 15, 20, 30, 50); } else { $per_page_array = $aVar; } if ($logged['admin']) { array_push($per_page_array, 100); } if (!$function) { $get_vars_controls = get_vars_controls(1, 0, 1, 1, 1); $get_vars = get_vars(0, 1, 1, 1, 0); } else { $func = create_function('', $function); $get_vars = $func(); } $gallery_view = (int) $gallery_view; ob_start(); if ($p_num) { ?> <form name="<?php echo 'NavForm' . $form_name; ?> " id="<?php echo 'NavForm' . $form_name; ?> " method="get" action="<?php echo $_SERVER['PHP_SELF']; ?> " style="margin: 0px;"> <?php echo $get_vars_controls; ?> <table class="text2" cellpadding="0" cellspacing="0" border="0"> <?php if (!$short) { ?> <tr> <td><?php echo _t("_Results"); ?> : <b><?php echo (int) $page_first_p; ?> </b>-<b><?php echo min((int) ($page_first_p + $p_per_page - 1), (int) $p_num); ?> </b> | <?php echo _t("Total"); ?> : <b><?php echo (int) $p_num; ?> </b></td> <td> | <?php echo _t("_Results per page"); ?> : </td> <td> <select name="p_per_page" onchange="javascript: document.forms['<?php echo 'NavForm' . $form_name; ?> '].submit();"> <?php foreach ($per_page_array as $per_page_elem) { echo "<option value=\"{$per_page_elem}\" " . ($p_per_page == $per_page_elem ? 'selected="selected"' : '') . ">{$per_page_elem}</option>"; } ?> </select> </td> <td> </td> </tr> <?php } ?> <tr> <td align="center" colspan="3"> <?php echo _t('_Pages'); ?> : <?php if ($page > 1) { echo "\n\t\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}{$get_vars}page=1&gallery_view={$gallery_view}\">" . _t("_First") . "</a> | \n\t\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}{$get_vars}page=" . (int) ($page - 1) . "&gallery_view={$gallery_view}\">" . _t("_Prev") . "</a> | "; } // print all previous pages for ($i = max($page - $pages_around, 1); $i < $page; $i++) { echo "\n\t\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}{$get_vars}page={$i}&gallery_view={$gallery_view}\">{$i}</a> "; } // print current page echo "\n\t\t\t\t\t\t[{$page}] "; // print all next pages for ($i = $page + 1; $i <= min($page + $pages_around, $pages_num); $i++) { echo "\n\t\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}{$get_vars}page={$i}&gallery_view={$gallery_view}\">{$i}</a> "; } if ($page < $pages_num) { echo "\n\t\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}{$get_vars}page=" . (int) ($page + 1) . "&gallery_view={$gallery_view}\">" . _t("_Next") . "</a> | \n\t\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}{$get_vars}page={$pages_num}&gallery_view={$gallery_view}\">" . _t("_Last") . "</a>"; } ?> </td> <?php // print gallery option for search page if ($_page['name_index'] == 32 && $oTemplConfig->show_gallery_link_in_page_navigation) { if ($gallery_view) { echo "\n\t\t\t\t\t<td style=\"padding-left: 10px;\"><a href=\"{$_SERVER['PHP_SELF']}{$get_vars}page={$page}&gallery_view=0\">" . _t("_view as profile details") . "</a></td>"; } else { echo "\n\t\t\t\t\t<td style=\"padding-left: 10px;\"><a href=\"{$_SERVER['PHP_SELF']}{$get_vars}page={$page}&gallery_view=1\">" . _t("_view as photo gallery") . "</a></td>"; } } else { echo "\n\t\t\t\t\t<td> </td>"; } ?> </tr> </table> </form> <?php } $ret = ob_get_contents(); ob_end_clean(); return $ret; }
/** * Place HTML code for Sorting */ function PageCompSorting() { global $p_num; global $site; //ob_start(); $ret = ''; $ret .= "<!-- Sorting -->\n"; $ret .= '<form method="get" action="search_result.php' . get_vars() . '">'; if ($_REQUEST['sortby']) { $sort_sel_age = $_REQUEST['sortby'] == 'Sort_By_Age' ? 'checked="checked"' : ''; $sort_sel_price = $_REQUEST['sortby'] == 'Sort_By_Price' ? 'checked="checked"' : ''; $sort_sel_cont = $_REQUEST['sortby'] == 'Sort_By_Cont' ? 'checked="checked"' : ''; } else { $sort_sel_age = 'checked="checked"'; } $ret .= get_vars_controls(); $ret .= '<table border="0" width="100%" cellspacing="1" cellpadding="2">'; $ret .= '<tr>'; $ret .= '<td align="left"><b>' . _t("_Sort results") . '</b></td>'; $ret .= '<td align="left">'; $ret .= '<input type="radio" name="sortby" value="Sort_By_Age" id="Sort_By_Age" ' . $sort_sel_age . ' /> <label for="Sort_By_Age">' . _t("_by age") . '</label>'; $ret .= '</td>'; $ret .= ' <td align="left"><b>' . _t("_Sort order") . '</b></td>'; $asc_sel = $_GET['sortorder'] == 'ASC' ? 'checked="checked"' : ''; $desc_sel = $asc_sel ? '' : 'checked="checked"'; $ret .= '<td align="left">'; $ret .= '<input type="radio" name="sortorder" value="ASC" id="ASC" ' . $asc_sel . ' /> <label for="ASC">' . _t("_ascending") . '</label>'; $ret .= '</td>'; $ret .= '<td rowspan="2" align="center" valign="middle"><input class=no type=submit value=" ' . _t("_Go") . '! " /></td>'; //$ret .= '<td>'; //$ret .= '</td>'; $ret .= '</tr>'; $ret .= '<tr>'; $ret .= '<td> </td>'; $ret .= '<td align="left">'; $ret .= '<input type="radio" name="sortorder" value="DESC" id="DESC" ' . $desc_sel . ' /> <label for="DESC">' . _t("_descending") . '</label>'; $ret .= '</td>'; $ret .= '</tr>'; $ret .= '</table>'; $ret .= '</form>'; $ret .= "\n<!-- /Sorting -->\n"; return DesignBoxContentBorder(_t("_sort"), $ret); }