Contacts: Fix paging on list view.
This commit is contained in:
parent
c4fc6ac111
commit
d78e66f11e
|
|
@ -26,6 +26,7 @@
|
|||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/paging.php";
|
||||
if (permission_exists('contact_view')) {
|
||||
//access granted
|
||||
}
|
||||
|
|
@ -39,9 +40,8 @@ else {
|
|||
$text = $language->get();
|
||||
|
||||
//includes and title
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-contacts'];
|
||||
require_once "resources/paging.php";
|
||||
require_once "resources/header.php";
|
||||
|
||||
//get the search criteria
|
||||
$search_all = strtolower(check_str($_GET["search_all"]));
|
||||
|
|
@ -51,26 +51,6 @@ else {
|
|||
$order_by = check_str($_GET["order_by"]);
|
||||
$order = check_str($_GET["order"]);
|
||||
|
||||
//show the content
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align=\"left\" valign=\"top\">\n";
|
||||
echo " <b>".$text['header-contacts']."</b><br>\n";
|
||||
echo " ".$text['description-contacts']."<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td align=\"right\" valign=\"top\">\n";
|
||||
echo " <form method=\"GET\" name=\"frm_search\" action=\"\">\n";
|
||||
echo " <input class=\"formfld\" style='text-align: right;' type=\"text\" name=\"search_all\" value=\"$search_all\">\n";
|
||||
echo " <input class=\"btn\" type=\"submit\" name=\"submit\" value=\"".$text['button-search']."\">\n";
|
||||
if (permission_exists('contact_add')) {
|
||||
echo "<input type='button' class='btn' alt='".$text['button-import']."' onclick=\"window.location='contact_import.php'\" value='".$text['button-import']."'>\n";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
//retrieve current user's assigned groups (uuids)
|
||||
foreach ($_SESSION['groups'] as $group_data) {
|
||||
$user_group_uuids[] = $group_data['group_uuid'];
|
||||
|
|
@ -170,12 +150,6 @@ else {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (strlen($order_by) > 0) {
|
||||
$sql .= "order by ".$order_by." ".$order." ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by contact_organization asc, contact_name_given asc, contact_name_family asc ";
|
||||
}
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
|
|
@ -189,7 +163,7 @@ else {
|
|||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$rows_per_page = 100;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
|
|
@ -198,6 +172,12 @@ else {
|
|||
|
||||
//get the list
|
||||
$sql = str_replace('count(*) as num_rows', '*', $sql); // modify query created above
|
||||
if (strlen($order_by) > 0) {
|
||||
$sql .= "order by ".$order_by." ".$order." ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by contact_organization asc, contact_name_given asc, contact_name_family asc ";
|
||||
}
|
||||
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
|
|
@ -205,6 +185,30 @@ else {
|
|||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' valign='top' width='50%'>\n";
|
||||
echo " <b>".$text['header-contacts']."</b>\n";
|
||||
echo " <br /><br />";
|
||||
echo " ".$text['description-contacts']."<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td align='center' valign='top' style='white-space: nowrap;' nowrap>\n";
|
||||
echo $paging_controls;
|
||||
echo " </td>\n";
|
||||
echo " <td align='right' valign='top' width='50%'>\n";
|
||||
echo " <form method='GET' name='frm_search' action=''>\n";
|
||||
echo " <input class='formfld' style='text-align: right;' type='text' name='search_all' value=\"".$search_all."\">\n";
|
||||
echo " <input class='btn' type='submit' name='submit' value=\"".$text['button-search']."\">\n";
|
||||
if (permission_exists('contact_add')) {
|
||||
echo "<input type='button' class='btn' alt='".$text['button-import']."' onclick=\"window.location='contact_import.php'\" value='".$text['button-import']."'>\n";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
|
@ -256,21 +260,15 @@ else {
|
|||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='15' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
echo "<td colspan='15' align='right'>\n";
|
||||
echo " <a href='contact_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo $paging_controls;
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
|
|
|||
Loading…
Reference in New Issue