/** * Function gets the search details from the users_table with paging enabled. * * * @return string */ function searchUserDetails_withpaging() { $dispname = $_POST['displayname']; $firstname = $_POST['firstname']; $lastname = $_POST['lastnname']; $email = $_POST['email']; $status = $_POST['status']; $pagesize = 10; if (isset($_GET['page'])) { $start = trim($_GET['page'] - 1) * $pagesize; $end = $pagesize; } else { $start = 0; $end = $pagesize; } $total = 0; $sql = "select user_id,user_display_name,user_fname,user_lname,user_email,user_status from users_table"; $condition = array(); if ($dispname != '') { $condition[] = " user_display_name like '%" . $dispname . "%'"; } if ($firstname != '') { $condition[] = " user_fname like '%" . $firstname . "%'"; } if ($lastname != '') { $condition[] = " user_lname like '%" . $lastname . "%'"; } if ($email != '') { $condition[] = " user_email like '%" . $email . "%'"; } if ($status != '') { $condition[] = " user_status = '" . $status . "'"; } if (count($condition) > 1) { $sql .= ' where ' . implode(' and ', $condition); } elseif (count($condition) > 0) { $sql .= ' where ' . implode('', $condition); } $sql .= ' order by user_display_name asc'; if ($_POST['search'] != 'btnreport') { $query = new Bin_Query(); if ($query->executeQuery($sql)) { $total = ceil($query->totrows / $pagesize); include_once 'classes/Lib/Paging.php'; $tmp = new Lib_Paging('classic', array('totalpages' => $total, 'length' => 10), 'pagination'); $this->data['paging'] = $tmp->output; $this->data['prev'] = $tmp->prev; $this->data['next'] = $tmp->next; $sql1 = $sql . " LIMIT {$start},{$end}"; $query1 = new Bin_Query(); if ($query1->executeQuery($sql1)) { $_SESSION['sql'] = $sql1; $output = Display_DAdminUserRegistration::showUserDetail($query1->records, 1, $this->data['paging'], $this->data['prev'], $this->data['next']); } else { $output = Display_DAdminUserRegistration::showUserDetail($query1->records, 0, $this->data['paging'], $this->data['prev'], $this->data['next']); } } else { return "No Users Found"; } } else { Core_CAdminUserRegistration::createReport($_SESSION['sql']); } return $output; }